示例#1
0
        /// <summary>
        /// 将IN_BACK00记录实体由普通的实体(DataAccess.Model.IN_BACK00)转换为SubSonic插件生成的实体
        /// </summary>
        /// <param name="model">普通的实体(DataAccess.Model.IN_BACK00)</param>
        /// <returns>IN_BACK00</returns>
        public IN_BACK00 Transform(DataAccess.Model.IN_BACK00 model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new IN_BACK00
            {
                Id = model.Id,
                SHOP_ID = model.SHOP_ID,
                IB_ID = model.IB_ID,
                STATUS = model.STATUS,
                INPUT_DATE = model.INPUT_DATE,
                OUT_SHOP = model.OUT_SHOP,
                STOCK_ID = model.STOCK_ID,
                USER_ID = model.USER_ID,
                APP_USER = model.APP_USER,
                APP_DATETIME = model.APP_DATETIME,
                RELATE_ID = model.RELATE_ID,
                Memo = model.Memo,
                LOCKED = model.LOCKED,
                CRT_DATETIME = model.CRT_DATETIME,
                CRT_USER_ID = model.CRT_USER_ID,
                MOD_DATETIME = model.MOD_DATETIME,
                MOD_USER_ID = model.MOD_USER_ID,
                LAST_UPDATE = model.LAST_UPDATE,
                Trans_STATUS = model.Trans_STATUS,
            });
        }
示例#2
0
        /// <summary>
        /// 更新IIS缓存中指定Id记录
        /// </summary>
        /// <param name="model">记录实体</param>
        public void SetModelForCache(DataAccess.Model.IN_BACK00 model)
        {
            //从缓存中读取记录列表
            var list = GetList();

            //从缓存中删除记录
            DelCache(model.Id);
            //添加记录
            list.Add(model);
        }
示例#3
0
        /// <summary>
        /// 给实体赋值
        /// </summary>
        /// <param name="model">实体</param>
        /// <param name="dic">列名与值</param>
        public void SetModelValue(DataAccess.Model.IN_BACK00 model, Dictionary <string, object> dic)
        {
            if (model == null || dic == null)
            {
                return;
            }

            //遍历字典,逐个给字段赋值
            foreach (var d in dic)
            {
                SetModelValue(model, d.Key, d.Value);
            }
        }
示例#4
0
        /// <summary>
        /// 给实体赋值
        /// </summary>
        /// <param name="model">实体</param>
        /// <param name="colName">列名</param>
        /// <param name="value">值</param>
        public void SetModelValue(DataAccess.Model.IN_BACK00 model, string colName, object value)
        {
            if (model == null || string.IsNullOrEmpty(colName))
            {
                return;
            }

            //返回指定条件的实体
            switch (colName)
            {
            case "Id":
                model.Id = (int)value;
                break;

            case "SHOP_ID":
                model.SHOP_ID = (string)value;
                break;

            case "IB_ID":
                model.IB_ID = (string)value;
                break;

            case "STATUS":
                model.STATUS = (int)value;
                break;

            case "INPUT_DATE":
                model.INPUT_DATE = (DateTime)value;
                break;

            case "OUT_SHOP":
                model.OUT_SHOP = (string)value;
                break;

            case "STOCK_ID":
                model.STOCK_ID = (string)value;
                break;

            case "USER_ID":
                model.USER_ID = (string)value;
                break;

            case "APP_USER":
                model.APP_USER = (string)value;
                break;

            case "APP_DATETIME":
                model.APP_DATETIME = (DateTime)value;
                break;

            case "RELATE_ID":
                model.RELATE_ID = (string)value;
                break;

            case "Memo":
                model.Memo = (string)value;
                break;

            case "LOCKED":
                model.LOCKED = ConvertHelper.Ctinyint(value);
                break;

            case "CRT_DATETIME":
                model.CRT_DATETIME = (DateTime)value;
                break;

            case "CRT_USER_ID":
                model.CRT_USER_ID = (string)value;
                break;

            case "MOD_DATETIME":
                model.MOD_DATETIME = (DateTime)value;
                break;

            case "MOD_USER_ID":
                model.MOD_USER_ID = (string)value;
                break;

            case "LAST_UPDATE":
                model.LAST_UPDATE = (DateTime)value;
                break;

            case "Trans_STATUS":
                model.Trans_STATUS = ConvertHelper.Ctinyint(value);
                break;
            }
        }
示例#5
0
        /// <summary>
        /// 从IIS缓存中获取指定Id记录
        /// </summary>
        /// <param name="conditionColName">条件列名</param>
        /// <param name="value">条件值</param>
        /// <returns>DataAccess.Model.IN_BACK00</returns>
        public DataAccess.Model.IN_BACK00 GetModelForCache(string conditionColName, object value)
        {
            try
            {
                //从缓存中获取List
                var list = GetList();
                DataAccess.Model.IN_BACK00           model      = null;
                Expression <Func <IN_BACK00, 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 "IB_ID":
                    model      = list.SingleOrDefault(x => x.IB_ID == (string)value);
                    expression = x => x.IB_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 = IN_BACK00.SingleOrDefault(expression);
                    if (tem == null)
                    {
                        return(null);
                    }
                    else
                    {
                        //对查询出来的实体进行转换
                        model = Transform(tem);

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

                return(null);
            }
        }
示例#6
0
        /// <summary>
        /// 返回实体中指定字段名的值
        /// </summary>
        /// <param name="model">实体</param>
        /// <param name="colName">获取的字段名</param>
        /// <returns></returns>
        private object GetFieldValue(DataAccess.Model.IN_BACK00 model, string colName)
        {
            if (model == null || string.IsNullOrEmpty(colName))
            {
                return(null);
            }
            //返回指定的列值
            switch (colName)
            {
            case "Id":
                return(model.Id);

            case "SHOP_ID":
                return(model.SHOP_ID);

            case "IB_ID":
                return(model.IB_ID);

            case "STATUS":
                return(model.STATUS);

            case "INPUT_DATE":
                return(model.INPUT_DATE);

            case "OUT_SHOP":
                return(model.OUT_SHOP);

            case "STOCK_ID":
                return(model.STOCK_ID);

            case "USER_ID":
                return(model.USER_ID);

            case "APP_USER":
                return(model.APP_USER);

            case "APP_DATETIME":
                return(model.APP_DATETIME);

            case "RELATE_ID":
                return(model.RELATE_ID);

            case "Memo":
                return(model.Memo);

            case "LOCKED":
                return(model.LOCKED);

            case "CRT_DATETIME":
                return(model.CRT_DATETIME);

            case "CRT_USER_ID":
                return(model.CRT_USER_ID);

            case "MOD_DATETIME":
                return(model.MOD_DATETIME);

            case "MOD_USER_ID":
                return(model.MOD_USER_ID);

            case "LAST_UPDATE":
                return(model.LAST_UPDATE);

            case "Trans_STATUS":
                return(model.Trans_STATUS);
            }

            return(null);
        }