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

            strSql.Append("update T_Base_BuildingToMarket set ");
            strSql.Append("BuildingToMarket_id=@BuildingToMarket_id,");
            strSql.Append("Building_id=@Building_id,");
            strSql.Append("Market_id=@Market_id,");
            strSql.Append("orderby=@orderby,");
            strSql.Append("MinPrice=@MinPrice,");
            strSql.Append("MaxPrice=@MaxPrice,");
            strSql.Append("Price=@Price,");
            strSql.Append("Distance=@Distance");
            strSql.Append(" where BuildingToMarket_id=@BuildingToMarket_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuildingToMarket_id", SqlDbType.VarChar, 50),
                new SqlParameter("@Building_id",         SqlDbType.VarChar, 50),
                new SqlParameter("@Market_id",           SqlDbType.VarChar, 50),
                new SqlParameter("@orderby",             SqlDbType.Int,      4),
                new SqlParameter("@MinPrice",            SqlDbType.Decimal,  9),
                new SqlParameter("@MaxPrice",            SqlDbType.Decimal,  9),
                new SqlParameter("@Price",               SqlDbType.Decimal,  9),
                new SqlParameter("@Distance",            SqlDbType.Int, 4)
            };
            parameters[0].Value = model.BuildingToMarket_id;
            parameters[1].Value = model.Building_id;
            parameters[2].Value = model.Market_id;
            parameters[3].Value = model.orderby;
            parameters[4].Value = model.MinPrice;
            parameters[5].Value = model.MaxPrice;
            parameters[6].Value = model.Price;
            parameters[7].Value = model.Distance;

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

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

            if (row != null)
            {
                if (row["BuildingToMarket_id"] != null)
                {
                    model.BuildingToMarket_id = row["BuildingToMarket_id"].ToString();
                }
                if (row["Building_id"] != null)
                {
                    model.Building_id = row["Building_id"].ToString();
                }
                if (row["Market_id"] != null)
                {
                    model.Market_id = row["Market_id"].ToString();
                }
                if (row["orderby"] != null && row["orderby"].ToString() != "")
                {
                    model.orderby = int.Parse(row["orderby"].ToString());
                }
                if (row["MinPrice"] != null && row["MinPrice"].ToString() != "")
                {
                    model.MinPrice = decimal.Parse(row["MinPrice"].ToString());
                }
                if (row["MaxPrice"] != null && row["MaxPrice"].ToString() != "")
                {
                    model.MaxPrice = decimal.Parse(row["MaxPrice"].ToString());
                }
                if (row["Price"] != null && row["Price"].ToString() != "")
                {
                    model.Price = decimal.Parse(row["Price"].ToString());
                }
                if (row["Distance"] != null && row["Distance"].ToString() != "")
                {
                    model.Distance = int.Parse(row["Distance"].ToString());
                }
            }
            return(model);
        }
예제 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(BuildingToMarketModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_Base_BuildingToMarket(");
            strSql.Append("BuildingToMarket_id,Building_id,Market_id,orderby,MinPrice,MaxPrice,Price,Distance)");
            strSql.Append(" values (");
            strSql.Append("@BuildingToMarket_id,@Building_id,@Market_id,@orderby,@MinPrice,@MaxPrice,@Price,@Distance)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuildingToMarket_id", SqlDbType.VarChar, 50),
                new SqlParameter("@Building_id",         SqlDbType.VarChar, 50),
                new SqlParameter("@Market_id",           SqlDbType.VarChar, 50),
                new SqlParameter("@orderby",             SqlDbType.Int,      4),
                new SqlParameter("@MinPrice",            SqlDbType.Decimal,  9),
                new SqlParameter("@MaxPrice",            SqlDbType.Decimal,  9),
                new SqlParameter("@Price",               SqlDbType.Decimal,  9),
                new SqlParameter("@Distance",            SqlDbType.Int, 4)
            };
            parameters[0].Value = model.BuildingToMarket_id;
            parameters[1].Value = model.Building_id;
            parameters[2].Value = model.Market_id;
            parameters[3].Value = model.orderby;
            parameters[4].Value = model.MinPrice;
            parameters[5].Value = model.MaxPrice;
            parameters[6].Value = model.Price;
            parameters[7].Value = model.Distance;

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

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

            strSql.Append("select  top 1 BuildingToMarket_id,Building_id,Market_id,orderby,MinPrice,MaxPrice,Price,Distance from T_Base_BuildingToMarket ");
            strSql.Append(" where BuildingToMarket_id=@BuildingToMarket_id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuildingToMarket_id", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = BuildingToMarket_id;

            BuildingToMarketModel model = new BuildingToMarketModel();
            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(BuildingToMarketModel model)
 {
     return(dal.Update(model));
 }
예제 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(BuildingToMarketModel model)
 {
     return(dal.Add(model));
 }