protected void btnDel_Click(object sender, EventArgs e) { CheckBox cb; CY.CSTS.Core.Business.Link link = new CY.CSTS.Core.Business.Link(); for (int i = 0; i < gvLink.Rows.Count; i++) { cb = (CheckBox)gvLink.Rows[i].FindControl("cbSelect"); if (cb.Checked) { try { Guid id = new Guid(gvLink.DataKeys[i].Value.ToString()); link = CY.CSTS.Core.Business.Link.Load(id); link.DeleteOnSave(); link.Save(); } catch (Exception ex) { } } } bindgvLink(); }
public void ProcessRequest(HttpContext context) { // tbName: $("#tbName").val(), tbUnit: $("#UnitName").val(), tbURL: $("#tbURL").val(""), tbIMGURL: $("#tbIMGURL").val(""), tbIndex: $("#tbIndex").val(), hdtype: $("#hdtype").html(), OperType: "Add", Id: "" string json = string.Empty; string name = context.Request.Params["tbName"].ToString(); string Unit = context.Request.Params["tbUnit"].ToString(); string tbURL = context.Request.Params["tbURL"].ToString(); string tbIMGURL = context.Request.Params["tbIMGURL"].ToString(); string tbIndex = context.Request.Params["tbIndex"].ToString(); string hdtype = context.Request.Params["hdtype"].ToString(); string OperType = context.Request.Params["OperType"].ToString(); string rdy = context.Request.Params["rdy"].ToString(); string rdn = context.Request.Params["rdn"].ToString(); string idstr = context.Request.Params["Id"].ToString(); if (OperType == "Add") { try { CY.CSTS.Core.Business.Link link = new CY.CSTS.Core.Business.Link(); try { Guid unitId = new Guid(Unit); link.Unit = unitId; } catch (Exception ex) { } Guid classid = new Guid(hdtype); link.Name = name; link.URL = tbURL; link.PicURI = tbIMGURL; link.LinkClass = classid; link.Index = int.Parse(tbIndex); if (rdy == "true" && rdn == "false") { link.Type = 1; } else { link.Type = 2; } link.Save(); json = "{success:true,msg:''}"; } catch (Exception ex) { json = "{success:false,msg:" + ex + "}"; } } else if (OperType == "Modi") { try { Guid linkid = new Guid(idstr); CY.CSTS.Core.Business.Link link = CY.CSTS.Core.Business.Link.Load(linkid); try { Guid unitId = new Guid(Unit); link.Unit = unitId; } catch (Exception ex) { } Guid classid = new Guid(hdtype); link.Name = name; link.URL = tbURL; link.PicURI = tbIMGURL; link.LinkClass = classid; link.Index = int.Parse(tbIndex); if (rdy == "true" && rdn == "false") { link.Type = 1; } else { link.Type = 2; } link.Save(); json = "{success:true,msg:''}"; } catch (Exception ex) { json = "{success:false,msg:" + ex + "}"; } } context.Response.ContentType = "text/plain"; context.Response.Write(json); }