Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(E_Model.Tag model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CMS_TAG set ");
            strSql.Append("TAGNAEM=@TAGNAEM,");
            strSql.Append("TAGTYPE=@TAGTYPE,");
            strSql.Append("BROCKID=@BROCKID,");
            strSql.Append("DESCRIPTION=@DESCRIPTION");
            strSql.Append(" where ID=@ID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "TAGNAEM", DbType.AnsiString, model.TAGNAEM);
            db.AddInParameter(dbCommand, "TAGTYPE", DbType.AnsiString, model.TAGTYPE);
            db.AddInParameter(dbCommand, "BROCKID", DbType.AnsiString, model.BROCKID);
            db.AddInParameter(dbCommand, "DESCRIPTION", DbType.AnsiString, model.DESCRIPTION);
            db.AddInParameter(dbCommand, "ID", DbType.AnsiString, model.ID);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(E_Model.Tag model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CMS_TAG(");
            strSql.Append("ID,TAGNAEM,TAGTYPE,BROCKID,STATUS,DESCRIPTION,CREATEDATE,CREATEUSER)");

            strSql.Append(" values (");
            strSql.Append("@ID,@TAGNAEM,@TAGTYPE,@BROCKID,@STATUS,@DESCRIPTION,@CREATEDATE,@CREATEUSER)");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ID", DbType.AnsiString, model.ID);
            db.AddInParameter(dbCommand, "TAGNAEM", DbType.AnsiString, model.TAGNAEM);
            db.AddInParameter(dbCommand, "TAGTYPE", DbType.AnsiString, model.TAGTYPE);
            db.AddInParameter(dbCommand, "BROCKID", DbType.AnsiString, model.BROCKID);
            db.AddInParameter(dbCommand, "STATUS", DbType.AnsiString, model.STATUS);
            db.AddInParameter(dbCommand, "DESCRIPTION", DbType.AnsiString, model.DESCRIPTION);
            db.AddInParameter(dbCommand, "CREATEDATE", DbType.DateTime, model.CREATEDATE);
            db.AddInParameter(dbCommand, "CREATEUSER", DbType.AnsiString, model.CREATEUSER);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public E_Model.Tag ReaderBind(IDataReader dataReader)
        {
            E_Model.Tag model = new E_Model.Tag();
            object      ojb;

            model.ID          = dataReader["ID"].ToString();
            model.TAGNAEM     = dataReader["TAGNAEM"].ToString();
            model.TAGTYPE     = dataReader["TAGTYPE"].ToString();
            model.BROCKID     = dataReader["BROCKID"].ToString();
            model.STATUS      = dataReader["STATUS"].ToString();
            model.DESCRIPTION = dataReader["DESCRIPTION"].ToString();
            ojb = dataReader["CREATEDATE"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CREATEDATE = (DateTime)ojb;
            }
            model.CREATEUSER = dataReader["CREATEUSER"].ToString();
            return(model);
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public E_Model.Tag GetModel(string ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,TAGNAEM,TAGTYPE,BROCKID,STATUS,DESCRIPTION,CREATEDATE,CREATEUSER from CMS_TAG ");
            strSql.Append(" where ID=@ID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ID", DbType.AnsiString, ID);
            E_Model.Tag model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
Exemple #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public E_Model.Tag DataRowToModel(DataRow row)
 {
     E_Model.Tag model = new E_Model.Tag();
     if (row != null)
     {
         if (row["ID"] != null)
         {
             model.ID = row["ID"].ToString();
         }
         if (row["TAGNAEM"] != null)
         {
             model.TAGNAEM = row["TAGNAEM"].ToString();
         }
         if (row["TAGTYPE"] != null)
         {
             model.TAGTYPE = row["TAGTYPE"].ToString();
         }
         if (row["BROCKID"] != null)
         {
             model.BROCKID = row["BROCKID"].ToString();
         }
         if (row["STATUS"] != null)
         {
             model.STATUS = row["STATUS"].ToString();
         }
         if (row["DESCRIPTION"] != null)
         {
             model.DESCRIPTION = row["DESCRIPTION"].ToString();
         }
         if (row["CREATEDATE"] != null && row["CREATEDATE"].ToString() != "")
         {
             model.CREATEDATE = DateTime.Parse(row["CREATEDATE"].ToString());
         }
         if (row["CREATEUSER"] != null)
         {
             model.CREATEUSER = row["CREATEUSER"].ToString();
         }
     }
     return(model);
 }
Exemple #6
0
 public bool Update(E_Model.Tag model)
 {
     return(dal.Update(model));
 }
Exemple #7
0
 public bool Add(E_Model.Tag model)
 {
     return(dal.Add(model));
 }