private void GetModelByYearAndArea(HttpContext context) { string year, administratorArea; year = administratorArea = ""; if (null != context.Request.QueryString["year"]) { year = context.Request.QueryString["year"].ToString().Trim(); } if (null != context.Request.QueryString["administratorArea"]) { administratorArea = context.Request.QueryString["administratorArea"].ToString().Trim(); } BLL.T_Verif bll_verif = new BLL.T_Verif(); List <Model.T_Verif> list = bll_verif.GetModelList(" 1=1 and year = " + year + " and administratorArea=" + administratorArea); Model.T_Verif model = list[0]; context.Response.Write(JsonHelper.Object2Json <Model.T_Verif>(model)); }
private void AddOrModify(HttpContext context) { //=============================================================== //获取字段:【用户name】 string id, name, year, administratorArea, divisionArea, des; id = name = year = administratorArea = divisionArea = des = ""; if (null != context.Request.QueryString["id"]) { id = context.Request.QueryString["id"].ToString().Trim(); } if (null != context.Request.QueryString["name"]) { name = context.Request.QueryString["name"].ToString().Trim(); } if (null != context.Request.QueryString["year"]) { year = context.Request.QueryString["year"].ToString().Trim(); } if (null != context.Request.QueryString["administratorArea"]) { administratorArea = context.Request.QueryString["administratorArea"].ToString().Trim(); } if (null != context.Request.QueryString["divisionArea"]) { divisionArea = context.Request.QueryString["divisionArea"].ToString().Trim(); } if (null != context.Request.QueryString["des"]) { des = context.Request.QueryString["des"].ToString().Trim(); } if (id == "") { Model.T_Verif model = new Model.T_Verif(); model.year = year; model.administratorArea = administratorArea; if (divisionArea != "") { model.divisionArea = Convert.ToDecimal(divisionArea); } else { model.divisionArea = 0; } if (context.Session["user_id"].ToString() != "") { model.userId = Convert.ToInt32(context.Session["user_id"]); } else { model.userId = 0; } model.createTime = System.DateTime.Now; model.isSubmited = 0; model.isDeleted = 0; model.des = des; int n = bll_verif.Add(model); if (n > 0) { message.flag = true; message.msg = "添加成功"; } else { message.flag = false; message.msg = "添加失败"; } } else { Model.T_Verif model = bll_verif.GetModel(Convert.ToInt32(id)); model.year = year; model.administratorArea = administratorArea; if (divisionArea != "") { model.divisionArea = Convert.ToDecimal(divisionArea); } else { model.divisionArea = 0; } if (context.Session["user_id"].ToString() != "") { model.userId = Convert.ToInt32(context.Session["user_id"]); } else { model.userId = 0; } model.createTime = System.DateTime.Now; model.isSubmited = 0; model.isDeleted = 0; model.des = des; if (context.Session["user_id"].ToString() != "") { model.userId = Convert.ToInt32(context.Session["user_id"]); } else { model.userId = 0; } model.createTime = System.DateTime.Now; model.isDeleted = 0; model.des = des; bool flag = bll_verif.Update(model); if (flag) { message.flag = true; message.msg = "修改成功"; } else { message.flag = false; message.msg = "修改失败"; } } String jsonString = JsonHelper.Object2Json <Message>(message); context.Response.Write(jsonString); }
private void AddOrModify(HttpContext context) { //=============================================================== //获取字段:【用户name】 string id, name, year, administratorArea, divisionArea, des; id = name = year = administratorArea = divisionArea = des = ""; if (null != context.Request.QueryString["id"]) { id = context.Request.QueryString["id"].ToString().Trim(); } if (null != context.Request.QueryString["name"]) { name = context.Request.QueryString["name"].ToString().Trim(); } if (null != context.Request.QueryString["year"]) { year = context.Request.QueryString["year"].ToString().Trim(); } if (null != context.Request.QueryString["administratorArea"]) { administratorArea = context.Request.QueryString["administratorArea"].ToString().Trim(); } if (null != context.Request.QueryString["divisionArea"]) { divisionArea = context.Request.QueryString["divisionArea"].ToString().Trim(); } if (null != context.Request.QueryString["des"]) { des = context.Request.QueryString["des"].ToString().Trim(); } if (id == "") { Model.T_Verif model = new Model.T_Verif(); model.year = year; model.administratorArea = administratorArea; if (divisionArea != "") { model.divisionArea = Convert.ToDecimal(divisionArea); } else { model.divisionArea = 0; } if (context.Session["user_id"].ToString() != "") { model.userId = Convert.ToInt32(context.Session["user_id"]); } else { model.userId = 0; } model.createTime = System.DateTime.Now; model.isSubmited = 0; model.isDeleted = 0; model.des = des; int n = bll_verif.Add(model); if (n > 0) { message.flag = true; message.msg = "添加成功"; } else { message.flag = false; message.msg = "添加失败"; } } else { Model.T_Verif model = bll_verif.GetModel(Convert.ToInt32(id)); model.year = year; model.administratorArea = administratorArea; if (divisionArea != "") { model.divisionArea = Convert.ToDecimal(divisionArea); } else { model.divisionArea = 0; } if (context.Session["user_id"].ToString() != "") { model.userId = Convert.ToInt32(context.Session["user_id"]); } else { model.userId = 0; } model.createTime = System.DateTime.Now; model.isSubmited = 0; model.isDeleted = 0; model.des = des; if (context.Session["user_id"].ToString() != "") { model.userId = Convert.ToInt32(context.Session["user_id"]); } else { model.userId = 0; } model.createTime = System.DateTime.Now; model.isDeleted = 0; model.des = des; bool flag = bll_verif.Update(model); if (flag) { message.flag = true; message.msg = "修改成功"; } else { message.flag = false; message.msg = "修改失败"; } } String jsonString = JsonHelper.Object2Json<Message>(message); context.Response.Write(jsonString); }