protected void Reject_btn_Click(object sender, EventArgs e) { int rowIndex = ((sender as Button).NamingContainer as GridViewRow).RowIndex; string Path = User_grd.DataKeys[rowIndex].Values[1].ToString(); string ID = User_grd.DataKeys[rowIndex].Values[0].ToString(); FileInfo info = new FileInfo(Path); Path = "~/StaticHTML/" + info.Name.Replace(".pdf", "") + ".html"; string content = "<div class='row'><span id ='temp' style='float:right; color:violet;text-decoration:bold'> Rejected, " + Session["DepName"].ToString() + " </span><br><img id ='Sign_lbl' src='../Content/signature.jpg' style='width:10%;height:10%;float: right;'></div><br>"; File.AppendAllText(Server.MapPath(Path), content); int Res = PDFConverter.DoConvert(info.Name.Replace(".pdf", ""), Path); if (Res == 1) { UpdateStatusTableAdapter us = new UpdateStatusTableAdapter(); object res = us.UpdateStatus(ID, ""); Boolean chk = Convert.ToBoolean(res); if (chk == true) { error_lbl.Text = "Application rejected Successfully!!"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } else { error_lbl.Text = "Error, please try again!!"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } } }
protected void submitapp_btn_Click(object sender, EventArgs e) { string temp = app_hfd.Value; Random r = new Random(); int randNum = r.Next(1000000); string sixDigitNumber = randNum.ToString("D6"); using (FileStream fs = new FileStream(Server.MapPath("~/StaticHTML/" + Session["UserLogin"].ToString() + sixDigitNumber + ".html"), FileMode.Create)) { using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8)) { w.WriteLine(temp); } } string NamePath = "~/Applications/" + Session["UserLogin"].ToString() + sixDigitNumber + ".pdf"; int Res = PDFConverter.DoConvert(Session["UserLogin"].ToString() + sixDigitNumber, "~/StaticHTML/" + Session["UserLogin"].ToString() + sixDigitNumber + ".html"); if (Res == 0) { error_lbl.Text = "Failed to generate PDF, Try again!!"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } else { Boolean Result = InsertApplication(NamePath); if (Result == true) { error_lbl.Text = "Application forwarded successfully, Refer Application list!!"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } else { error_lbl.Text = "DB Error, Try again!!"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); } } }