/// <summary> /// 删除地区 /// </summary> /// <param name="en">地区</param> /// <returns></returns> public int delete(AreaInfo en) { string strSql = "delete from AreaInfo where id=@id"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@id", en.id) }; int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param); return result; }
/// <summary> /// 添加地区 /// </summary> /// <param name="en">地区</param> /// <returns></returns> public int add(AreaInfo en) { string strSql = "insert into AreaInfo (name, memo) values (@name, @memo)"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@name", en.name), new SqlParameter("@memo", en.memo) }; int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param); return result; }
/// <summary> /// 修改地区 /// </summary> /// <param name="en">地区</param> /// <returns></returns> public int update(AreaInfo en) { string strSql = "update AreaInfo set name=@name, memo=@memo where id=@id"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@id", en.id), new SqlParameter("@name", en.name), new SqlParameter("@memo", en.memo) }; int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param); return result; }
/// <summary> /// 删除地区 /// </summary> /// <param name="id"></param> /// <returns></returns> public JsonResult Area_remove(string id) { AreaInfo en = new AreaInfo(); en.id = Convert.ToInt32(id); DaAreaInfo dal = new DaAreaInfo(); var result = new CustomJsonResult(); result.Data = dal.delete(en); return result; }
public JsonResult Area_edit(string id, string name, string memo) { AreaInfo en = new AreaInfo(); en.id = Convert.ToInt32(id); en.name = name; en.memo = memo; DaAreaInfo dal = new DaAreaInfo(); var result = new CustomJsonResult(); result.Data = dal.update(en); return result; }
public JsonResult Area_add(string name, string memo) { AreaInfo en = new AreaInfo(); en.name = name; en.memo = memo; DaAreaInfo dal = new DaAreaInfo(); var result = new CustomJsonResult(); result.Data = dal.add(en); return result; }