/// <summary>
        /// 从IIS缓存中获取指定Id记录
        /// </summary>
        /// <param name="id">主键Id</param>
        /// <returns>DataAccess.Model.V_STOCK_SHOP00</returns>
        public DataAccess.Model.V_STOCK_SHOP00 GetModelForCache(long id)
        {
            try
            {
                //从缓存中读取指定Id记录
                var model = GetModelForCache(x => x.Id == id);

                if (model == null)
                {
                    //从数据库中读取
                    var tem = V_STOCK_SHOP00.SingleOrDefault(x => x.Id == id);
                    if (tem == null)
                    {
                        return(null);
                    }
                    else
                    {
                        //对查询出来的实体进行转换
                        model = Transform(tem);
                        return(model);
                    }
                }
                else
                {
                    return(model);
                }
            }
            catch (Exception e)
            {
                //记录日志
                CommonBll.WriteLog("从IIS缓存中获取V_STOCK_SHOP00表记录时出现异常", e);

                return(null);
            }
        }
 /// <summary>
 /// 获取指定Id记录
 /// </summary>
 /// <param name="id">主键Id</param>
 /// <param name="isCache">是否从缓存中读取</param>
 /// <returns>DataAccess.Model.V_STOCK_SHOP00</returns>
 public DataAccess.Model.V_STOCK_SHOP00 GetModel(long id, bool isCache = true)
 {
     //判断是否使用缓存
     if (CommonBll.IsUseCache() && isCache)
     {
         //从缓存中获取List
         var list = GetList();
         if (list == null)
         {
             return(null);
         }
         else
         {
             //在List查询指定主键Id的记录
             return(list.SingleOrDefault(x => x.Id == id));
         }
     }
     else
     {
         //从数据库中直接读取
         var model = V_STOCK_SHOP00.SingleOrDefault(x => x.Id == id);
         if (model == null)
         {
             return(null);
         }
         else
         {
             //对查询出来的实体进行转换
             return(Transform(model));
         }
     }
 }
 /// <summary>
 /// 获取Stock_Kind_Name字段值
 /// </summary>
 /// <param name="page">当前页面指针</param>
 /// <param name="pkValue">主键Id</param>
 /// <param name="isCache">是否从缓存中读取</param>
 /// <returns></returns>
 public string GetStock_Kind_Name(Page page, int pkValue, bool isCache = true)
 {
     //判断是否启用缓存
     if (isCache && CommonBll.IsUseCache())
     {
         //从缓存中获取实体
         var model = GetModelForCache(pkValue);
         return(model == null ? "" : model.Stock_Kind_Name);
     }
     else
     {
         //从数据库中查询
         var model = V_STOCK_SHOP00.SingleOrDefault(x => x.Id == pkValue);
         return(model == null ? "" : model.Stock_Kind_Name);
     }
 }
        /// <summary>
        /// 从IIS缓存中获取指定Id记录
        /// </summary>
        /// <param name="conditionColName">条件列名</param>
        /// <param name="value">条件值</param>
        /// <returns>DataAccess.Model.V_STOCK_SHOP00</returns>
        public DataAccess.Model.V_STOCK_SHOP00 GetModelForCache(string conditionColName, object value)
        {
            try
            {
                //从缓存中获取List
                var list = GetList();
                DataAccess.Model.V_STOCK_SHOP00           model      = null;
                Expression <Func <V_STOCK_SHOP00, 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 "SHOP_NAME1":
                    model      = list.SingleOrDefault(x => x.SHOP_NAME1 == (string)value);
                    expression = x => x.SHOP_NAME1 == (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 "Stock_Kind":
                    model      = list.SingleOrDefault(x => x.Stock_Kind == (int)value);
                    expression = x => x.Stock_Kind == (int)value;
                    break;

                case "Stock_Kind_Name":
                    model      = list.SingleOrDefault(x => x.Stock_Kind_Name == (string)value);
                    expression = x => x.Stock_Kind_Name == (string)value;
                    break;

                default:
                    return(null);
                }

                if (model == null)
                {
                    //从数据库中读取
                    var tem = V_STOCK_SHOP00.SingleOrDefault(expression);
                    if (tem == null)
                    {
                        return(null);
                    }
                    else
                    {
                        //对查询出来的实体进行转换
                        model = Transform(tem);

                        return(model);
                    }
                }
                else
                {
                    return(model);
                }
            }
            catch (Exception e)
            {
                //记录日志
                CommonBll.WriteLog("从IIS缓存中获取V_STOCK_SHOP00表记录时出现异常", e);

                return(null);
            }
        }