using sbcLabSystem.Data.Domain.Account; using System; using System.Collections.Generic; using System.Linq; using System.Web; using PalGain.Core; using BatchService.Framework.Utility; using sbcLabSystem.Service.Account; namespace sbcLabSystem.Models.Backstage { public class LabViewModel { public LabViewModel Init(int LabId) { this.Labinfo = UserRequestInfoModel.FromEntity(PalGainEngine.Instance.Resolve() .GetAllUserRequestInfoQueryable().FirstOrDefault(p => p.Id == LabId)); if (string.IsNullOrEmpty(Labinfo.LabCode)) { this.Labinfo.LabCode = PalGainEngine.Instance.Resolve().GetCurrentMaxLabCode(); this.Labinfo.LabLoginName = this.Labinfo.LabCode; } this.SimliarLabList = PalGainEngine.Instance.Resolve().GetAllUserRequestInfoQueryable() .Where(p => p.State==1&& p.CompanyName.Length > 2 && p.CompanyName.Substring(0, 2) == Labinfo.CompanyName.Substring(0, 2)).ToList() .Select(p => UserRequestInfoModel.FromEntity(p)).ToList(); return this; } public LabViewModel Search(string CompanyName) { this.Labinfo = new UserRequestInfoModel(); Labinfo.CompanyName = CompanyName; this.SimliarLabList = PalGainEngine.Instance.Resolve().GetAllUserRequestInfoQueryable() .Where(p => string.IsNullOrEmpty(p.CompanyName) == false && p.CompanyName.ToLower().Contains(CompanyName.ToLower())).ToList() .Select(p => UserRequestInfoModel.FromEntity(p)).ToList(); return this; } public int State { get; set; } public UserRequestInfoModel Labinfo { get; set; } public List SimliarLabList { get; set; } } }