public List <TEntity> GetList(bool detail) { try { DateTime start = DateTime.Now; Log.Info(LogTags.DbGet, " >>>>>>> TagService.GetList"); List <TEntity> returnList = null; if (detail) { var list = new List <TEntity>(); var query = from tag in dbSet.DbSet join pos in db.LocationCardPositions.DbSet on tag.Code equals pos.Id into posLst from pos2 in posLst.DefaultIfEmpty() join r in db.LocationCardToPersonnels.DbSet on tag.Id equals r.LocationCardId into c2pLst from r2 in c2pLst.DefaultIfEmpty() //left join join p in db.Personnels.DbSet on r2.PersonnelId equals p.Id into pLst from p2 in pLst.DefaultIfEmpty() select new { Tag = tag, Person = p2, Pos = pos2 }; var result = query.ToList(); var list2 = new List <int>(); foreach (var item in query) { if (!list2.Contains(item.Tag.Id)) { list2.Add(item.Tag.Id); LocationCardPositionBll.SetPostionState(item.Pos); var entity = item.Tag.ToTModel(); entity.Person = item.Person.ToTModel(); //if (item.Pos != null) //{ // item.Pos.SetState(); //} entity.Pos = item.Pos.ToTModel(); list.Add(entity); } } returnList = list.ToWCFList(); } else { returnList = dbSet.ToList().ToWcfModelList(); } TimeSpan time = DateTime.Now - start; Log.Info(LogTags.DbGet, " <<<<< TagService.GetList time:" + time); return(returnList); } catch (System.Exception ex) { Log.Error(tag, "GetList", "Exceptioin:" + ex); return(null); } }
public Bll(bool autoDetectChangesEnabled, bool lazyLoadingEnabled, bool isCreateDb, bool useProxy = true) { Db = new LocationDb(isCreateDb); Db.Configuration.AutoDetectChangesEnabled = autoDetectChangesEnabled; Db.Configuration.LazyLoadingEnabled = lazyLoadingEnabled; //关闭延迟加载 Db.Configuration.ProxyCreationEnabled = useProxy; if (ShowLog) { Db.Database.Log = Log.Debug; } Archors = new ArchorBll(Db); Areas = new AreaBll(Db); Bounds = new BoundBll(Db); ConfigArgs = new ConfigArgBll(Db); Departments = new DepartmentBll(Db); DevAlarms = new DevAlarmBll(Db); DevInfos = new DevInfoBll(Db); Dev_DoorAccess = new Dev_DoorAccessBll(Db); Dev_CameraInfos = new Dev_CameraInfoBll(Db); DevInstantDatas = new DevInstantDataBll(Db); DevModels = new DevModelBll(Db); DevTypes = new DevTypeBll(Db); EntranceGuardCards = new EntranceGuardCardBll(Db); EntranceGuardCardToPersonnels = new EntranceGuardCardToPersonnelBll(Db); AreaAuthorizations = new AreaAuthorizationBll(Db); AreaAuthorizationRecords = new AreaAuthorizationRecordBll(Db); KKSCodes = new KKSCodeBll(Db); LocationAlarms = new LocationAlarmBll(Db); LocationCards = new LocationCardBll(Db); LocationCardPositions = new LocationCardPositionBll(Db); LocationCardToPersonnels = new LocationCardToPersonnelBll(Db); MobileInspections = new MobileInspectionBll(Db); MobileInspectionContents = new MobileInspectionContentBll(Db); MobileInspectionDevs = new MobileInspectionDevBll(Db); MobileInspectionItems = new MobileInspectionItemBll(Db); NodeKKSs = new NodeKKSBll(Db); OperationItems = new OperationItemBll(Db); OperationTickets = new OperationTicketBll(Db); Personnels = new PersonnelBll(Db); PersonnelMobileInspections = new PersonnelMobileInspectionBll(Db); PersonnelMobileInspectionItems = new PersonnelMobileInspectionItemBll(Db); Points = new PointBll(Db); Posts = new PostBll(Db); Roles = new RoleBll(Db); SafetyMeasuress = new SafetyMeasuresBll(Db); WorkTickets = new WorkTicketBll(Db); Pictures = new PictureBll(Db); ArchorSettings = new ArchorSettingBll(Db); CardRoles = new CardRoleBll(Db); DevMonitorNodes = new DevMonitorNodeBll(Db); //Shapes = new ShapeBll(Db); //ShapePoints = new ShapePointBll(); DevAlarmHistorys = new DevAlarmHistoryBll(DbHistory); DevEntranceGuardCardActions = new DevEntranceGuardCardActionBll(DbHistory); DevInfoHistorys = new DevInfoHistoryBll(DbHistory); DevInstantDataHistorys = new DevInstantDataHistoryBll(DbHistory); EntranceGuardCardHistorys = new EntranceGuardCardHistoryBll(DbHistory); EntranceGuardCardToPersonnelHistorys = new EntranceGuardCardToPersonnelHistoryBll(DbHistory); LocationAlarmHistorys = new LocationAlarmHistoryBll(DbHistory); LocationCardHistorys = new LocationCardHistoryBll(DbHistory); LocationCardToPersonnelHistorys = new LocationCardToPersonnelHistoryBll(DbHistory); OperationItemHistorys = new OperationItemHistoryBll(DbHistory); OperationTicketHistorys = new OperationTicketHistoryBll(DbHistory); PersonnelHistorys = new PersonnelHistoryBll(DbHistory); PersonnelMobileInspectionHistorys = new PersonnelMobileInspectionHistoryBll(DbHistory); PersonnelMobileInspectionItemHistorys = new PersonnelMobileInspectionItemHistoryBll(DbHistory); Positions = new PositionBll(DbHistory); SafetyMeasuresHistorys = new SafetyMeasuresHistoryBll(DbHistory); U3DPositions = new U3DPositionBll(DbHistory); WorkTicketHistorys = new WorkTicketHistoryBll(DbHistory); bus_anchors = new bus_anchorBll(DbE); bus_tags = new bus_tagBll(DbE); bus_anchor_config = new bus_anchor_configBll(DbE); bus_anchor_switch_area = new bus_anchor_switch_areaBll(DbE); //LocationCards.ToList(); //DevEntranceGuardCardActions.ToList(); //bus_archors.ToList(); Z.EntityFramework.Extensions.LicenseManager.AddLicense("34;100-LLHSWWHA", "384799A60700037CBFC0EB5E03A62474"); }
public PosService(Bll bll) { this.db = bll; dbSet = db.LocationCardPositions; }
public PosService() { db = new Bll(false, true, false, true); dbSet = db.LocationCardPositions; }
private RealPositionBuffer() { this.bll = new Bll(); PosBll = bll.LocationCardPositions; }
private RealPositionBuffer(Bll bll) { this.bll = bll; PosBll = bll.LocationCardPositions; }
public PosService() { db = new Bll(); dbSet = db.LocationCardPositions; }
public List <TEntity> GetList(bool detail, bool showAll) { try { if (detail) { return(GetListEx(false)); } else { var list = new List <TEntity>(); var list1 = dbSet.ToList(); var query = from p in dbSet.DbSet join r in db.LocationCardToPersonnels.DbSet on p.Id equals r.PersonnelId into rList from r2 in rList.DefaultIfEmpty() //left join join tag in db.LocationCards.DbSet on r2.LocationCardId equals tag.Id into tagList from tag2 in tagList.DefaultIfEmpty() join pos in db.LocationCardPositions.DbSet on tag2.Code equals pos.Id into posList from pos2 in posList.DefaultIfEmpty() //left join select new { Person = p, Tag = tag2, Pos = pos2 }; var pList = query.ToList(); foreach (var item in pList) { try { LocationCardPositionBll.SetPostionState(item.Pos); TEntity p = item.Person.ToTModel(); var tag = item.Tag.ToTModel(); var pos = item.Pos.ToTModel(); if (pos != null) { p.AreaId = pos.AreaId ?? 2; //要是AreaId为空就改为四会电厂区域 } if (showAll == false) { if (pos == null || (pos != null && pos.IsHide)) { //隐藏待机的人员 } else { list.Add(p); } } else { list.Add(p); } if (detail) { p.Tag = tag; p.Pos = pos; //tag.Pos = pos; } } catch (Exception ex1) { Log.Error("PersonService.GetList Item:" + ex1); } } return(list); } } catch (Exception ex) { Log.Error(tag, "PersonService.GetList:" + ex); return(null); } }