/// <summary> /// 传入Areas对象,插入Areas表 /// </summary> /// <param name="NewAreas"></param> /// <returns></returns> public int AddAreas(Model.Areas NewAreas) { string str = "insert into Areas(AreasName,ProvinceID) values(@AreasName,@ProvinceID)"; SqlParameter[] pms = new SqlParameter[] { new SqlParameter("@AreasName", NewAreas.AreasName), new SqlParameter("@ProvinceID", NewAreas.ProvinceID) }; return(SqlHelper.ExecuteNonQuery(str, System.Data.CommandType.Text, pms)); }
/// <summary> /// 根据传入的ProvinceID获取此ProvinceID下的Areas(区县信息) /// </summary> /// <param name="AreasId"></param> /// <returns></returns> public List <Model.Areas> GetAreasByProvinceId(int ProvinceID) { List <Model.Areas> Areases = new List <Model.Areas>(); string str = "select * from Areas where ProvinceID=" + ProvinceID; DataTable dt = SqlHelper.ExecuteDataTable(str, CommandType.Text, null); foreach (DataRow dr in dt.Rows) { Model.Areas Area = new Model.Areas(); Area.AreaSID = Convert.ToInt32(dr["AreaSID"]); Area.AreasName = dr["AreasName"].ToString(); Areases.Add(Area); } return(Areases); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; Model.Areas NewAreas = new Model.Areas(); NewAreas.AreasName = context.Request["value"].ToString(); NewAreas.ProvinceID = Convert.ToInt32(context.Request["pk"]); int ok = new BLL.Areas().AddAreas(NewAreas); if (ok == 1) { context.Response.Write(200); } else { context.Response.Write(400); } }
public int AddAreas(Model.Areas NewAreas) { return(new DAL.Areas().AddAreas(NewAreas)); }