Exemple #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ECommerce.Area.Model.LandAttributeValue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into LandAttributeValue(");
            strSql.Append("LId,LAId,EmplId,LAValue,Addtime)");

            strSql.Append(" values (");
            strSql.Append("@LId,@LAId,@EmplId,@LAValue,@Addtime)");
            strSql.Append(";select @@IDENTITY");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "LId", DbType.Int32, model.LId);
            db.AddInParameter(dbCommand, "LAId", DbType.Int32, model.LAId);
            db.AddInParameter(dbCommand, "EmplId", DbType.Int32, model.EmplId);
            db.AddInParameter(dbCommand, "LAValue", DbType.String, model.LAValue);
            db.AddInParameter(dbCommand, "Addtime", DbType.DateTime, model.Addtime);
            int    result;
            object obj = db.ExecuteScalar(dbCommand);

            if (!int.TryParse(obj.ToString(), out result))
            {
                return(0);
            }
            return(result);
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECommerce.Area.Model.LandAttributeValue DataRowToModel(DataRow row)
 {
     ECommerce.Area.Model.LandAttributeValue model = new ECommerce.Area.Model.LandAttributeValue();
     if (row != null)
     {
         if (row["LAVId"] != null && row["LAVId"].ToString() != "")
         {
             model.LAVId = Convert.ToInt32(row["LAVId"].ToString());
         }
         if (row["LId"] != null && row["LId"].ToString() != "")
         {
             model.LId = Convert.ToInt32(row["LId"].ToString());
         }
         if (row["LAId"] != null && row["LAId"].ToString() != "")
         {
             model.LAId = Convert.ToInt32(row["LAId"].ToString());
         }
         if (row["EmplId"] != null && row["EmplId"].ToString() != "")
         {
             model.EmplId = Convert.ToInt32(row["EmplId"].ToString());
         }
         if (row["LAValue"] != null)
         {
             model.LAValue = row["LAValue"].ToString();
         }
         if (row["Addtime"] != null && row["Addtime"].ToString() != "")
         {
             model.Addtime = Convert.ToDateTime(row["Addtime"].ToString());
         }
     }
     return model;
 }
Exemple #3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public ECommerce.Area.Model.LandAttributeValue ReaderBind(IDataReader dataReader)
        {
            ECommerce.Area.Model.LandAttributeValue model = new ECommerce.Area.Model.LandAttributeValue();
            object ojb;

            ojb = dataReader["LAVId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LAVId = Convert.ToInt32(ojb);
            }
            ojb = dataReader["LId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LId = Convert.ToInt32(ojb);
            }
            ojb = dataReader["LAId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LAId = Convert.ToInt32(ojb);
            }
            ojb = dataReader["EmplId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmplId = Convert.ToInt32(ojb);
            }
            model.LAValue = dataReader["LAValue"].ToString();
            ojb           = dataReader["Addtime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Addtime = Convert.ToDateTime(ojb);
            }
            return(model);
        }
Exemple #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ECommerce.Area.Model.LandAttributeValue DataRowToModel(DataRow row)
 {
     ECommerce.Area.Model.LandAttributeValue model = new ECommerce.Area.Model.LandAttributeValue();
     if (row != null)
     {
         if (row["LAVId"] != null && row["LAVId"].ToString() != "")
         {
             model.LAVId = Convert.ToInt32(row["LAVId"].ToString());
         }
         if (row["LId"] != null && row["LId"].ToString() != "")
         {
             model.LId = Convert.ToInt32(row["LId"].ToString());
         }
         if (row["LAId"] != null && row["LAId"].ToString() != "")
         {
             model.LAId = Convert.ToInt32(row["LAId"].ToString());
         }
         if (row["EmplId"] != null && row["EmplId"].ToString() != "")
         {
             model.EmplId = Convert.ToInt32(row["EmplId"].ToString());
         }
         if (row["LAValue"] != null)
         {
             model.LAValue = row["LAValue"].ToString();
         }
         if (row["Addtime"] != null && row["Addtime"].ToString() != "")
         {
             model.Addtime = Convert.ToDateTime(row["Addtime"].ToString());
         }
     }
     return(model);
 }
Exemple #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ECommerce.Area.Model.LandAttributeValue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update LandAttributeValue set ");
            strSql.Append("LId=@LId,");
            strSql.Append("LAId=@LAId,");
            strSql.Append("EmplId=@EmplId,");
            strSql.Append("LAValue=@LAValue,");
            strSql.Append("Addtime=@Addtime");
            strSql.Append(" where LAVId=@LAVId ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "LAVId", DbType.Int32, model.LAVId);
            db.AddInParameter(dbCommand, "LId", DbType.Int32, model.LId);
            db.AddInParameter(dbCommand, "LAId", DbType.Int32, model.LAId);
            db.AddInParameter(dbCommand, "EmplId", DbType.Int32, model.EmplId);
            db.AddInParameter(dbCommand, "LAValue", DbType.String, model.LAValue);
            db.AddInParameter(dbCommand, "Addtime", DbType.DateTime, model.Addtime);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ECommerce.Area.Model.LandAttributeValue GetModel(int LAVId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select LAVId,LId,LAId,EmplId,LAValue,Addtime from LandAttributeValue ");
            strSql.Append(" where LAVId=@LAVId ");
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "LAVId", DbType.Int32, LAVId);
            ECommerce.Area.Model.LandAttributeValue model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
            }
            return(model);
        }
 /// <summary>
 /// 对象实体绑定数据
 /// </summary>
 public ECommerce.Area.Model.LandAttributeValue ReaderBind(IDataReader dataReader)
 {
     ECommerce.Area.Model.LandAttributeValue model = new ECommerce.Area.Model.LandAttributeValue();
     object ojb;
     ojb = dataReader["LAVId"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.LAVId = Convert.ToInt32(ojb);
     }
     ojb = dataReader["LId"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.LId = Convert.ToInt32(ojb);
     }
     ojb = dataReader["LAId"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.LAId = Convert.ToInt32(ojb);
     }
     ojb = dataReader["EmplId"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.EmplId = Convert.ToInt32(ojb);
     }
     model.LAValue = dataReader["LAValue"].ToString();
     ojb = dataReader["Addtime"];
     if (ojb != null && ojb != DBNull.Value)
     {
         model.Addtime = Convert.ToDateTime(ojb);
     }
     return model;
 }