/***********************this confirm button simulates the scene after scanning QRcode (only for Test)**********************************/ /**********************To confirm specified dept disbursement**************************************************************/ protected void Button3_Click(object sender, EventArgs e) { int disburseID = Convert.ToInt32(ViewState["disburseID"]); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('you are generate the Disbursement " + disburseID + " ?')", true); //here should send message box yes or no DisbursementDAO disDAO = new DisbursementDAO(); //disburList ConfirmBtn.Enabled = false; disDAO.updateDisbursementStatus(Convert.ToInt32(ViewState["disburseID"]), "Completed"); disburseGridView.SelectedIndex = -1; disburseBindGrid(); disburseUpdatePanel.Update(); disburseItemGridView.DataSource = null; disburseItemGridView.DataBind(); //send email and notification to rep SA45_Team09_LogicUEntities context = new SA45_Team09_LogicUEntities(); string repID = context.Departments.Where(x => x.deptID == deptid).Select(x => x.repStaffID).ToList().First(); string repName = context.DeptStaffs.Where(x => x.staffID == repID).Select(x => x.staffName).ToList().First(); string confirmDate = DateTime.Now.ToShortDateString(); NotificationDAO nDAO = new NotificationDAO(); nDAO.addDeptNotification(repID, "Disbursement " + disburseID + " is confirmed on " + confirmDate, DateTime.Now); Email email = new Email(); email.sendConfirmedDisbursementEmailToRep(repName, confirmDate, disburseID.ToString()); }
public int confirmDisbursement(confirm_JSON confirm_json, string disID_url) { int disID = Int32.Parse(disID_url); string date_s = confirm_json.Scan_date;//put here in case string staffID = confirm_json.LoginID; DisbursementDAO disDAO = new DisbursementDAO(); try { disDAO.updateDisbursementStatus(disID, "Completed"); return(1); } catch (Exception e) { return(0); } }