Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MarketModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_Base_Market(");
            strSql.Append("Market_id,Market_name,Area_id,Map_x,Map_y,orderby)");
            strSql.Append(" values (");
            strSql.Append("@Market_id,@Market_name,@Area_id,@Map_x,@Map_y,@orderby)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Market_id",   SqlDbType.VarChar,  50),
                new SqlParameter("@Market_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)
            };
            parameters[0].Value = model.Market_id;
            parameters[1].Value = model.Market_name;
            parameters[2].Value = model.Area_id;
            parameters[3].Value = model.Map_x;
            parameters[4].Value = model.Map_y;
            parameters[5].Value = model.orderby;

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

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

            if (row != null)
            {
                if (row["Market_id"] != null)
                {
                    model.Market_id = row["Market_id"].ToString();
                }
                if (row["Market_name"] != null)
                {
                    model.Market_name = row["Market_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());
                }
            }
            return(model);
        }
Example #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MarketModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Base_Market set ");
            strSql.Append("Market_id=@Market_id,");
            strSql.Append("Market_name=@Market_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(" where Market_id=@Market_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Market_id",   SqlDbType.VarChar,  50),
                new SqlParameter("@Market_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)
            };
            parameters[0].Value = model.Market_id;
            parameters[1].Value = model.Market_name;
            parameters[2].Value = model.Area_id;
            parameters[3].Value = model.Map_x;
            parameters[4].Value = model.Map_y;
            parameters[5].Value = model.orderby;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MarketModel GetModel(string Market_id)
        {
            StringBuilder strSql = new StringBuilder();

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

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

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