Ejemplo n.º 1
0
        private string CodeAsString(WasteCode code)
        {
            if (code.CodeType != CodeType.H || !code.Code.StartsWith("HP"))
            {
                return(code.Code);
            }

            return(code.Code + " EU");
        }
        private string CodeAsString(WasteCode code)
        {
            if (code.CodeType != CodeType.H || !code.Code.StartsWith("HP"))
            {
                return code.Code;
            }

            return code.Code + " EU";
        }
Ejemplo n.º 3
0
        public BaselOecdCode(WasteCode code)
        {
            if (code.CodeType != CodeType.Basel && code.CodeType != CodeType.Oecd)
            {
                throw new ArgumentException(string.Format(
                                                "Supplied code type {0} is not basel or oecd",
                                                code.CodeType));
            }

            Code = new WasteTypeWasteCode(code.Id);
        }
Ejemplo n.º 4
0
        public BaselOecdCode(WasteCode code)
        {
            if (code.CodeType != CodeType.Basel && code.CodeType != CodeType.Oecd)
            {
                throw new ArgumentException(string.Format(
                    "Supplied code type {0} is not basel or oecd",
                    code.CodeType));
            }

            Code = new WasteTypeWasteCode(code.Id);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取分页列表
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">分页大小</param>
        /// <param name="name">名称 - 搜索项</param>
        /// <param name="no">编号 - 搜索项</param>
        /// <returns></returns>
        public WebResult <PageList <Waste> > Get_WastePageList(int pageIndex, int pageSize, WasteCode code, string thingId, string oilId, string carId, string userId, string license)
        {
            using (DbRepository entities = new DbRepository())
            {
                var query = entities.Waste.AsQueryable().AsNoTracking();
                if (code != WasteCode.None)
                {
                    query = query.Where(x => x.Code == code);
                }
                if (license.IsNotNullOrEmpty())
                {
                    var carIdList = Cache_Get_CarList().AsQueryable().Where(x => x.License.Contains(license)).Select(x => x.ID).ToList();
                    query = query.Where(x => carIdList.Contains(x.CarID));
                }
                //不是管理员只能看到自己的
                //if (!Client.LoginUser.IsAdmin)
                //{
                //    query = query.Where(x => x.CreatedUserID.Equals(Client.LoginUser.ID));
                //}
                if (oilId.IsNotNullOrEmpty())
                {
                    query = query.Where(x => x.OilID.Equals(oilId));
                }
                if (thingId.IsNotNullOrEmpty() && thingId != "-1")
                {
                    query = query.Where(x => x.ThingID.Equals(thingId));
                }
                if (carId.IsNotNullOrEmpty())
                {
                    query = query.Where(x => x.CarID.Equals(carId));
                }
                if (userId.IsNotNullOrEmpty())
                {
                    query = query.Where(x => x.CreatedUserID.Equals(userId));
                }
                var count        = query.Count();
                var list         = query.OrderByDescending(x => x.AddDate).ThenBy(x => x.CreatedTime).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
                var userDic      = Cache_Get_UserDic();
                var carDic       = Cache_Get_CarList_Dic();
                var thingDic     = Cache_Get_DataDictionary()[GroupCode.Thing];
                var refuelingDic = Cache_Get_DataDictionary()[GroupCode.RefuelingPoint];
                var repairDic    = Cache_Get_DataDictionary()[GroupCode.RepairingPoint];
                var oilDic       = Cache_Get_OilCardList_Dic();
                list.ForEach(x =>
                {
                    if (!string.IsNullOrEmpty(x.CreatedUserID) && userDic.ContainsKey(x.CreatedUserID))
                    {
                        x.CreatedUserName = userDic[x.CreatedUserID].Name;
                    }
                    if (!string.IsNullOrEmpty(x.CarID) && carDic.ContainsKey(x.CarID))
                    {
                        x.License = carDic[x.CarID].License;
                    }
                    if (x.Code == WasteCode.Oil)
                    {
                        if (!string.IsNullOrEmpty(x.TargetID) && refuelingDic.ContainsKey(x.TargetID))
                        {
                            x.TargetName = refuelingDic[x.TargetID].Value;
                        }
                        if (!string.IsNullOrEmpty(x.OilID) && oilDic.ContainsKey(x.OilID))
                        {
                            x.OilName = oilDic[x.OilID].CardNO;
                        }
                    }
                    else if (x.Code == WasteCode.Repair)
                    {
                        if (!string.IsNullOrEmpty(x.TargetID) && repairDic.ContainsKey(x.TargetID))
                        {
                            x.TargetName = repairDic[x.TargetID].Value;
                        }
                    }
                    if (!string.IsNullOrEmpty(x.ThingID) && thingDic.ContainsKey(x.ThingID))
                    {
                        x.ThingName = thingDic[x.ThingID].Value;
                    }
                });


                return(ResultPageList(list, pageIndex, pageSize, count));
            }
        }
 public TestableWasteCodeInfo(WasteCode wasteCode, string customCode = null)
 {
     this.CodeType = wasteCode.CodeType;
     this.WasteCode = wasteCode;
     this.CustomCode = customCode;
 }
Ejemplo n.º 7
0
        public static BaselOecdCode CreateFor(WasteCode code)
        {
            Guard.ArgumentNotNull(() => code, code);

            return(new BaselOecdCode(code));
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 获取分页列表
 /// </summary>
 /// <param name="pageIndex">页码</param>
 /// <param name="pageSize">分页大小</param>
 /// <param name="name">名称 - 搜索项</param>
 /// <param name="no">编号 - 搜索项</param>
 /// <returns></returns>
 public JsonResult GetPageList(int pageIndex, int pageSize, WasteCode code, string thingId, string oilId, string carId, string userId, string license)
 {
     return(JResult(WebService.Get_WastePageList(pageIndex, pageSize, code, thingId, oilId, carId, userId, license)));
 }
Ejemplo n.º 9
0
        public static BaselOecdCode CreateFor(WasteCode code)
        {
            Guard.ArgumentNotNull(() => code, code);

            return new BaselOecdCode(code);
        }
Ejemplo n.º 10
0
 public TestableWasteCodeInfo(WasteCode wasteCode, string customCode = null)
 {
     this.CodeType   = wasteCode.CodeType;
     this.WasteCode  = wasteCode;
     this.CustomCode = customCode;
 }