public bool AddDict(NoticeContentEntity dictEntity)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" @DicID");
            sqlCommandText.Append(", @DicKey");
            sqlCommandText.Append(", @Content");
            sqlCommandText.Append(", @AddTime");
            sqlCommandText.Append(", @UpdateTime");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.NoticeContent ({0}) VALUES ({1})", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@DicID", DbType.Int64, dictEntity.DicID);
            db.AddInParameter(cmd, "@DicKey", DbType.String, dictEntity.DicKey);
            db.AddInParameter(cmd, "@Content", DbType.AnsiString, dictEntity.Content);
            db.AddInParameter(cmd, "@AddTime", DbType.DateTime, dictEntity.AddTime);
            db.AddInParameter(cmd, "@UpdateTime", DbType.DateTime, dictEntity.UpdateTime);
            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Exemplo n.º 2
0
 public bool UpdateDict(NoticeContentEntity dictEntity)
 {
     return NoticeContentDataAccess.Instance.UpdateDict(dictEntity);
 }
Exemplo n.º 3
0
 public bool UpdateDict(NoticeContentEntity dictEntity)
 {
     return NoticeContentBusProvider.UpdateDict(dictEntity);
 }
Exemplo n.º 4
0
 public bool AddDict(NoticeContentEntity dictEntity)
 {
     return NoticeContentBusProvider.AddDict(dictEntity);
 }
        public bool UpdateDict(NoticeContentEntity dictEntity)
        {
            bool flag = false;
            StringBuilder whereCommandText = new StringBuilder();
            whereCommandText.Append("  DicKey=@DicKey");
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" Content=@Content");
            sqlCommandText.Append(", UpdateTime=getdate()");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.NoticeContent SET {0} WHERE  {1}", sqlCommandText.ToString(), whereCommandText.ToString()));

            db.AddInParameter(cmd, "@DicKey", DbType.Int64, dictEntity.DicKey);
            db.AddInParameter(cmd, "@Content", DbType.AnsiString, dictEntity.Content);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
 public List<NoticeContentEntity> MakeDictList(IDataReader dr)
 {
     List<NoticeContentEntity> list = new List<NoticeContentEntity>();
     while (dr.Read())
     {
         NoticeContentEntity dictEntity = new NoticeContentEntity();
         dictEntity.DicID = Convert.ToInt32(dr["DicID"]);
         dictEntity.DicKey = (string)dr["DicKey"];
         dictEntity.Content = Convert.ToString(dr["Content"]);
         dictEntity.AddTime = (DateTime)dr["AddTime"];
         dictEntity.UpdateTime = (DateTime)dr["UpdateTime"];
         list.Add(dictEntity);
     }
     dr.Close();
     return list;
 }
 public NoticeContentEntity MakeDict(DataRow dr)
 {
     NoticeContentEntity dictEntity = null;
     if (dr != null)
     {
         dictEntity = new NoticeContentEntity();
         dictEntity.DicID = Convert.ToInt32(dr["DicID"]);
         dictEntity.DicKey = (string)dr["DicKey"];
         dictEntity.Content = Convert.ToString(dr["Content"]);
         dictEntity.AddTime = (DateTime)dr["AddTime"];
         dictEntity.UpdateTime = (DateTime)dr["UpdateTime"];
     }
     return dictEntity;
 }