protected void btnConfirm_Click(object sender, EventArgs e) { sClerkCtrl.SetCollectionDateToDisbursement(DateTime.Parse(tbxDate.Text), Context.User.Identity.Name); sClerkCtrl.UpdateCurrentRetrievalToRetrieved(); btnBack.Enabled = false; btnNext.Enabled = true; GetPlanToCollectDate("disbursing"); BindDropDownList(disbursementStatus); lblCollectionDate.Text = DisplayDate(DateTime.Parse(tbxDate.Text)); lblConfirmDate.Text = "Disbursements have been confirmed. Please proceed to Disbursement Form."; disbursementStatus = "disbursing"; BindDropDownList(disbursementStatus); var disbursingList = sClerkCtrl.GetDisbursementsByStatus(disbursementStatus); lvCollectionPointList.DataSource = disbursingList; lvCollectionPointList.DataBind(); lvCollectionPointList.Visible = true; lblFixedCollectionPoint.Visible = true; ddlCollectionPoint.Visible = true; //send email string fromEmail = emailController.GetUserEmail(Context.User.Identity.Name); string password = txtPassword.Text; string username = Context.User.Identity.Name; try { emailController.ConfirmDisbursementSendEmail(fromEmail, password, username, disbursingList, DateTime.Parse(tbxDate.Text)); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Disbursements have been confirmed! Email notifications have been sent successfully!');window.location ='DisbursementGenerationPage';", true); } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Disbursements have been confirmed! However an error has occurred when sending email!');window.location ='DisbursementGenerationPage';", true); } }