songjun
2024-09-05 a3302fda10ff21ed3700be462ad560163ca13f14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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<AccountService>()
                .GetAllUserRequestInfoQueryable().FirstOrDefault(p => p.Id == LabId));
            if (string.IsNullOrEmpty(Labinfo.LabCode))
            {
                this.Labinfo.LabCode = PalGainEngine.Instance.Resolve<AccountService>().GetCurrentMaxLabCode();
                this.Labinfo.LabLoginName = this.Labinfo.LabCode;
            }
            this.SimliarLabList = PalGainEngine.Instance.Resolve<AccountService>().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<AccountService>().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<UserRequestInfoModel> SimliarLabList { get; set; }
    }
}