Exemplo n.º 1
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 internal static void PrepareModel(ZSystem.Model.t_SysUserState model, DbDataReader dr)
 {
     model.KeyID    = GetString(dr["KeyID"]);
     model.UserID   = GetString(dr["UserID"]);
     model.iState   = GetInt(dr["iState"]);
     model.LastDate = GetDateTime(dr["LastDate"]);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(ZSystem.Model.t_SysUserState model)
        {
            StringBuilder sbSql4t_SysUserState;

            DbParameter[] parms4t_SysUserState;
            PrepareUpdateCommand(model, out sbSql4t_SysUserState, out parms4t_SysUserState);
            return(dbHelper.ExecuteNonQuery(CommandType.Text, sbSql4t_SysUserState.ToString(), parms4t_SysUserState));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ZSystem.Model.t_SysUserState model)
        {
            int count = dal.Update(model);

            if (EnableCache && count > 0)
            {
                RemoveModelCache(model.KeyID);
            }
        }
Exemplo n.º 4
0
        public override bool Equals(object obj)
        {
            ZSystem.Model.t_SysUserState model = obj as ZSystem.Model.t_SysUserState;
            if (model != null && model.KeyID == this.KeyID)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 为新增一条数据准备参数
        /// </summary>
        internal static void PrepareAddCommand(ZSystem.Model.t_SysUserState model, out StringBuilder sbSql4t_SysUserState, out DbParameter[] parms4t_SysUserState)
        {
            sbSql4t_SysUserState = new StringBuilder();
            sbSql4t_SysUserState.Append("INSERT INTO t_SysUserState(");
            sbSql4t_SysUserState.Append("KeyID, UserID, iState, LastDate)");
            sbSql4t_SysUserState.Append(" VALUES (");
            sbSql4t_SysUserState.Append("@in_KeyID, @in_UserID, @in_iState, @in_LastDate)");

            parms4t_SysUserState = new DbParameter[] {
                dbHelper.CreateInDbParameter("@in_KeyID", DbType.String, model.KeyID),
                dbHelper.CreateInDbParameter("@in_UserID", DbType.String, model.UserID),
                dbHelper.CreateInDbParameter("@in_iState", DbType.Int32, model.iState),
                dbHelper.CreateInDbParameter("@in_LastDate", DbType.DateTime, model.LastDate)
            };
        }
Exemplo n.º 6
0
        /// <summary>
        /// 为更新一条数据准备参数
        /// </summary>
        internal static void PrepareUpdateCommand(ZSystem.Model.t_SysUserState model, out StringBuilder sbSql4t_SysUserState, out DbParameter[] parms4t_SysUserState)
        {
            sbSql4t_SysUserState = new StringBuilder();
            sbSql4t_SysUserState.Append("UPDATE t_SysUserState SET ");
            sbSql4t_SysUserState.Append("UserID=@in_UserID,");
            sbSql4t_SysUserState.Append("iState=@in_iState,");
            sbSql4t_SysUserState.Append("LastDate=@in_LastDate");
            sbSql4t_SysUserState.Append(" WHERE KeyID=@in_KeyID");

            parms4t_SysUserState = new DbParameter[] {
                dbHelper.CreateInDbParameter("@in_UserID", DbType.String, model.UserID),
                dbHelper.CreateInDbParameter("@in_iState", DbType.Int32, model.iState),
                dbHelper.CreateInDbParameter("@in_LastDate", DbType.DateTime, model.LastDate),
                dbHelper.CreateInDbParameter("@in_KeyID", DbType.String, model.KeyID)
            };
        }
Exemplo n.º 7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ZSystem.Model.t_SysUserState GetModel(string UserID)
 {
     ZSystem.Model.t_SysUserState model = null;
     if (!EnableCache)
     {
         model = dal.GetModel(UserID);
     }
     else
     {
         string key = UserID.ToString();
         if (GetModelCache(key) != null)
         {
             model = (ZSystem.Model.t_SysUserState)GetModelCache(key);
         }
         else
         {
             model = dal.GetModel(UserID);
             TryAddModelCache(key, model, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
         }
     }
     return(model);
 }
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private ZSystem.Model.t_SysUserState GetModel(DbDataReader dr)
 {
     ZSystem.Model.t_SysUserState model = new ZSystem.Model.t_SysUserState();
     PrepareModel(model, dr);
     return model;
 }
Exemplo n.º 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(ZSystem.Model.t_SysUserState model)
 {
     dal.Add(model);
 }
Exemplo n.º 10
0
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private ZSystem.Model.t_SysUserState GetModel(DbDataReader dr)
 {
     ZSystem.Model.t_SysUserState model = new ZSystem.Model.t_SysUserState();
     PrepareModel(model, dr);
     return(model);
 }