/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.TAKEIN11</returns> public DataAccess.Model.TAKEIN11 GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.TAKEIN11 model = null; Expression <Func <TAKEIN11, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "SHOP_ID": model = list.SingleOrDefault(x => x.SHOP_ID == (string)value); expression = x => x.SHOP_ID == (string)value; break; case "TAKEIN_ID": model = list.SingleOrDefault(x => x.TAKEIN_ID == (string)value); expression = x => x.TAKEIN_ID == (string)value; break; case "SNo": model = list.SingleOrDefault(x => x.SNo == (int)value); expression = x => x.SNo == (int)value; break; case "PROD_ID": model = list.SingleOrDefault(x => x.PROD_ID == (string)value); expression = x => x.PROD_ID == (string)value; break; case "QUANTITY": model = list.SingleOrDefault(x => x.QUANTITY == (decimal)value); expression = x => x.QUANTITY == (decimal)value; break; case "STD_UNIT": model = list.SingleOrDefault(x => x.STD_UNIT == (string)value); expression = x => x.STD_UNIT == (string)value; break; case "STD_CONVERT": model = list.SingleOrDefault(x => x.STD_CONVERT == (int)value); expression = x => x.STD_CONVERT == (int)value; break; case "STD_QUAN": model = list.SingleOrDefault(x => x.STD_QUAN == (decimal)value); expression = x => x.STD_QUAN == (decimal)value; break; case "STD_PRICE": model = list.SingleOrDefault(x => x.STD_PRICE == (decimal)value); expression = x => x.STD_PRICE == (decimal)value; break; case "Tax": model = list.SingleOrDefault(x => x.Tax == (decimal)value); expression = x => x.Tax == (decimal)value; break; case "QUAN1": model = list.SingleOrDefault(x => x.QUAN1 == (decimal)value); expression = x => x.QUAN1 == (decimal)value; break; case "QUAN2": model = list.SingleOrDefault(x => x.QUAN2 == (decimal)value); expression = x => x.QUAN2 == (decimal)value; break; case "Item_DISC_Amt": model = list.SingleOrDefault(x => x.Item_DISC_Amt == (decimal)value); expression = x => x.Item_DISC_Amt == (decimal)value; break; case "MEMO": model = list.SingleOrDefault(x => x.MEMO == (string)value); expression = x => x.MEMO == (string)value; break; case "BAT_NO": model = list.SingleOrDefault(x => x.BAT_NO == (string)value); expression = x => x.BAT_NO == (string)value; break; case "Exp_DateTime": model = list.SingleOrDefault(x => x.Exp_DateTime == (DateTime)value); expression = x => x.Exp_DateTime == (DateTime)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = TAKEIN11.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取TAKEIN11表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.TABLE_SEED</returns> public DataAccess.Model.TABLE_SEED GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.TABLE_SEED model = null; Expression <Func <TABLE_SEED, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "TABLE_NAME": model = list.SingleOrDefault(x => x.TABLE_NAME == (string)value); expression = x => x.TABLE_NAME == (string)value; break; case "SEED_DATETIME": model = list.SingleOrDefault(x => x.SEED_DATETIME == (string)value); expression = x => x.SEED_DATETIME == (string)value; break; case "SEED_ID": model = list.SingleOrDefault(x => x.SEED_ID == (int)value); expression = x => x.SEED_ID == (int)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = TABLE_SEED.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取TABLE_SEED表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.PLAN01</returns> public DataAccess.Model.PLAN01 GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.PLAN01 model = null; Expression <Func <PLAN01, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "SHOP_ID": model = list.SingleOrDefault(x => x.SHOP_ID == (string)value); expression = x => x.SHOP_ID == (string)value; break; case "PLAN_ID": model = list.SingleOrDefault(x => x.PLAN_ID == (string)value); expression = x => x.PLAN_ID == (string)value; break; case "SNo": model = list.SingleOrDefault(x => x.SNo == (int)value); expression = x => x.SNo == (int)value; break; case "PROD_ID": model = list.SingleOrDefault(x => x.PROD_ID == (string)value); expression = x => x.PROD_ID == (string)value; break; case "QUANTITY": model = list.SingleOrDefault(x => x.QUANTITY == (decimal)value); expression = x => x.QUANTITY == (decimal)value; break; case "STD_UNIT": model = list.SingleOrDefault(x => x.STD_UNIT == (string)value); expression = x => x.STD_UNIT == (string)value; break; case "STD_CONVERT": model = list.SingleOrDefault(x => x.STD_CONVERT == (int)value); expression = x => x.STD_CONVERT == (int)value; break; case "STD_QUAN": model = list.SingleOrDefault(x => x.STD_QUAN == (decimal)value); expression = x => x.STD_QUAN == (decimal)value; break; case "STD_PRICE": model = list.SingleOrDefault(x => x.STD_PRICE == (decimal)value); expression = x => x.STD_PRICE == (decimal)value; break; case "ACT_QUAN": model = list.SingleOrDefault(x => x.ACT_QUAN == (decimal)value); expression = x => x.ACT_QUAN == (decimal)value; break; case "Dispose_QUAN": model = list.SingleOrDefault(x => x.Dispose_QUAN == (decimal)value); expression = x => x.Dispose_QUAN == (decimal)value; break; case "QUAN": model = list.SingleOrDefault(x => x.QUAN == (decimal)value); expression = x => x.QUAN == (decimal)value; break; case "BATCH1": model = list.SingleOrDefault(x => x.BATCH1 == (decimal)value); expression = x => x.BATCH1 == (decimal)value; break; case "BATCH2": model = list.SingleOrDefault(x => x.BATCH2 == (int)value); expression = x => x.BATCH2 == (int)value; break; case "QUAN1": model = list.SingleOrDefault(x => x.QUAN1 == (decimal)value); expression = x => x.QUAN1 == (decimal)value; break; case "QUAN2": model = list.SingleOrDefault(x => x.QUAN2 == (decimal)value); expression = x => x.QUAN2 == (decimal)value; break; case "COM_ID": model = list.SingleOrDefault(x => x.COM_ID == (string)value); expression = x => x.COM_ID == (string)value; break; case "Memo": model = list.SingleOrDefault(x => x.Memo == (string)value); expression = x => x.Memo == (string)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = PLAN01.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取PLAN01表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.STOCK</returns> public DataAccess.Model.STOCK GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.STOCK model = null; Expression <Func <STOCK, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "SHOP_ID": model = list.SingleOrDefault(x => x.SHOP_ID == (string)value); expression = x => x.SHOP_ID == (string)value; break; case "STOCK_ID": model = list.SingleOrDefault(x => x.STOCK_ID == (string)value); expression = x => x.STOCK_ID == (string)value; break; case "STOCK_NAME": model = list.SingleOrDefault(x => x.STOCK_NAME == (string)value); expression = x => x.STOCK_NAME == (string)value; break; case "IsDefBill": model = list.SingleOrDefault(x => x.IsDefBill == (byte)value); expression = x => x.IsDefBill == (byte)value; break; case "IsBool": model = list.SingleOrDefault(x => x.IsBool == (byte)value); expression = x => x.IsBool == (byte)value; break; case "Memo": model = list.SingleOrDefault(x => x.Memo == (string)value); expression = x => x.Memo == (string)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; case "Stock_Kind": model = list.SingleOrDefault(x => x.Stock_Kind == (int)value); expression = x => x.Stock_Kind == (int)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = STOCK.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取STOCK表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定条件的记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.UploadType</returns> public DataAccess.Model.UploadType GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.UploadType model = null; Expression <Func <UploadType, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "TypeKey": model = list.SingleOrDefault(x => x.TypeKey == (string)value); expression = x => x.TypeKey == (string)value; break; case "Name": model = list.SingleOrDefault(x => x.Name == (string)value); expression = x => x.Name == (string)value; break; case "Ext": model = list.SingleOrDefault(x => x.Ext == (string)value); expression = x => x.Ext == (string)value; break; case "IsSys": model = list.SingleOrDefault(x => x.IsSys == (byte)value); expression = x => x.IsSys == (byte)value; break; case "Manager_Id": model = list.SingleOrDefault(x => x.Manager_Id == (int)value); expression = x => x.Manager_Id == (int)value; break; case "Manager_CName": model = list.SingleOrDefault(x => x.Manager_CName == (string)value); expression = x => x.Manager_CName == (string)value; break; case "UpdateDate": model = list.SingleOrDefault(x => x.UpdateDate == (DateTime)value); expression = x => x.UpdateDate == (DateTime)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = UploadType.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); SetModelForCache(model); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取UploadType表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.PREPARE01</returns> public DataAccess.Model.PREPARE01 GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.PREPARE01 model = null; Expression <Func <PREPARE01, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "SHOP_ID": model = list.SingleOrDefault(x => x.SHOP_ID == (string)value); expression = x => x.SHOP_ID == (string)value; break; case "PREPARE_ID": model = list.SingleOrDefault(x => x.PREPARE_ID == (string)value); expression = x => x.PREPARE_ID == (string)value; break; case "SNo": model = list.SingleOrDefault(x => x.SNo == (int)value); expression = x => x.SNo == (int)value; break; case "PROD_ID": model = list.SingleOrDefault(x => x.PROD_ID == (string)value); expression = x => x.PROD_ID == (string)value; break; case "QUANTITY": model = list.SingleOrDefault(x => x.QUANTITY == (decimal)value); expression = x => x.QUANTITY == (decimal)value; break; case "STD_UNIT": model = list.SingleOrDefault(x => x.STD_UNIT == (string)value); expression = x => x.STD_UNIT == (string)value; break; case "STD_CONVERT": model = list.SingleOrDefault(x => x.STD_CONVERT == (int)value); expression = x => x.STD_CONVERT == (int)value; break; case "STD_QUAN": model = list.SingleOrDefault(x => x.STD_QUAN == (decimal)value); expression = x => x.STD_QUAN == (decimal)value; break; case "STD_PRICE": model = list.SingleOrDefault(x => x.STD_PRICE == (decimal)value); expression = x => x.STD_PRICE == (decimal)value; break; case "COST": model = list.SingleOrDefault(x => x.COST == (decimal)value); expression = x => x.COST == (decimal)value; break; case "QUAN1": model = list.SingleOrDefault(x => x.QUAN1 == (decimal)value); expression = x => x.QUAN1 == (decimal)value; break; case "QUAN2": model = list.SingleOrDefault(x => x.QUAN2 == (decimal)value); expression = x => x.QUAN2 == (decimal)value; break; case "sProd_ID": model = list.SingleOrDefault(x => x.sProd_ID == (string)value); expression = x => x.sProd_ID == (string)value; break; case "BAT_NO": model = list.SingleOrDefault(x => x.BAT_NO == (int)value); expression = x => x.BAT_NO == (int)value; break; case "IsScales": model = list.SingleOrDefault(x => x.IsScales == (byte)value); expression = x => x.IsScales == (byte)value; break; case "IsFlag": model = list.SingleOrDefault(x => x.IsFlag == (byte)value); expression = x => x.IsFlag == (byte)value; break; case "Scales_User": model = list.SingleOrDefault(x => x.Scales_User == (string)value); expression = x => x.Scales_User == (string)value; break; case "Scale_Date": model = list.SingleOrDefault(x => x.Scale_Date == (DateTime)value); expression = x => x.Scale_Date == (DateTime)value; break; case "MEMO": model = list.SingleOrDefault(x => x.MEMO == (string)value); expression = x => x.MEMO == (string)value; break; case "Exported_ID": model = list.SingleOrDefault(x => x.Exported_ID == (string)value); expression = x => x.Exported_ID == (string)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = PREPARE01.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取PREPARE01表记录时出现异常", e); return(null); } }
/*********************************************************************** * 自定义函数 * ***********************************************************************/ #region 自定义函数 #region 添加用户操作日志 /// <summary> /// 添加用户操作日志 /// </summary> /// <param name="page">页面指针</param> /// <param name="useLogOccurrence">用户操作内容备注,{0}=用户名称,{1}=当前页面名称</param> public void Save(Page page, string useLogOccurrence) { try { //创建用户操作日志对象 var uselog = new UseLog(); //记录登录时间 uselog.AddDate = DateTime.Now; //获取用户在线实体 var model = OnlineUsersBll.GetInstence().GetOnlineUsersModel(); if (model != null) { //当前用户ID uselog.Manager_Id = model.Manager_Id; //当前用户名称 uselog.Manager_CName = model.Manager_CName; } else { //当前用户ID uselog.Manager_Id = 0; //当前用户名称 uselog.Manager_CName = ""; } if (page != null) { //当前页面ID var menu = MenuInfoBll.GetInstence().GetMenuInfo(page.Request.Url.AbsolutePath); if (menu == null) { uselog.MenuInfo_Id = 0; } else { uselog.MenuInfo_Id = menu.Id; //当前页面名称 uselog.MenuInfo_Name = menu.Name; } //判断是否为首页 if (uselog.MenuInfo_Id == 0) { if (page.Request.Url.AbsolutePath.Equals("/WebManage/Main.aspx")) { //当前页面名称 uselog.MenuInfo_Name = "首页"; } } } //当前用户IP uselog.Ip = IpHelper.GetUserIp(); //操作内容 uselog.Notes = StringHelper.FilterSql(String.Format(useLogOccurrence, uselog.Manager_CName, uselog.MenuInfo_Name)); //插入记录 uselog.Save(); } catch (Exception e) { //记录日志 CommonBll.WriteLog("添加用户操作日志时出现异常", e); } }
/// <summary> /// 从IIS缓存中获取V_STOCK01_PRODUCT00表记录 /// </summary> /// <param name="isCache">是否从缓存中读取</param> public IList <DataAccess.Model.V_STOCK01_PRODUCT00> GetList(bool isCache = true) { try { //判断是否使用缓存 if (CommonBll.IsUseCache() && isCache) { //检查指定缓存是否过期——缓存当天有效,第二天自动清空 if (CommonBll.CheckCacheIsExpired(const_CacheKey_Date)) { //删除缓存 DelAllCache(); } //从缓存中获取DataTable var obj = CacheHelper.GetCache(const_CacheKey); //如果缓存为null,则查询数据库 if (obj == null) { var list = GetList(false); //将查询出来的数据存储到缓存中 CacheHelper.SetCache(const_CacheKey, list); //存储当前时间 CacheHelper.SetCache(const_CacheKey_Date, DateTime.Now); return(list); } //缓存中存在数据,则直接返回 else { return((IList <DataAccess.Model.V_STOCK01_PRODUCT00>)obj); } } else { //定义临时实体集 IList <DataAccess.Model.V_STOCK01_PRODUCT00> list = null; //获取全表缓存加载条件表达式 var exp = GetExpression <V_STOCK01_PRODUCT00>(); //如果条件为空,则查询全表所有记录 if (exp == null) { //从数据库中获取所有记录 var all = V_STOCK01_PRODUCT00.All(); list = all == null ? null : Transform(all.ToList()); } else { //从数据库中查询出指定条件的记录,并转换为指定实体集 var all = V_STOCK01_PRODUCT00.Find(exp); list = all == null ? null : Transform(all); } return(list); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取V_STOCK01_PRODUCT00表记录时出现异常", e); } return(null); }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.V_ORDERDEP02_PRODDEP</returns> public DataAccess.Model.V_ORDERDEP02_PRODDEP GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.V_ORDERDEP02_PRODDEP model = null; Expression <Func <V_ORDERDEP02_PRODDEP, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "ORDDEP_ID": model = list.SingleOrDefault(x => x.ORDDEP_ID == (string)value); expression = x => x.ORDDEP_ID == (string)value; break; case "DEP_ID": model = list.SingleOrDefault(x => x.DEP_ID == (string)value); expression = x => x.DEP_ID == (string)value; break; case "DEP_NAME": model = list.SingleOrDefault(x => x.DEP_NAME == (string)value); expression = x => x.DEP_NAME == (string)value; break; case "USABLE": model = list.SingleOrDefault(x => x.USABLE == (byte)value); expression = x => x.USABLE == (byte)value; break; case "Meno": model = list.SingleOrDefault(x => x.Meno == (string)value); expression = x => x.Meno == (string)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = V_ORDERDEP02_PRODDEP.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取V_ORDERDEP02_PRODDEP表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.SYS_PARAMATERS</returns> public DataAccess.Model.SYS_PARAMATERS GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.SYS_PARAMATERS model = null; Expression <Func <SYS_PARAMATERS, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "AREA_ID": model = list.SingleOrDefault(x => x.AREA_ID == (string)value); expression = x => x.AREA_ID == (string)value; break; case "COL_ORDER_TYPE": model = list.SingleOrDefault(x => x.COL_ORDER_TYPE == (int)value); expression = x => x.COL_ORDER_TYPE == (int)value; break; case "ORDER_PRICE_TYPE": model = list.SingleOrDefault(x => x.ORDER_PRICE_TYPE == (int)value); expression = x => x.ORDER_PRICE_TYPE == (int)value; break; case "QUANTITY_TYPE": model = list.SingleOrDefault(x => x.QUANTITY_TYPE == (int)value); expression = x => x.QUANTITY_TYPE == (int)value; break; case "EXPECT_DATE_TYPE": model = list.SingleOrDefault(x => x.EXPECT_DATE_TYPE == (int)value); expression = x => x.EXPECT_DATE_TYPE == (int)value; break; case "PRD_BOM_TYPE": model = list.SingleOrDefault(x => x.PRD_BOM_TYPE == (int)value); expression = x => x.PRD_BOM_TYPE == (int)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; case "MEMO": model = list.SingleOrDefault(x => x.MEMO == (string)value); expression = x => x.MEMO == (string)value; break; case "PALN_TYPE": model = list.SingleOrDefault(x => x.PALN_TYPE == (int)value); expression = x => x.PALN_TYPE == (int)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = SYS_PARAMATERS.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取SYS_PARAMATERS表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.COMPONENT01</returns> public DataAccess.Model.COMPONENT01 GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.COMPONENT01 model = null; Expression <Func <COMPONENT01, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "COM_ID": model = list.SingleOrDefault(x => x.COM_ID == (string)value); expression = x => x.COM_ID == (string)value; break; case "DETAIL_ID": model = list.SingleOrDefault(x => x.DETAIL_ID == (int)value); expression = x => x.DETAIL_ID == (int)value; break; case "PROD_ID": model = list.SingleOrDefault(x => x.PROD_ID == (string)value); expression = x => x.PROD_ID == (string)value; break; case "QUANTITY": model = list.SingleOrDefault(x => x.QUANTITY == (decimal)value); expression = x => x.QUANTITY == (decimal)value; break; case "LQUANTITY": model = list.SingleOrDefault(x => x.LQUANTITY == (decimal)value); expression = x => x.LQUANTITY == (decimal)value; break; case "New_PROD_ID": model = list.SingleOrDefault(x => x.New_PROD_ID == (string)value); expression = x => x.New_PROD_ID == (string)value; break; case "IsScales": model = list.SingleOrDefault(x => x.IsScales == (byte)value); expression = x => x.IsScales == (byte)value; break; case "PrtTag": model = list.SingleOrDefault(x => x.PrtTag == (byte)value); expression = x => x.PrtTag == (byte)value; break; case "IsFlag": model = list.SingleOrDefault(x => x.IsFlag == (byte)value); expression = x => x.IsFlag == (byte)value; break; case "Memo": model = list.SingleOrDefault(x => x.Memo == (string)value); expression = x => x.Memo == (string)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = COMPONENT01.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取COMPONENT01表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.PROD_UNIT</returns> public DataAccess.Model.PROD_UNIT GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.PROD_UNIT model = null; Expression <Func <PROD_UNIT, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "UNIT_ID": model = list.SingleOrDefault(x => x.UNIT_ID == (string)value); expression = x => x.UNIT_ID == (string)value; break; case "UNIT_NAME": model = list.SingleOrDefault(x => x.UNIT_NAME == (string)value); expression = x => x.UNIT_NAME == (string)value; break; case "UNIT_MEMO": model = list.SingleOrDefault(x => x.UNIT_MEMO == (string)value); expression = x => x.UNIT_MEMO == (string)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; case "STATUS": model = list.SingleOrDefault(x => x.STATUS == (byte)value); expression = x => x.STATUS == (byte)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = PROD_UNIT.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取PROD_UNIT表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.RECEIVABLES00</returns> public DataAccess.Model.RECEIVABLES00 GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.RECEIVABLES00 model = null; Expression <Func <RECEIVABLES00, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (long)value); expression = x => x.Id == (long)value; break; case "SHOP_ID": model = list.SingleOrDefault(x => x.SHOP_ID == (string)value); expression = x => x.SHOP_ID == (string)value; break; case "BILL_ID": model = list.SingleOrDefault(x => x.BILL_ID == (string)value); expression = x => x.BILL_ID == (string)value; break; case "STATUS": model = list.SingleOrDefault(x => x.STATUS == (int)value); expression = x => x.STATUS == (int)value; break; case "INPUT_DATE": model = list.SingleOrDefault(x => x.INPUT_DATE == (DateTime)value); expression = x => x.INPUT_DATE == (DateTime)value; break; case "IN_SHOP": model = list.SingleOrDefault(x => x.IN_SHOP == (string)value); expression = x => x.IN_SHOP == (string)value; break; case "USER_ID": model = list.SingleOrDefault(x => x.USER_ID == (string)value); expression = x => x.USER_ID == (string)value; break; case "APP_USER": model = list.SingleOrDefault(x => x.APP_USER == (string)value); expression = x => x.APP_USER == (string)value; break; case "APP_DATETIME": model = list.SingleOrDefault(x => x.APP_DATETIME == (DateTime)value); expression = x => x.APP_DATETIME == (DateTime)value; break; case "MEMO": model = list.SingleOrDefault(x => x.MEMO == (string)value); expression = x => x.MEMO == (string)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; case "BILL_AMOUNT": model = list.SingleOrDefault(x => x.BILL_AMOUNT == (decimal)value); expression = x => x.BILL_AMOUNT == (decimal)value; break; case "BILL_COST": model = list.SingleOrDefault(x => x.BILL_COST == (decimal)value); expression = x => x.BILL_COST == (decimal)value; break; case "BILL_TYPE": model = list.SingleOrDefault(x => x.BILL_TYPE == (int)value); expression = x => x.BILL_TYPE == (int)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = RECEIVABLES00.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取RECEIVABLES00表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.EMPLOYEE</returns> public DataAccess.Model.EMPLOYEE GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.EMPLOYEE model = null; Expression <Func <EMPLOYEE, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "EMP_ID": model = list.SingleOrDefault(x => x.EMP_ID == (string)value); expression = x => x.EMP_ID == (string)value; break; case "EMP_NAME": model = list.SingleOrDefault(x => x.EMP_NAME == (string)value); expression = x => x.EMP_NAME == (string)value; break; case "EMP_Birthday": model = list.SingleOrDefault(x => x.EMP_Birthday == (DateTime)value); expression = x => x.EMP_Birthday == (DateTime)value; break; case "EMP_ADD": model = list.SingleOrDefault(x => x.EMP_ADD == (string)value); expression = x => x.EMP_ADD == (string)value; break; case "EMP_TEL": model = list.SingleOrDefault(x => x.EMP_TEL == (string)value); expression = x => x.EMP_TEL == (string)value; break; case "EMP_ZIP": model = list.SingleOrDefault(x => x.EMP_ZIP == (string)value); expression = x => x.EMP_ZIP == (string)value; break; case "EMP_EMAIL": model = list.SingleOrDefault(x => x.EMP_EMAIL == (string)value); expression = x => x.EMP_EMAIL == (string)value; break; case "EMP_MOBILE": model = list.SingleOrDefault(x => x.EMP_MOBILE == (string)value); expression = x => x.EMP_MOBILE == (string)value; break; case "EMP_MEMO": model = list.SingleOrDefault(x => x.EMP_MEMO == (string)value); expression = x => x.EMP_MEMO == (string)value; break; case "EMP_ENABLE": model = list.SingleOrDefault(x => x.EMP_ENABLE == (int)value); expression = x => x.EMP_ENABLE == (int)value; break; case "EMP_SEX": model = list.SingleOrDefault(x => x.EMP_SEX == (int)value); expression = x => x.EMP_SEX == (int)value; break; case "EMP_CodeID": model = list.SingleOrDefault(x => x.EMP_CodeID == (string)value); expression = x => x.EMP_CodeID == (string)value; break; case "EMP_LEVEL": model = list.SingleOrDefault(x => x.EMP_LEVEL == (int)value); expression = x => x.EMP_LEVEL == (int)value; break; case "EMP_PASSWORD": model = list.SingleOrDefault(x => x.EMP_PASSWORD == (string)value); expression = x => x.EMP_PASSWORD == (string)value; break; case "EMP_BDATE": model = list.SingleOrDefault(x => x.EMP_BDATE == (DateTime)value); expression = x => x.EMP_BDATE == (DateTime)value; break; case "EMP_EDATE": model = list.SingleOrDefault(x => x.EMP_EDATE == (DateTime)value); expression = x => x.EMP_EDATE == (DateTime)value; break; case "EMP_WAGE": model = list.SingleOrDefault(x => x.EMP_WAGE == (decimal)value); expression = x => x.EMP_WAGE == (decimal)value; break; case "EMP_Education": model = list.SingleOrDefault(x => x.EMP_Education == (int)value); expression = x => x.EMP_Education == (int)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; case "STATUS": model = list.SingleOrDefault(x => x.STATUS == (byte)value); expression = x => x.STATUS == (byte)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = EMPLOYEE.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取EMPLOYEE表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定条件的记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.LoginLog</returns> public DataAccess.Model.LoginLog GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.LoginLog model = null; Expression <Func <LoginLog, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "AddDate": model = list.SingleOrDefault(x => x.AddDate == (DateTime)value); expression = x => x.AddDate == (DateTime)value; break; case "Manager_Id": model = list.SingleOrDefault(x => x.Manager_Id == (int)value); expression = x => x.Manager_Id == (int)value; break; case "Manager_CName": model = list.SingleOrDefault(x => x.Manager_CName == (string)value); expression = x => x.Manager_CName == (string)value; break; case "Ip": model = list.SingleOrDefault(x => x.Ip == (string)value); expression = x => x.Ip == (string)value; break; case "Notes": model = list.SingleOrDefault(x => x.Notes == (string)value); expression = x => x.Notes == (string)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = LoginLog.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); SetModelForCache(model); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取LoginLog表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.V_STOCK01_PRODUCT00</returns> public DataAccess.Model.V_STOCK01_PRODUCT00 GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.V_STOCK01_PRODUCT00 model = null; Expression <Func <V_STOCK01_PRODUCT00, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "STOCK_ID": model = list.SingleOrDefault(x => x.STOCK_ID == (string)value); expression = x => x.STOCK_ID == (string)value; break; case "PROD_ID": model = list.SingleOrDefault(x => x.PROD_ID == (string)value); expression = x => x.PROD_ID == (string)value; break; case "PROD_NAME1": model = list.SingleOrDefault(x => x.PROD_NAME1 == (string)value); expression = x => x.PROD_NAME1 == (string)value; break; case "STOCK_UNIT_QUAN": model = list.SingleOrDefault(x => x.STOCK_UNIT_QUAN == (decimal)value); expression = x => x.STOCK_UNIT_QUAN == (decimal)value; break; case "STOCK_UNIT1_QUAN": model = list.SingleOrDefault(x => x.STOCK_UNIT1_QUAN == (decimal)value); expression = x => x.STOCK_UNIT1_QUAN == (decimal)value; break; case "STOCK_UNIT2_QUAN": model = list.SingleOrDefault(x => x.STOCK_UNIT2_QUAN == (decimal)value); expression = x => x.STOCK_UNIT2_QUAN == (decimal)value; break; case "USABLE": model = list.SingleOrDefault(x => x.USABLE == (byte)value); expression = x => x.USABLE == (byte)value; break; case "Meno": model = list.SingleOrDefault(x => x.Meno == (string)value); expression = x => x.Meno == (string)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = V_STOCK01_PRODUCT00.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取V_STOCK01_PRODUCT00表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.ErrorLog</returns> public DataAccess.Model.ErrorLog GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.ErrorLog model = null; Expression <Func <ErrorLog, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "ErrTime": model = list.SingleOrDefault(x => x.ErrTime == (DateTime)value); expression = x => x.ErrTime == (DateTime)value; break; case "BrowserVersion": model = list.SingleOrDefault(x => x.BrowserVersion == (string)value); expression = x => x.BrowserVersion == (string)value; break; case "BrowserType": model = list.SingleOrDefault(x => x.BrowserType == (string)value); expression = x => x.BrowserType == (string)value; break; case "Ip": model = list.SingleOrDefault(x => x.Ip == (string)value); expression = x => x.Ip == (string)value; break; case "PageUrl": model = list.SingleOrDefault(x => x.PageUrl == (string)value); expression = x => x.PageUrl == (string)value; break; case "ErrMessage": model = list.SingleOrDefault(x => x.ErrMessage == (string)value); expression = x => x.ErrMessage == (string)value; break; case "ErrSource": model = list.SingleOrDefault(x => x.ErrSource == (string)value); expression = x => x.ErrSource == (string)value; break; case "StackTrace": model = list.SingleOrDefault(x => x.StackTrace == (string)value); expression = x => x.StackTrace == (string)value; break; case "HelpLink": model = list.SingleOrDefault(x => x.HelpLink == (string)value); expression = x => x.HelpLink == (string)value; break; case "Type": model = list.SingleOrDefault(x => x.Type == (byte)value); expression = x => x.Type == (byte)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = ErrorLog.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取ErrorLog表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.IN00</returns> public DataAccess.Model.IN00 GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.IN00 model = null; Expression <Func <IN00, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "SHOP_ID": model = list.SingleOrDefault(x => x.SHOP_ID == (string)value); expression = x => x.SHOP_ID == (string)value; break; case "IN_ID": model = list.SingleOrDefault(x => x.IN_ID == (string)value); expression = x => x.IN_ID == (string)value; break; case "STATUS": model = list.SingleOrDefault(x => x.STATUS == (int)value); expression = x => x.STATUS == (int)value; break; case "INPUT_DATE": model = list.SingleOrDefault(x => x.INPUT_DATE == (DateTime)value); expression = x => x.INPUT_DATE == (DateTime)value; break; case "OUT_SHOP": model = list.SingleOrDefault(x => x.OUT_SHOP == (string)value); expression = x => x.OUT_SHOP == (string)value; break; case "STOCK_ID": model = list.SingleOrDefault(x => x.STOCK_ID == (string)value); expression = x => x.STOCK_ID == (string)value; break; case "USER_ID": model = list.SingleOrDefault(x => x.USER_ID == (string)value); expression = x => x.USER_ID == (string)value; break; case "APP_USER": model = list.SingleOrDefault(x => x.APP_USER == (string)value); expression = x => x.APP_USER == (string)value; break; case "APP_DATETIME": model = list.SingleOrDefault(x => x.APP_DATETIME == (DateTime)value); expression = x => x.APP_DATETIME == (DateTime)value; break; case "RELATE_ID": model = list.SingleOrDefault(x => x.RELATE_ID == (string)value); expression = x => x.RELATE_ID == (string)value; break; case "Memo": model = list.SingleOrDefault(x => x.Memo == (string)value); expression = x => x.Memo == (string)value; break; case "LOCKED": model = list.SingleOrDefault(x => x.LOCKED == (byte)value); expression = x => x.LOCKED == (byte)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; case "MOD_DATETIME": model = list.SingleOrDefault(x => x.MOD_DATETIME == (DateTime)value); expression = x => x.MOD_DATETIME == (DateTime)value; break; case "MOD_USER_ID": model = list.SingleOrDefault(x => x.MOD_USER_ID == (string)value); expression = x => x.MOD_USER_ID == (string)value; break; case "LAST_UPDATE": model = list.SingleOrDefault(x => x.LAST_UPDATE == (DateTime)value); expression = x => x.LAST_UPDATE == (DateTime)value; break; case "Trans_STATUS": model = list.SingleOrDefault(x => x.Trans_STATUS == (byte)value); expression = x => x.Trans_STATUS == (byte)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = IN00.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取IN00表记录时出现异常", e); return(null); } }
/// <summary> /// 从IIS缓存中获取指定Id记录 /// </summary> /// <param name="conditionColName">条件列名</param> /// <param name="value">条件值</param> /// <returns>DataAccess.Model.HEAD_SHOP_BILL</returns> public DataAccess.Model.HEAD_SHOP_BILL GetModelForCache(string conditionColName, object value) { try { //从缓存中获取List var list = GetList(); DataAccess.Model.HEAD_SHOP_BILL model = null; Expression <Func <HEAD_SHOP_BILL, bool> > expression = null; //返回指定条件的实体 switch (conditionColName) { case "Id": model = list.SingleOrDefault(x => x.Id == (int)value); expression = x => x.Id == (int)value; break; case "SHOP_ID": model = list.SingleOrDefault(x => x.SHOP_ID == (string)value); expression = x => x.SHOP_ID == (string)value; break; case "SU_ID": model = list.SingleOrDefault(x => x.SU_ID == (string)value); expression = x => x.SU_ID == (string)value; break; case "BILL_AMOUNT": model = list.SingleOrDefault(x => x.BILL_AMOUNT == (decimal)value); expression = x => x.BILL_AMOUNT == (decimal)value; break; case "PAY_AMOUNT": model = list.SingleOrDefault(x => x.PAY_AMOUNT == (decimal)value); expression = x => x.PAY_AMOUNT == (decimal)value; break; case "PAY_METHOD": model = list.SingleOrDefault(x => x.PAY_METHOD == (byte)value); expression = x => x.PAY_METHOD == (byte)value; break; case "BILL_DATE": model = list.SingleOrDefault(x => x.BILL_DATE == (DateTime)value); expression = x => x.BILL_DATE == (DateTime)value; break; case "PAY_DATE": model = list.SingleOrDefault(x => x.PAY_DATE == (DateTime)value); expression = x => x.PAY_DATE == (DateTime)value; break; case "Memo": model = list.SingleOrDefault(x => x.Memo == (string)value); expression = x => x.Memo == (string)value; break; case "CRT_DATETIME": model = list.SingleOrDefault(x => x.CRT_DATETIME == (DateTime)value); expression = x => x.CRT_DATETIME == (DateTime)value; break; case "CRT_USER_ID": model = list.SingleOrDefault(x => x.CRT_USER_ID == (string)value); expression = x => x.CRT_USER_ID == (string)value; break; default: return(null); } if (model == null) { //从数据库中读取 var tem = HEAD_SHOP_BILL.SingleOrDefault(expression); if (tem == null) { return(null); } else { //对查询出来的实体进行转换 model = Transform(tem); return(model); } } else { return(model); } } catch (Exception e) { //记录日志 CommonBll.WriteLog("从IIS缓存中获取HEAD_SHOP_BILL表记录时出现异常", e); return(null); } }