protected void zl_tj(object sender, EventArgs e) { if (Context.Request["tj_pd"].ToString() == "tj_true") { zl_and_jc_info zaji = new zl_and_jc_info(); List <zl_and_jc_info> list = zl_select(Session["username"].ToString(), Session["gs_name"].ToString()); row_count = list.Count; for (int i = 1; i < (Convert.ToInt32(Context.Request["row_i"].ToString()) - row_count); i++) { List <zl_and_jc_info> list_zl = new List <zl_and_jc_info>(); zaji.sp_dm = Context.Request["sp_dm" + i].ToString(); zaji.name = Context.Request["name" + i].ToString(); zaji.lei_bie = Context.Request["lei_bie" + i].ToString(); zaji.dan_wei = Context.Request["dan_wei" + i].ToString(); zaji.zh_name = Session["username"].ToString(); zaji.gs_name = Session["gs_name"].ToString(); list_zl.Add(zaji); add_zl(list_zl); } for (int i = 0; i < row_count; i++) { update_zl(Context.Request["sp_dm_cs" + i].ToString(), Context.Request["name_cs" + i].ToString(), Context.Request["lei_bie_cs" + i].ToString(), Context.Request["dan_wei_cs" + i].ToString(), Context.Request["id_cs" + i].ToString()); } Response.Write(" <script>alert('提交成功'); location='zheng_li_page.aspx';</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] != null && Session["gs_name"] != null) { if (Request["id"] != null) { string id = Request["id"]; zl_and_jc_info select = cal.select_jczl(Session["username"].ToString(), Session["gs_name"].ToString()).Find(f => f.id == id); sm_spname.InnerText = "修改前信息为:" + select.name; sm_fenlei.InnerText = "修改前信息为:" + select.lei_bie; sm_ghf.InnerText = "修改前信息为:" + select.Gong_huo; sm_shf.InnerText = "修改前信息为:" + select.shou_huo; } } }
public void selectNameAndLebie(object id) { zl_and_jc_info zl = new zl_and_jc_info(); List <zl_and_jc_info> getlist = HttpContext.Current.Session["jichu"] as List <zl_and_jc_info>; for (int li = 0; li < getlist.Count; li++) { if (getlist[li].sp_dm.Equals(id)) { zl.name = getlist[li].name; zl.lei_bie = getlist[li].lei_bie; } } //return json //return zl; //Context.Response.ContentType = "text/plain"; Response.Write("[{\"name\":\"" + zl.name + "\",\"leibie\":\"" + zl.lei_bie + "\",\"company\":\"无用户\"}]"); //Response.Write(JSONObj); //一定要加,不然前端接收失败 Response.End(); }
protected void insert_Click(object sender, EventArgs e) { try { string name = spname.Text; string fl = txt_fl.Text; string ghs = txt_ghf.Text; string shf = txt_shf.Text; zl_and_jc_info jc = new zl_and_jc_info() { name = name, lei_bie = fl, Gong_huo = ghs, shou_huo = shf, zh_name = Session["username"].ToString(), gs_name = Session["gs_name"].ToString() }; List <zl_and_jc_info> jczl = new List <zl_and_jc_info>(); jczl.Add(jc); cal.add_jczl(jczl); Response.Write("<script>alert('添加成功'); window.location.href = 'type.aspx';</script>"); } catch (Exception ex) { throw ex; } }