示例#1
0
        public List <RecommendationEntity> GetRecommendationByCompartment(long compartment)
        {
            //using (var context = new UndercarriageContext())
            //{
            //    return context.WSREComponentRecommendation.Select(c => new RecommendationEntity()
            //    {
            //        Description = c.Description,
            //        Id = c.Id,
            //        ValidComponentId = c.ValidComponentTypeId
            //    }).ToList();
            //}
            var result = new List <RecommendationEntity>();

            using (var dataEntities = new UndercarriageContext())
            {
                var items = dataEntities.Database.SqlQuery <RecommendationEntity>(
                    "select * from WSREComponentRecommendations"
                    + " where ValidComponentTypeId = @ValidComponentTypeId"
                    , new SqlParameter("@ValidComponentTypeId", compartment)
                    ).ToList();

                foreach (var item in items)
                {
                    result.Add(item);
                }
            }

            return(result);
        }
示例#2
0
 public UnitOfWork(UndercarriageContext context)
 {
     _context   = context;
     Components = new ComponentRepository(_context);
     Users      = new UserRepository(_context);
     Equipments = new EquipmentRepository(_context);
 }
示例#3
0
 public List <DAL.WSREDipTestCondition> GetLinksConditions()
 {
     using (var context = new UndercarriageContext())
     {
         return(context.WSREDipTestCondition.ToList());
     }
 }
示例#4
0
文件: Action.cs 项目: hari81/BLL
 public Action(DbContext context, IEquipmentActionRecord actionRecord, IGeneralInspectionModel Parameters)
 {
     _context = (UndercarriageContext)context;
     _current = actionRecord;
     if (Parameters.Id == 0)
     {
         Operation = new InsertInspectionGeneralAction(context, actionRecord, Parameters);
     }
     else
     {
         Operation = new UpdateInspectionGeneralAction(context, actionRecord, Parameters);
     }
 }
示例#5
0
文件: Action.cs 项目: hari81/BLL
 public Action(DbContext context, DbContext gContext, IEquipmentActionRecord actionRecord, GETEquipmentSetupParams Parameters)
 {
     _context  = (UndercarriageContext)context;
     _gContext = (GETContext)gContext;
     if (Parameters.IsUpdating)
     {
         Operation = new BLL.Core.Actions.UpdateEquipmentSetupAction(context, actionRecord, Parameters);
     }
     else
     {
         Operation = new BLL.GETCore.Repositories.GETEquipmentSetupAction(context, gContext, actionRecord, Parameters);
     }
 }
示例#6
0
 public MiningShovelMobileSyncManager(UndercarriageContext context)
 {
     this._context = context;
     this._TRACK_INSPECTION = _context.Set<DAL.TRACK_INSPECTION>();
     this._TEMP_UPLOAD_IMAGE = _context.Set<DAL.TEMP_UPLOAD_IMAGE>();
     this._INSPECTION_MANDATORY_IMAGES = _context.Set<DAL.INSPECTION_MANDATORY_IMAGES>();
     this._INSPECTION_COMPARTTYPE_RECORD = _context.Set<DAL.INSPECTION_COMPARTTYPE_RECORD>();
     this._INSPECTION_COMPARTTYPE_RECORD_IMAGES = _context.Set<DAL.INSPECTION_COMPARTTYPE_RECORD_IMAGES>();
     this._INSPECTION_COMPARTTYPE_IMAGES = _context.Set<DAL.INSPECTION_COMPARTTYPE_IMAGES>();
     this._TRACK_INSPECTION_DETAIL = _context.Set<DAL.TRACK_INSPECTION_DETAIL>();
     this._MEASUREMENT_POINT_RECORD = _context.Set<DAL.MEASUREMENT_POINT_RECORD>();
     this._MEASUREPOINT_RECORD_IMAGES = _context.Set<DAL.MEASUREPOINT_RECORD_IMAGES>();
 }
示例#7
0
 public WSREMobileManager(UndercarriageContext context)
 {
     this._context              = context;
     this._WSREs                = _context.Set <DAL.WSRE>();
     this._WSREInitialImages    = _context.Set <DAL.WSREInitialImage>();
     this._WSREComponentRecords = _context.Set <DAL.WSREComponentRecord>();
     this._WSREComponentImages  = _context.Set <DAL.WSREComponentImage>();
     this._WSREComponentRecordRecommendations = _context.Set <DAL.WSREComponentRecordRecommendation>();
     this._WSRECrackTests         = _context.Set <DAL.WSRECrackTest>();
     this._WSRECrackTestImages    = _context.Set <DAL.WSRECrackTestImage>();
     this._WSREDipTests           = _context.Set <DAL.WSREDipTest>();
     this._WSREDipTestImages      = _context.Set <DAL.WSREDipTestImage>();
     this._WSRE_TEMP_UPLOAD_IMAGE = _context.Set <DAL.WSRE_TEMP_UPLOAD_IMAGE>();
 }
示例#8
0
        public List <DAL.LuLinksCondition> GetAllLinksConditions()
        {
            List <DAL.LuLinksCondition> result = new List <DAL.LuLinksCondition>();

            using (var dataEntities = new UndercarriageContext())
            {
                var items = dataEntities.Database.SqlQuery <DAL.LuLinksCondition>(
                    "select * from LuLinksConditions"
                    ).ToList();

                foreach (var item in items)
                {
                    result.Add(item);
                }
            }
            return(result);
        }
        public int GetIdByTitle(string title)
        {
            using (var dataEntities = new UndercarriageContext())
            {
                var items = dataEntities.Database.SqlQuery <DAL.CUSTOMER_MODEL_MANDATORY_IMAGE>(
                    "select top 1 * from CUSTOMER_MODEL_MANDATORY_IMAGE "
                    + " where Title = @Title"
                    , new SqlParameter("@Title", title)
                    ).ToList();

                foreach (var item in items)
                {
                    return(item.Id);
                }
            }
            return(0);
        }
示例#10
0
文件: TrackTool.cs 项目: hari81/BLL
        public int GetIdByToolCode(string toolCode)
        {
            using (var dataEntities = new UndercarriageContext())
            {
                var items = dataEntities.Database.SqlQuery <DAL.TRACK_TOOL>(
                    "select top 1 * from TRACK_TOOL "
                    + " where tool_code = @tool_code"
                    , new SqlParameter("@tool_code", toolCode)
                    ).ToList();

                foreach (var item in items)
                {
                    return(item.tool_auto);
                }
            }
            return(0);
        }
示例#11
0
        public int GetIdByDescr(string description)
        {
            using (var dataEntities = new UndercarriageContext())
            {
                var items = dataEntities.Database.SqlQuery <DAL.TrackInspectionImageType>(
                    "select top 1 * from TrackInspectionImageTypes "
                    + " where TypeDescription = @Description"
                    , new SqlParameter("@Description", description)
                    ).ToList();

                foreach (var item in items)
                {
                    return(item.Id);
                }
            }
            return(0);
        }
示例#12
0
文件: LuModuleSub.cs 项目: hari81/BLL
        public List <COMPART_TOOL_IMAGE> GetEquipmentCompartToolImageListByModuleSubAuto(long Module_sub_auto)
        {
            List <COMPART_TOOL_IMAGE> resultList = new List <COMPART_TOOL_IMAGE>();

            if (Module_sub_auto == 0)
            {
                return(resultList);
            }
            var components = GetEquipmentComponentsBySubModuleId(Module_sub_auto);

            foreach (var cmp in components)
            {
                var k = new UndercarriageContext().COMPART_TOOL_IMAGE.Where(m => m.CompartId == cmp.compartid_auto);
                resultList.AddRange(k);
            }
            return(resultList.GroupBy(m => m.Id).Select(m => m.First()).ToList());
        }
示例#13
0
        public int CheckRecordExist(int?UploadInspectionId, string FileName)
        {
            using (var dataEntities = new UndercarriageContext())
            {
                var items = dataEntities.Database.SqlQuery <DAL.TEMP_UPLOAD_IMAGE>(
                    "select top 1 * from WSRE_TEMP_UPLOAD_IMAGE "
                    + " where UploadInspectionId = @UploadInspectionId and FileName = @FileName"
                    , new SqlParameter("@UploadInspectionId", UploadInspectionId)
                    , new SqlParameter("@FileName", FileName)
                    ).ToList();

                foreach (var item in items)
                {
                    return(item.Id);
                }
            }
            return(0);
        }
示例#14
0
 public MiningShovelMobileManager(UndercarriageContext context)
 {
     this._context = context;
 }
示例#15
0
 /// <summary>
 /// This is used to retrieve data displayed in the widgets on the dashboard
 /// </summary>
 /// <param name="context">New instance of DAL.UndercarriageContext</param>
 public WidgetManager(UndercarriageContext context)
 {
     this._context = context;
 }
示例#16
0
 public DealershipManager()
 {
     this._context = new SharedContext();
     this._undercarriageContext = new UndercarriageContext();
 }
示例#17
0
 public Report(UndercarriageContext context) : base(context)
 {
 }
示例#18
0
 public ComponentMeasurementTable(UndercarriageContext context)
 {
     _context = context;
 }
示例#19
0
文件: LuModuleSub.cs 项目: hari81/BLL
 public LuModuleSub(UndercarriageContext context)
 {
     this._context = context;
 }
示例#20
0
 public FindInspection(UndercarriageContext undercarriageContext, SharedContext sharedContext, long userId)
 {
     _context       = undercarriageContext;
     _sharedContext = sharedContext;
     _user          = _context.USER_TABLE.Find(userId);
 }
示例#21
0
        public SearchResult getEquipmentIdForInspectionsAdvancedSearch(int PageNo, int PageSize, List <SearchItem> SearchItems, int userId, bool hasInspection = false)
        {
            var _access = new UserAccess(new SharedContext(), userId);
            var accessibleEquipments = _access.getAccessibleEquipments().Select(m => new EquipmentSearchModel {
                EquipmentId = m.equipmentid_auto, CustomerId = m.Jobsite.customer_auto, CustomerName = m.Jobsite.Customer.cust_name, JobsiteId = m.crsf_auto, SiteName = m.Jobsite.site_name, FamilyId = m.LU_MMTA.type_auto, FamilyTitle = m.LU_MMTA.TYPE.typedesc, MakeId = m.LU_MMTA.make_auto, MakeTitle = m.LU_MMTA.MAKE.makedesc, ModelId = m.LU_MMTA.model_auto, ModelTitle = m.LU_MMTA.MODEL.modeldesc, serialno = m.serialno, unitno = m.unitno, Inspections = m.TRACK_INSPECTION.Select(k => new InspectionSearchModel {
                    InspectionId = k.inspection_auto, InspectionDate = k.inspection_date, Details = k.TRACK_INSPECTION_DETAIL.Select(p => new InspectoinDetailSearchModel {
                        DetailId = p.inspection_detail_auto, worn = p.worn_percentage
                    }).ToList()
                }).ToList(), LastReadingDate = m.last_reading_date ?? DateTime.MinValue
            }).ToList();

            var customerSearchIds   = SearchItems.Where(item => item.Id == (int)SearchItemType.Customer && item.SearchId != 0).Select(m => m.SearchId);
            var customerSearchTexts = SearchItems.Where(item => item.Id == (int)SearchItemType.Customer && item.SearchId == 0 && item.SearchStr.Length > 0).Select(m => m.SearchStr);

            if (customerSearchIds.Count() > 0 || customerSearchTexts.Count() > 0)
            {
                accessibleEquipments = accessibleEquipments.Where(m => customerSearchIds.Any(k => k == m.CustomerId) || customerSearchTexts.Any(k => m.CustomerName.ToLower().Contains(k.ToLower()))).ToList();
            }

            var jobsiteSearchIds   = SearchItems.Where(item => item.Id == (int)SearchItemType.Jobsite && item.SearchId != 0).Select(m => m.SearchId);
            var jobsiteSearchTexts = SearchItems.Where(item => item.Id == (int)SearchItemType.Jobsite && item.SearchId == 0 && item.SearchStr.Length > 0).Select(m => m.SearchStr);

            if (jobsiteSearchIds.Count() > 0 || jobsiteSearchTexts.Count() > 0)
            {
                accessibleEquipments = accessibleEquipments.Where(m => jobsiteSearchIds.Any(k => k == m.JobsiteId)).ToList();
            }

            var limitedEquipments = accessibleEquipments.ToList();

            PageNo = PageNo <= 1 ? 0 : PageNo - 1;
            using (var _context = new UndercarriageContext())
            {
                //var equipments = limitedEquipments.EQUIPMENTs.Where(m => limitedEquipmentIds.Any(k => m.equipmentid_auto == k));
                if (hasInspection)
                {
                    limitedEquipments = limitedEquipments.Where(m => m.Inspections.Count() > 0).ToList();
                }
                var equipmentSearchIds   = SearchItems.Where(item => item.Id == (int)SearchItemType.Equipment && item.SearchId != 0).Select(m => m.SearchId);
                var equipmentSearchTexts = SearchItems.Where(item => item.Id == (int)SearchItemType.Equipment && item.SearchId == 0 && item.SearchStr.Length > 0).Select(m => m.SearchStr);
                if (equipmentSearchIds.Count() > 0 || equipmentSearchTexts.Count() > 0)
                {
                    limitedEquipments = limitedEquipments.Where(m => equipmentSearchIds.Any(k => k == m.EquipmentId) || equipmentSearchTexts.Any(k => m.serialno.ToLower().Contains(k.ToLower())) || equipmentSearchTexts.Any(k => m.unitno.ToLower().Contains(k.ToLower()))).ToList();
                }

                //Family
                var familySearchIds   = SearchItems.Where(item => item.Id == (int)SearchItemType.Family && item.SearchId != 0).Select(m => m.SearchId);
                var familySearchTexts = SearchItems.Where(item => item.Id == (int)SearchItemType.Family && item.SearchId == 0 && item.SearchStr.Length > 0).Select(m => m.SearchStr);
                if (familySearchIds.Count() > 0 || familySearchTexts.Count() > 0)
                {
                    limitedEquipments = limitedEquipments.Where(m => familySearchIds.Any(k => k == m.FamilyId) || familySearchTexts.Any(k => m.FamilyTitle.ToLower().Contains(k.ToLower()))).ToList();
                }
                //Make
                var makeSearchIds   = SearchItems.Where(item => item.Id == (int)SearchItemType.Make && item.SearchId != 0).Select(m => m.SearchId);
                var makeSearchTexts = SearchItems.Where(item => item.Id == (int)SearchItemType.Make && item.SearchId == 0 && item.SearchStr.Length > 0).Select(m => m.SearchStr);
                if (makeSearchIds.Count() > 0 || makeSearchTexts.Count() > 0)
                {
                    limitedEquipments = limitedEquipments.Where(m => makeSearchIds.Any(k => k == m.MakeId) || makeSearchTexts.Any(k => m.MakeTitle.ToLower().Contains(k.ToLower()))).ToList();
                }

                //Model
                var modelSearchIds   = SearchItems.Where(item => item.Id == (int)SearchItemType.Model && item.SearchId != 0).Select(m => m.SearchId);
                var modelSearchTexts = SearchItems.Where(item => item.Id == (int)SearchItemType.Model && item.SearchId == 0 && item.SearchStr.Length > 0).Select(m => m.SearchStr);
                if (modelSearchIds.Count() > 0 || modelSearchTexts.Count() > 0)
                {
                    limitedEquipments = limitedEquipments.Where(m => modelSearchIds.Any(k => k == m.ModelId) || modelSearchTexts.Any(k => m.ModelTitle.ToLower().Contains(k.ToLower()))).ToList();
                }

                var IdAndDates = limitedEquipments.Select(m => new IdAndDate {
                    Id = (int)m.EquipmentId, Date = (m.LastReadingDate)
                });

                return(new SearchResult
                {
                    Total = IdAndDates.Count(),
                    Result = IdAndDates.OrderByDescending(m => m.Date).Skip(PageNo * PageSize).Take(PageSize).ToList().Select(m => new IdAndDate {
                        Id = m.Id, Date = m.Date.ToLocalTime().Date
                    }).ToList()
                });
            }
        }
示例#22
0
文件: LuModuleSub.cs 项目: hari81/BLL
        public List <GENERAL_EQ_UNIT> GetEquipmentComponentsBySubModuleId(long Module_sub_auto)
        {
            IList <GENERAL_EQ_UNIT> DALComponents = new UndercarriageContext().GENERAL_EQ_UNIT.Where(m => m.module_ucsub_auto == Module_sub_auto).OrderBy(m => m.LU_COMPART.LU_COMPART_TYPE.sorder).ThenBy(m => m.pos).ToList();

            return(DALComponents.ToList());
        }
示例#23
0
 public History(UndercarriageContext undercarriageContext, int historyRecordId)
 {
     _context = undercarriageContext;
     _history = _context.ACTION_TAKEN_HISTORY.Find(historyRecordId);
 }
示例#24
0
文件: Action.cs 项目: hari81/BLL
 public Action(DbContext context, IEquipmentActionRecord actionRecord, ChangeMeterUnitParams Parameters)
 {
     _context  = (UndercarriageContext)context;
     Operation = new ChangeMeterUnitAction(context, actionRecord, Parameters);
 }
示例#25
0
 /// <summary>
 /// This is used to retrieve and manipulate data on the manage equipment page in the undercarriage ui.
 /// </summary>
 /// <param name="context">New instance of DAL.UndercarriageContext</param>
 public ManageEquipmentManager(UndercarriageContext context)
 {
     this._context = context;
 }
示例#26
0
 public WSREMobileDownloadDB(UndercarriageContext context)
 {
     this._context = context;
 }
示例#27
0
 public UserRepository(UndercarriageContext context) : base(context)
 {
 }
示例#28
0
 public WSREMobileCreateNewChain(UndercarriageContext context)
 {
     this._context = context;
 }
示例#29
0
        public SearchResult getSystemIdAndDateAdvancedSearch(int PageNo, int PageSize, List <SearchItem> SearchItems, int userId, bool hasInspection = false)
        {
            var _access           = new UserAccess(new SharedContext(), userId);
            var accessableSystems = _access.GetAccessibleSystems();

            var customerSearchIds = SearchItems.Where(item => item.Id == (int)SearchItemType.Customer && item.SearchId != 0).Select(m => m.SearchId).ToList();

            if (customerSearchIds.Count() > 0)
            {
                accessableSystems = accessableSystems
                                    .Where(m =>
                                           (m.equipmentid_auto != null && customerSearchIds.Contains((int)m.EQUIPMENT.Jobsite.customer_auto)) ||
                                           (m.crsf_auto != null && customerSearchIds.Contains((int)m.Jobsite.customer_auto))
                                           );
            }

            var jobsiteSearchIds = SearchItems.Where(item => item.Id == (int)SearchItemType.Jobsite && item.SearchId != 0).Select(m => m.SearchId).ToList();

            if (jobsiteSearchIds.Count() > 0)
            {
                accessableSystems = accessableSystems.Where(m => jobsiteSearchIds.Contains((int)(m.crsf_auto ?? 0)));
            }

            var limitedSystems = accessableSystems.ToList();

            PageNo = PageNo <= 1 ? 0 : PageNo - 1;
            using (var _context = new UndercarriageContext())
            {
                var equipmentSearchIds = SearchItems.Where(item => item.Id == (int)SearchItemType.Equipment && item.SearchId != 0).Select(m => m.SearchId).ToList();
                if (equipmentSearchIds.Count() > 0)
                {
                    limitedSystems = limitedSystems.Where(m => equipmentSearchIds.Contains((int)(m.equipmentid_auto ?? 0))).ToList();
                }

                //Family
                var familySearchIds = SearchItems.Where(item => item.Id == (int)SearchItemType.Family && item.SearchId != 0).Select(m => m.SearchId).ToList();
                if (familySearchIds.Count() > 0)
                {
                    limitedSystems = limitedSystems
                                     .Where(m => m.make_auto != null)
                                     .Where(m => familySearchIds.Contains(m.Make.LU_MMTA.FirstOrDefault().type_auto)).ToList();
                }
                //Make
                var makeSearchIds = SearchItems.Where(item => item.Id == (int)SearchItemType.Make && item.SearchId != 0).Select(m => m.SearchId).ToList();
                if (makeSearchIds.Count() > 0)
                {
                    limitedSystems = limitedSystems.Where(m => makeSearchIds.Contains(m.make_auto ?? 0)).ToList();
                }

                //Model
                var modelSearchIds = SearchItems.Where(item => item.Id == (int)SearchItemType.Model && item.SearchId != 0).Select(m => m.SearchId).ToList();
                if (modelSearchIds.Count() > 0)
                {
                    limitedSystems = limitedSystems.Where(m => modelSearchIds.Contains(m.model_auto ?? 0)).ToList();
                }

                var evaluationExcludedA = SearchItems.Where(item => item.Id == (int)SearchItemType.EvaluationA && item.SearchId == 1).Count() == 0;

                /*if (evaluationExcludedA) {
                 *  limitedSystems = limitedSystems.Where(m =>
                 *  m.TRACK_INSPECTION_DETAIL.OrderByDescending(order => order.TRACK_INSPECTION.inspection_date).FirstOrDefault().worn_percentage.Max(k => k.worn) > (int)WornLimit.A).ToList();
                 *
                 * var evaluationExcludedB = SearchItems.Where(item => item.Id == (int)SearchItemType.EvaluationB && item.SearchId == 1).Count() == 0;
                 * if (evaluationExcludedB)
                 *  limitedEquipments = limitedEquipments.Where(m =>
                 *  m.Inspections.OrderByDescending(order => order.InspectionDate).FirstOrDefault().Details.Max(k => k.worn) <= (int)WornLimit.A ||
                 *  m.Inspections.OrderByDescending(order => order.InspectionDate).FirstOrDefault().Details.Max(k => k.worn) > (int)WornLimit.B).ToList();
                 *
                 * var evaluationExcludedC = SearchItems.Where(item => item.Id == (int)SearchItemType.EvaluationC && item.SearchId == 1).Count() == 0;
                 * if (evaluationExcludedC)
                 *  limitedEquipments = limitedEquipments.Where(m =>
                 *  m.Inspections.OrderByDescending(order => order.InspectionDate).FirstOrDefault().Details.Max(k => k.worn) <= (int)WornLimit.B ||
                 *  m.Inspections.OrderByDescending(order => order.InspectionDate).FirstOrDefault().Details.Max(k => k.worn) > (int)WornLimit.C).ToList();
                 *
                 * var evaluationExcludedX = SearchItems.Where(item => item.Id == (int)SearchItemType.EvaluationX && item.SearchId == 1).Count() == 0;
                 * if (evaluationExcludedX)
                 *  limitedEquipments = limitedEquipments.Where(m =>
                 *  m.Inspections.OrderByDescending(order => order.InspectionDate).FirstOrDefault().Details.Max(k => k.worn) <= (int)WornLimit.C).ToList();
                 */
                var IdAndDates = limitedSystems.Select(m => new IdAndDate {
                    Id = (int)m.Module_sub_auto, Date = DateTime.Now
                });

                return(new SearchResult
                {
                    Total = IdAndDates.Count(),
                    Result = IdAndDates.OrderByDescending(m => m.Date).Skip(PageNo * PageSize).Take(PageSize).ToList().Select(m => new IdAndDate {
                        Id = m.Id, Date = m.Date.ToLocalTime().Date
                    }).ToList()
                });
            }
        }
示例#30
0
 /// <summary>
 /// This is used to retrieve and manipulate data on the manage equipment page in the undercarriage ui.
 /// </summary>
 /// <param name="context">New instance of DAL.UndercarriageContext</param>
 public ComponentManager(UndercarriageContext context)
 {
     this._context = context;
 }