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

            strSql.Append("update shop_region set ");
            strSql.Append("parent_id=@parent_id,");
            strSql.Append("region_name=@region_name,");
            strSql.Append("region_type=@region_type,");
            strSql.Append("agency_id=@agency_id");
            strSql.Append(" where region_id=@region_id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@parent_id",   MySqlDbType.Int16,     5),
                new MySqlParameter("@region_name", MySqlDbType.VarChar, 120),
                new MySqlParameter("@region_type", MySqlDbType.Int16,     1),
                new MySqlParameter("@agency_id",   MySqlDbType.Int16,     5),
                new MySqlParameter("@region_id",   MySqlDbType.Int16, 5)
            };
            parameters[0].Value = model.parent_id;
            parameters[1].Value = model.region_name;
            parameters[2].Value = model.region_type;
            parameters[3].Value = model.agency_id;
            parameters[4].Value = model.region_id;

            int rows = Shop_DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

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

            strSql.Append("insert into shop_region(");
            strSql.Append("region_id,parent_id,region_name,region_type,agency_id)");
            strSql.Append(" values (");
            strSql.Append("@region_id,@parent_id,@region_name,@region_type,@agency_id)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@region_id",   MySqlDbType.Int16,     5),
                new MySqlParameter("@parent_id",   MySqlDbType.Int16,     5),
                new MySqlParameter("@region_name", MySqlDbType.VarChar, 120),
                new MySqlParameter("@region_type", MySqlDbType.Int16,     1),
                new MySqlParameter("@agency_id",   MySqlDbType.Int16, 5)
            };
            parameters[0].Value = model.region_id;
            parameters[1].Value = model.parent_id;
            parameters[2].Value = model.region_name;
            parameters[3].Value = model.region_type;
            parameters[4].Value = model.agency_id;

            int rows = Shop_DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public FMS_Model.shop_region DataRowToModel(DataRow row)
 {
     FMS_Model.shop_region model = new FMS_Model.shop_region();
     if (row != null)
     {
         if (row["region_id"] != null && row["region_id"].ToString() != "")
         {
             model.region_id = int.Parse(row["region_id"].ToString());
         }
         if (row["parent_id"] != null && row["parent_id"].ToString() != "")
         {
             model.parent_id = int.Parse(row["parent_id"].ToString());
         }
         if (row["region_name"] != null)
         {
             model.region_name = row["region_name"].ToString();
         }
         if (row["region_type"] != null && row["region_type"].ToString() != "")
         {
             model.region_type = int.Parse(row["region_type"].ToString());
         }
         if (row["agency_id"] != null && row["agency_id"].ToString() != "")
         {
             model.agency_id = int.Parse(row["agency_id"].ToString());
         }
     }
     return(model);
 }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public FMS_Model.shop_region GetModel(int region_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select region_id,parent_id,region_name,region_type,agency_id from shop_region ");
            strSql.Append(" where region_id=@region_id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@region_id", MySqlDbType.Int16, 5)
            };
            parameters[0].Value = region_id;

            FMS_Model.shop_region model = new FMS_Model.shop_region();
            DataSet ds = Shop_DbHelperMySQL.Query(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(FMS_Model.shop_region model)
 {
     return(dal.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(FMS_Model.shop_region model)
 {
     return(dal.Add(model));
 }