public static void Delete_print(int printid) { using (ReportToolDataContext rdb = new ReportToolDataContext()) { tbl_print obj = rdb.tbl_prints.Where(c => c.PrintID == printid).SingleOrDefault(); rdb.tbl_prints.DeleteOnSubmit(obj); rdb.SubmitChanges(); } }
protected void btnedit_click(object sender, EventArgs e) { tbl_print obj = Reportgenrator.Get_printdetails(hfdselprnt.Value); string ftxt = File.ReadAllText(Server.MapPath("../Prints") + "//" + hfdselprnt.Value + ".aspx"); int sind = ftxt.IndexOf("<div class=Section1>") + 20; int lind = ftxt.LastIndexOf("</div>"); txtsummarycomplaint.Text = ftxt.Substring(sind, lind - sind).Replace("<%=", ":%=").Replace("%>", "%:"); txtfilename.Text = obj.fname; ScriptManager.RegisterStartupScript(Page, GetType(), "js", "afteredit()", true); }
protected void Page_Load(object sender, EventArgs e) { var count = Request.QueryString.Count; if (!IsPostBack) { string pid = "0"; if (Request.QueryString["pid"] != null) { pid = Request.QueryString["pid"].ToString(); } if (Request.QueryString.Count == 3 || (Request.QueryString.Count == 4 && pid == "0")) { tbl_print obj = Reportgenrator.Get_printbyid(Request.QueryString[1].ToString()); string query = "select * from [" + obj.Vwname + "] where [" + obj.fltrcol + "]='" + Request.QueryString[2].ToString() + "'"; DataSet ds = Reportgenrator.Getrpt(query); if (ds.Tables[0].Rows.Count > 0) { dr = ds.Tables[0].Rows[0]; } } else if (pid != "0") { tbl_print obj = Reportgenrator.Get_printbyid(Request.QueryString[1].ToString()); string query = "select * from [" + obj.Vwname + "] where [" + obj.fltrcol + "]='" + Request.QueryString[2].ToString() + "' and perid=" + Request.QueryString["pid"].ToString(); DataSet ds = Reportgenrator.Getrpt(query); if (ds.Tables[0].Rows.Count > 0) { dr = ds.Tables[0].Rows[0]; } } else if (Request.QueryString.Count == 4) { tbl_print obj = Reportgenrator.Get_printbyid(Request.QueryString[1].ToString()); string query = "select * from [" + obj.Vwname + "] where [" + obj.fltrcol + "]='" + Request.QueryString[2].ToString() + "'"; DataSet ds = Reportgenrator.Getrpt(query); if (ds.Tables[0].Rows.Count > 0) { dr = ds.Tables[0].Rows[0]; } DataList dtl = (DataList)this.Page.FindControl("dtlstresp"); dtl.DataSource = Getrespondents(); dtl.DataBind(); } } }
public static string Insert_print(int pid, string fltype, string vwname, string fname, string fltcond) { using (ReportToolDataContext rdb = new ReportToolDataContext()) { tbl_print obj = new tbl_print(); if (pid != 0) { obj = rdb.tbl_prints.Where(c => c.PrintID == pid).SingleOrDefault(); } obj.Folder = Convert.ToInt32(fltype); obj.Vwname = vwname; obj.fname = fname; obj.fltrcol = fltcond; if (pid == 0) { rdb.tbl_prints.InsertOnSubmit(obj); } rdb.SubmitChanges(); return(obj.PrintID.ToString()); } }