public void ProcessRequest(HttpContext context) { // Name: $("#tbName").val(), IndexNum: $("#tbIndex").val(),OperType:"Add" string json = string.Empty; string Name = context.Request.Params["Name"].ToString(); string IndexNum = context.Request.Params["IndexNum"].ToString(); string OperType = context.Request.Params["OperType"].ToString(); if (OperType == "Add") { CY.CSTS.Core.Business.LinkClass linkclass = new CY.CSTS.Core.Business.LinkClass(); try { linkclass.ClassName = Name; linkclass.Index = int.Parse(IndexNum); linkclass.Save(); json = "{success:true,msg:''}"; } catch (Exception ex) { json = "{success:false,msg:"+ex+"}"; } } else if (OperType == "Modi") { string idstr = context.Request.Params["Id"].ToString(); try { Guid id = new Guid(idstr); CY.CSTS.Core.Business.LinkClass linkclass = CY.CSTS.Core.Business.LinkClass.Load(id); linkclass.ClassName = Name; linkclass.Index = int.Parse(IndexNum); linkclass.Save(); json = "{success:true,msg:''}"; } catch (Exception ex) { json = "{success:false,msg:"+ex+"}"; } } context.Response.ContentType = "text/plain"; context.Response.Write(json); }
protected void btnDel_Click(object sender, EventArgs e) { CY.CSTS.Core.Business.LinkClass linkclass = new CY.CSTS.Core.Business.LinkClass(); CheckBox cb; for (int i = 0; i < gvLinkClass.Rows.Count; i++) { cb = (CheckBox)gvLinkClass.Rows[i].FindControl("cbSelect"); if (cb.Checked) { try { Guid id = new Guid(gvLinkClass.DataKeys[i].Value.ToString()); linkclass = CY.CSTS.Core.Business.LinkClass.Load(id); linkclass.DeleteOnSave(); linkclass.Save(); } catch (Exception ex) { } } } bindgvLinkClass(); }