/// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(ZSystem.Model.t_ChannelStateDynamic model)
        {
            StringBuilder strSql;

            DbParameter[] cmdParms;
            PrepareUpdateCommand(model, out strSql, out cmdParms);
            return(dbHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms));
        }
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 internal static void PrepareModel(ZSystem.Model.t_ChannelStateDynamic model, DbDataReader dr)
 {
     model.iChID       = GetInt(dr["iChID"]);
     model.sChState    = GetString(dr["sChState"]);
     model.iChType     = GetInt(dr["iChType"]);
     model.sCaller     = GetString(dr["sCaller"]);
     model.sDTMF       = GetString(dr["sDTMF"]);
     model.iTimeElapse = GetInt(dr["iTimeElapse"]);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ZSystem.Model.t_ChannelStateDynamic model)
        {
            int count = dal.Update(model);

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

            return(false);
        }
        /// <summary>
        /// 为新增一条数据准备参数
        /// </summary>
        internal static void PrepareAddCommand(ZSystem.Model.t_ChannelStateDynamic model, out StringBuilder strSql, out DbParameter[] cmdParms)
        {
            strSql = new StringBuilder();
            strSql.Append("INSERT INTO t_ChannelStateDynamic(");
            strSql.Append("iChID, sChState, iChType, sCaller, sDTMF, iTimeElapse)");
            strSql.Append(" VALUES (");
            strSql.Append("@in_iChID, @in_sChState, @in_iChType, @in_sCaller, @in_sDTMF, @in_iTimeElapse)");

            cmdParms = new DbParameter[] {
                dbHelper.CreateInDbParameter("@in_iChID", DbType.Int32, model.iChID),
                dbHelper.CreateInDbParameter("@in_sChState", DbType.String, model.sChState),
                dbHelper.CreateInDbParameter("@in_iChType", DbType.Int32, model.iChType),
                dbHelper.CreateInDbParameter("@in_sCaller", DbType.String, model.sCaller),
                dbHelper.CreateInDbParameter("@in_sDTMF", DbType.String, model.sDTMF),
                dbHelper.CreateInDbParameter("@in_iTimeElapse", DbType.Int32, model.iTimeElapse)
            };
        }
        /// <summary>
        /// 为更新一条数据准备参数
        /// </summary>
        internal static void PrepareUpdateCommand(ZSystem.Model.t_ChannelStateDynamic model, out StringBuilder strSql, out DbParameter[] cmdParms)
        {
            strSql = new StringBuilder();
            strSql.Append("UPDATE t_ChannelStateDynamic SET ");
            strSql.Append("sChState=@in_sChState,");
            strSql.Append("iChType=@in_iChType,");
            strSql.Append("sCaller=@in_sCaller,");
            strSql.Append("sDTMF=@in_sDTMF,");
            strSql.Append("iTimeElapse=@in_iTimeElapse");
            strSql.Append(" WHERE iChID=@in_iChID");

            cmdParms = new DbParameter[] {
                dbHelper.CreateInDbParameter("@in_sChState", DbType.String, model.sChState),
                dbHelper.CreateInDbParameter("@in_iChType", DbType.Int32, model.iChType),
                dbHelper.CreateInDbParameter("@in_sCaller", DbType.String, model.sCaller),
                dbHelper.CreateInDbParameter("@in_sDTMF", DbType.String, model.sDTMF),
                dbHelper.CreateInDbParameter("@in_iTimeElapse", DbType.Int32, model.iTimeElapse),
                dbHelper.CreateInDbParameter("@in_iChID", DbType.Int32, model.iChID)
            };
        }
Exemplo n.º 7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ZSystem.Model.t_ChannelStateDynamic GetModel(int?iChID)
 {
     ZSystem.Model.t_ChannelStateDynamic model = null;
     if (!EnableCache)
     {
         model = dal.GetModel(iChID);
     }
     else
     {
         string key = iChID.ToString();
         if (GetModelCache(key) != null)
         {
             model = (ZSystem.Model.t_ChannelStateDynamic)GetModelCache(key);
         }
         else
         {
             model = dal.GetModel(iChID);
             TryAddModelCache(key, model, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
         }
     }
     return(model);
 }
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private ZSystem.Model.t_ChannelStateDynamic GetModel(DbDataReader dr)
 {
     ZSystem.Model.t_ChannelStateDynamic model = new ZSystem.Model.t_ChannelStateDynamic();
     PrepareModel(model, dr);
     return(model);
 }
Exemplo n.º 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(ZSystem.Model.t_ChannelStateDynamic model)
 {
     dal.Add(model);
 }
 /// <summary>
 /// 由一行数据得到一个实体
 /// </summary>
 private ZSystem.Model.t_ChannelStateDynamic GetModel(DbDataReader dr)
 {
     ZSystem.Model.t_ChannelStateDynamic model = new ZSystem.Model.t_ChannelStateDynamic();
     PrepareModel(model, dr);
     return model;
 }