Example #1
0
        public List <GETEquipmentListVM> getEquipmentListByJobsite(long jobsiteAuto, int User)
        {
            List <GETEquipmentListVM> result = new List <GETEquipmentListVM>();

            if (jobsiteAuto == 0)
            {
                return(result);
            }

            using (var dataEntitiesShared = new DAL.SharedContext())
            {
                result = (from eqmt in dataEntitiesShared.EQUIPMENT
                          join lu_mmta in dataEntitiesShared.LU_MMTA
                          on eqmt.mmtaid_auto equals lu_mmta.mmtaid_auto
                          join model in dataEntitiesShared.MODEL
                          on lu_mmta.model_auto equals model.model_auto
                          join make in dataEntitiesShared.MAKE
                          on lu_mmta.make_auto equals make.make_auto
                          where eqmt.crsf_auto == jobsiteAuto
                          select new GETEquipmentListVM
                {
                    equipmentid_auto = eqmt.equipmentid_auto,
                    serialno = eqmt.serialno,
                    unitno = eqmt.unitno,
                    model_auto = model.model_auto,
                    modeldesc = model.modeldesc,
                    makedesc = make.makedesc
                }).ToList();
            }
            var accessible = new BLL.Core.Domain.UserAccess(new SharedContext(), User).getAccessibleEquipments().Select(m => m.equipmentid_auto);

            return(result.Where(m => accessible.Any(k => k == m.equipmentid_auto)).ToList());
        }
Example #2
0
        public List <GETEquipmentListVM> getEquipmentListByCustomer(long customerAuto, System.Security.Principal.IPrincipal User)
        {
            List <GETEquipmentListVM> result = new List <GETEquipmentListVM>();

            if (customerAuto == 0)
            {
                return(result);
            }

            using (var dataEntitiesShared = new DAL.SharedContext())
            {
                result = (from eqmt in dataEntitiesShared.EQUIPMENT
                          join crsf in dataEntitiesShared.CRSF
                          on eqmt.crsf_auto equals crsf.crsf_auto
                          join customer in dataEntitiesShared.CUSTOMER
                          on crsf.customer_auto equals customer.customer_auto
                          join lu_mmta in dataEntitiesShared.LU_MMTA
                          on eqmt.mmtaid_auto equals lu_mmta.mmtaid_auto
                          join model in dataEntitiesShared.MODEL
                          on lu_mmta.model_auto equals model.model_auto
                          join make in dataEntitiesShared.MAKE
                          on lu_mmta.make_auto equals make.make_auto
                          where customer.customer_auto == customerAuto
                          select new GETEquipmentListVM
                {
                    equipmentid_auto = eqmt.equipmentid_auto,
                    serialno = eqmt.serialno,
                    unitno = eqmt.unitno,
                    modeldesc = model.modeldesc,
                    makedesc = make.makedesc,
                    customer_auto = customer.customer_auto,
                    cust_name = customer.cust_name
                }).ToList();
            }
            var accessible = new BLL.Core.Domain.UserAccess(new SharedContext(), User).getAccessibleEquipments().Select(m => m.equipmentid_auto);

            return(result.Where(m => accessible.Any(k => k == m.equipmentid_auto)).ToList());
        }