示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BuildingModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Base_Building set ");
            strSql.Append("Building_id=@Building_id,");
            strSql.Append("Building_name=@Building_name,");
            strSql.Append("Area_id=@Area_id,");
            strSql.Append("Map_x=@Map_x,");
            strSql.Append("Map_y=@Map_y,");
            strSql.Append("orderby=@orderby,");
            strSql.Append("AddressDetail=@AddressDetail");
            strSql.Append(" where Building_id=@Building_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Building_id",   SqlDbType.VarChar,  50),
                new SqlParameter("@Building_name", SqlDbType.VarChar, 200),
                new SqlParameter("@Area_id",       SqlDbType.VarChar,  50),
                new SqlParameter("@Map_x",         SqlDbType.VarChar, 100),
                new SqlParameter("@Map_y",         SqlDbType.VarChar, 100),
                new SqlParameter("@orderby",       SqlDbType.Int,       4),
                new SqlParameter("@AddressDetail", SqlDbType.VarChar, 500)
            };
            parameters[0].Value = model.Building_id;
            parameters[1].Value = model.Building_name;
            parameters[2].Value = model.Area_id;
            parameters[3].Value = model.Map_x;
            parameters[4].Value = model.Map_y;
            parameters[5].Value = model.orderby;
            parameters[6].Value = model.AddressDetail;

            int rows = adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters);

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

            strSql.Append("insert into T_Base_Building(");
            strSql.Append("Building_id,Building_name,Area_id,Map_x,Map_y,orderby,AddressDetail)");
            strSql.Append(" values (");
            strSql.Append("@Building_id,@Building_name,@Area_id,@Map_x,@Map_y,@orderby,@AddressDetail)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Building_id",   SqlDbType.VarChar,  50),
                new SqlParameter("@Building_name", SqlDbType.VarChar, 200),
                new SqlParameter("@Area_id",       SqlDbType.VarChar,  50),
                new SqlParameter("@Map_x",         SqlDbType.VarChar, 100),
                new SqlParameter("@Map_y",         SqlDbType.VarChar, 100),
                new SqlParameter("@orderby",       SqlDbType.Int,       4),
                new SqlParameter("@AddressDetail", SqlDbType.VarChar, 500)
            };
            parameters[0].Value = model.Building_id;
            parameters[1].Value = model.Building_name;
            parameters[2].Value = model.Area_id;
            parameters[3].Value = model.Map_x;
            parameters[4].Value = model.Map_y;
            parameters[5].Value = model.orderby;
            parameters[6].Value = model.AddressDetail;

            int rows = adoHelper.ExecuteSqlNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BuildingModel DataRowToModel(DataRow row)
        {
            BuildingModel model = new BuildingModel();

            if (row != null)
            {
                if (row["Building_id"] != null)
                {
                    model.Building_id = row["Building_id"].ToString();
                }
                if (row["Building_name"] != null)
                {
                    model.Building_name = row["Building_name"].ToString();
                }
                if (row["Area_id"] != null)
                {
                    model.Area_id = row["Area_id"].ToString();
                }
                if (row["Map_x"] != null)
                {
                    model.Map_x = row["Map_x"].ToString();
                }
                if (row["Map_y"] != null)
                {
                    model.Map_y = row["Map_y"].ToString();
                }
                if (row["orderby"] != null && row["orderby"].ToString() != "")
                {
                    model.orderby = int.Parse(row["orderby"].ToString());
                }
                if (row["AddressDetail"] != null)
                {
                    model.AddressDetail = row["AddressDetail"].ToString();
                }
            }
            return(model);
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BuildingModel GetModel(string Building_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Building_id,Building_name,Area_id,Map_x,Map_y,orderby,AddressDetail from T_Base_Building ");
            strSql.Append(" where Building_id=@Building_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Building_id", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = Building_id;

            BuildingModel model = new BuildingModel();
            DataSet       ds    = adoHelper.ExecuteSqlDataset(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BuildingModel model)
 {
     return(dal.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(BuildingModel model)
 {
     return(dal.Add(model));
 }