private void btndelete_Click(object sender, System.EventArgs e) { if (txtcomment.Text.Trim() == "") { lblmessage.Text = "Please enter a comment."; return; } else { lblmessage.Text = ""; iApproverStatusID = 7; strComments = txtcomment.Text.Trim(); UserTypeID = objinvoice.GetUserType(System.Convert.ToInt32(Session["UserID"].ToString())); if (DocType == "INV") { StatusUpdate = objinvoice.UpdateInvStatusToDelete(System.Convert.ToInt32(Session["eInvoiceID"].ToString())); if (StatusUpdate == 1) { objinvoice.UpdateInvoiceStatusLogApproverWise(System.Convert.ToInt32(Session["eInvoiceID"]), System.Convert.ToInt32(Session["UserID"]), UserTypeID, iApproverStatusID, strComments, ""); lblmessage.Text = "Invoice deleted successfully"; hdIsDeleted.Value = "1"; Response.Write("<script>alert('Invoice Deleted Sussessfully');</script>"); Response.Write("<script>self.close();</script>"); } else { lblmessage.Text = "Invoice cannot be deleted"; } } else if (DocType == "CRN") { StatusUpdate = objinvoice.UpdateCrnStatusToDelete(System.Convert.ToInt32(Session["eInvoiceID"].ToString())); if (StatusUpdate == 1) { objinvoice.UpdateInvoiceStatusLogApproverWise_CN(System.Convert.ToInt32(Session["eInvoiceID"]), System.Convert.ToInt32(Session["UserID"]), UserTypeID, iApproverStatusID, strComments); lblmessage.Text = "CreditNote deleted successfully"; hdIsDeleted.Value = "1"; Response.Write("<script>alert('Credit Note Deleted Sussessfully');</script>"); Response.Write("<script>self.close();</script>"); } else { lblmessage.Text = "CreditNote cannot be deleted"; } } else { StatusUpdate = objinvoice.UpdateDebitNoteStatusToDelete(System.Convert.ToInt32(Session["eInvoiceID"].ToString())); if (StatusUpdate == 1) { objinvoice.UpdateInvoiceStatusLogApproverWise_DN(System.Convert.ToInt32(Session["eInvoiceID"]), System.Convert.ToInt32(Session["UserID"]), UserTypeID, iApproverStatusID, strComments); lblmessage.Text = "CreditNote deleted successfully"; hdIsDeleted.Value = "1"; Response.Write("<script>alert('Credit Note Deleted Sussessfully');</script>"); Response.Write("<script>self.close();</script>"); } else { lblmessage.Text = "CreditNote cannot be deleted"; } } } }