Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(ZSystem.Model.t_Operation model)
        {
            StringBuilder strSql;

            DbParameter[] cmdParms;
            PrepareUpdateCommand(model, out strSql, out cmdParms);
            return(dbHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms));
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ZSystem.Model.t_Operation model)
        {
            int count = dal.Update(model);

            if (EnableCache && count > 0)
            {
                RemoveModelCache(model.KeyID);
            }
        }
Beispiel #3
0
        public override bool Equals(object obj)
        {
            ZSystem.Model.t_Operation model = obj as ZSystem.Model.t_Operation;
            if (model != null && model.KeyID == this.KeyID)
            {
                return(true);
            }

            return(false);
        }
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 internal static void PrepareModel(ZSystem.Model.t_Operation model, DbDataReader dr)
 {
     model.KeyID       = GetString(dr["KeyID"]);
     model.ClientID    = GetString(dr["ClientID"]);
     model.iStatus     = GetInt(dr["iStatus"]);
     model.iTotalPrice = GetDouble(dr["iTotalPrice"]);
     model.CreateUser  = GetString(dr["CreateUser"]);
     model.Memo        = GetString(dr["Memo"]);
     model.IsEnable    = GetBool(dr["IsEnable"]);
     model.LastUpdate  = GetDateTime(dr["LastUpdate"]);
 }
        /// <summary>
        /// 为新增一条数据准备参数
        /// </summary>
        internal static void PrepareAddCommand(ZSystem.Model.t_Operation model, out StringBuilder strSql, out DbParameter[] cmdParms)
        {
            strSql = new StringBuilder();
            strSql.Append("INSERT INTO t_Operation(");
            strSql.Append("KeyID, ClientID, iStatus, iTotalPrice, CreateUser, Memo,IsEnable,LastUpdate)");
            strSql.Append(" VALUES (");
            strSql.Append("@in_KeyID, @in_ClientID, @in_iStatus, @in_iTotalPrice, @in_CreateUser, @in_Memo,@in_IsEnable,@in_LastUpdate)");

            cmdParms = new DbParameter[] {
                dbHelper.CreateInDbParameter("@in_KeyID", DbType.String, model.KeyID),
                dbHelper.CreateInDbParameter("@in_ClientID", DbType.String, model.ClientID),
                dbHelper.CreateInDbParameter("@in_iStatus", DbType.Int32, model.iStatus),
                dbHelper.CreateInDbParameter("@in_iTotalPrice", DbType.Double, model.iTotalPrice),
                dbHelper.CreateInDbParameter("@in_CreateUser", DbType.String, model.CreateUser),
                dbHelper.CreateInDbParameter("@in_Memo", DbType.String, model.Memo),
                dbHelper.CreateInDbParameter("@in_IsEnable", DbType.Boolean, model.IsEnable),
                dbHelper.CreateInDbParameter("@in_LastUpdate", DbType.String, model.LastUpdate)
            };
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ZSystem.Model.t_Operation GetModel(string KeyID)
 {
     ZSystem.Model.t_Operation model = null;
     if (!EnableCache)
     {
         model = dal.GetModel(KeyID);
     }
     else
     {
         string key = KeyID.ToString();
         if (GetModelCache(key) != null)
         {
             model = (ZSystem.Model.t_Operation)GetModelCache(key);
         }
         else
         {
             model = dal.GetModel(KeyID);
             TryAddModelCache(key, model, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
         }
     }
     return(model);
 }
        /// <summary>
        /// 为更新一条数据准备参数
        /// </summary>
        internal static void PrepareUpdateCommand(ZSystem.Model.t_Operation model, out StringBuilder strSql, out DbParameter[] cmdParms)
        {
            strSql = new StringBuilder();
            strSql.Append("UPDATE t_Operation SET ");
            strSql.Append("ClientID=@in_ClientID,");
            strSql.Append("iStatus=@in_iStatus,");
            strSql.Append("iTotalPrice=@in_iTotalPrice,");
            strSql.Append("CreateUser=@in_CreateUser,");
            strSql.Append("IsEnable=@in_IsEnable,");
            strSql.Append("LastUpdate=@in_LastUpdate,");
            strSql.Append("Memo=@in_Memo");
            strSql.Append(" WHERE KeyID=@in_KeyID");

            cmdParms = new DbParameter[] {
                dbHelper.CreateInDbParameter("@in_ClientID", DbType.String, model.ClientID),
                dbHelper.CreateInDbParameter("@in_iStatus", DbType.Int32, model.iStatus),
                dbHelper.CreateInDbParameter("@in_iTotalPrice", DbType.Double, model.iTotalPrice),
                dbHelper.CreateInDbParameter("@in_CreateUser", DbType.String, model.CreateUser),
                dbHelper.CreateInDbParameter("@in_Memo", DbType.String, model.Memo),
                dbHelper.CreateInDbParameter("@in_KeyID", DbType.String, model.KeyID),
                dbHelper.CreateInDbParameter("@in_IsEnable", DbType.Boolean, model.IsEnable),
                dbHelper.CreateInDbParameter("@in_LastUpdate", DbType.String, model.LastUpdate)
            };
        }
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private ZSystem.Model.t_Operation GetModel(DbDataReader dr)
 {
     ZSystem.Model.t_Operation model = new ZSystem.Model.t_Operation();
     PrepareModel(model, dr);
     return model;
 }
Beispiel #9
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private ZSystem.Model.t_Operation GetModel(DbDataReader dr)
 {
     ZSystem.Model.t_Operation model = new ZSystem.Model.t_Operation();
     PrepareModel(model, dr);
     return(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(ZSystem.Model.t_Operation model)
 {
     dal.Add(model);
 }