示例#1
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public ECommerce.CM.Model.CMArea ReaderBind(IDataReader dataReader)
        {
            ECommerce.CM.Model.CMArea model = new ECommerce.CM.Model.CMArea();
            object ojb;

            ojb = dataReader["AId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.AId = Convert.ToInt32(ojb);
            }
            model.AreaId = dataReader["AreaId"].ToString();
            return(model);
        }
示例#2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECommerce.CM.Model.CMArea DataRowToModel(DataRow row)
 {
     ECommerce.CM.Model.CMArea model = new ECommerce.CM.Model.CMArea();
     if (row != null)
     {
         if (row["AId"] != null && row["AId"].ToString() != "")
         {
             model.AId = Convert.ToInt32(row["AId"].ToString());
         }
         if (row["AreaId"] != null)
         {
             model.AreaId = row["AreaId"].ToString();
         }
     }
     return model;
 }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECommerce.CM.Model.CMArea DataRowToModel(DataRow row)
 {
     ECommerce.CM.Model.CMArea model = new ECommerce.CM.Model.CMArea();
     if (row != null)
     {
         if (row["AId"] != null && row["AId"].ToString() != "")
         {
             model.AId = Convert.ToInt32(row["AId"].ToString());
         }
         if (row["AreaId"] != null)
         {
             model.AreaId = row["AreaId"].ToString();
         }
     }
     return(model);
 }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ECommerce.CM.Model.CMArea GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select AId,AreaId from CMArea ");
            strSql.Append(" where ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            ECommerce.CM.Model.CMArea model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
示例#5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ECommerce.CM.Model.CMArea model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CMArea(");
            strSql.Append("AId,AreaId)");

            strSql.Append(" values (");
            strSql.Append("@AId,@AreaId)");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "AId", DbType.Int32, model.AId);
            db.AddInParameter(dbCommand, "AreaId", DbType.AnsiString, model.AreaId);
            int result = db.ExecuteNonQuery(dbCommand);

            if (result > 0)
            {
                return(true);
            }
            return(false);
        }
示例#6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ECommerce.CM.Model.CMArea model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CMArea set ");
            strSql.Append("AId=@AId,");
            strSql.Append("AreaId=@AreaId");
            strSql.Append(" where ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "AId", DbType.Int32, model.AId);
            db.AddInParameter(dbCommand, "AreaId", DbType.AnsiString, model.AreaId);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#7
0
 /// <summary>
 /// 对象实体绑定数据
 /// </summary>
 public ECommerce.CM.Model.CMArea ReaderBind(IDataReader dataReader)
 {
     ECommerce.CM.Model.CMArea model = new ECommerce.CM.Model.CMArea();
     object ojb;
     ojb = dataReader["AId"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.AId = Convert.ToInt32(ojb);
     }
     model.AreaId = dataReader["AreaId"].ToString();
     return model;
 }