Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(E_Model.PropertyValue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CMS_PROPERTY_VALUE(");
            strSql.Append("ID,TAGID,PROPERTYID,PROPERTYVALUE)");

            strSql.Append(" values (");
            strSql.Append("@ID,@TAGID,@PROPERTYID,@PROPERTYVALUE)");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ID", DbType.AnsiString, model.ID);
            db.AddInParameter(dbCommand, "TAGID", DbType.AnsiString, model.TAGID);
            db.AddInParameter(dbCommand, "PROPERTYID", DbType.AnsiString, model.PROPERTYID);
            db.AddInParameter(dbCommand, "PROPERTYVALUE", DbType.AnsiString, model.PROPERTYVALUE);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 对象实体绑定数据
 /// </summary>
 public E_Model.PropertyValue ReaderBind(IDataReader dataReader)
 {
     E_Model.PropertyValue model = new E_Model.PropertyValue();
     model.ID            = dataReader["ID"].ToString();
     model.TAGID         = dataReader["TAGID"].ToString();
     model.PROPERTYID    = dataReader["PROPERTYID"].ToString();
     model.PROPERTYVALUE = dataReader["PROPERTYVALUE"].ToString();
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public E_Model.PropertyValue GetModel(string ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,TAGID,PROPERTYID,PROPERTYVALUE from CMS_PROPERTY_VALUE ");
            strSql.Append(" where ID=@ID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ID", DbType.AnsiString, ID);
            E_Model.PropertyValue model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(E_Model.PropertyValue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CMS_PROPERTY_VALUE set ");
            strSql.Append("PROPERTYVALUE=@PROPERTYVALUE");
            strSql.Append(" where ID=@ID ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "PROPERTYVALUE", DbType.AnsiString, model.PROPERTYVALUE);
            db.AddInParameter(dbCommand, "ID", DbType.AnsiString, model.ID);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public E_Model.PropertyValue DataRowToModel(DataRow row)
 {
     E_Model.PropertyValue model = new E_Model.PropertyValue();
     if (row != null)
     {
         if (row["ID"] != null)
         {
             model.ID = row["ID"].ToString();
         }
         if (row["TAGID"] != null)
         {
             model.TAGID = row["TAGID"].ToString();
         }
         if (row["PROPERTYID"] != null)
         {
             model.PROPERTYID = row["PROPERTYID"].ToString();
         }
         if (row["PROPERTYVALUE"] != null)
         {
             model.PROPERTYVALUE = row["PROPERTYVALUE"].ToString();
         }
     }
     return(model);
 }
Esempio n. 6
0
 public bool Update(E_Model.PropertyValue model)
 {
     return(dal.Update(model));
 }
Esempio n. 7
0
 public bool Add(E_Model.PropertyValue model)
 {
     return(dal.Add(model));
 }