Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            disID = Int32.Parse(Request.QueryString["disbursementID"]);
            if (!IsPostBack)
            {
                logInStaffId = (string)Session["loginID"];

                /*Set the role and dept from login info*/

                logInRole    = deptStaffDAO.findStaffByID(logInStaffId).role;
                logInDept    = deptStaffDAO.findStaffByID(logInStaffId).deptID;
                matchingDept = dDAO.getDisbursmentbyId(disID).deptID;

                if (logInRole == "rep" && logInDept == matchingDept)
                {
                    DisplaySelectedDisbursementDetails(disID);
                }
            }
        }
Beispiel #2
0
        protected void NotifyButton_Click(object sender, EventArgs e)
        {
            NotifyButton.Enabled = false;
            //send email and notification to rep
            Label  s          = disburseGridView.SelectedRow.FindControl("disburseIDLabel") as Label;
            string a          = s.Text;
            int    disburseID = Convert.ToInt32(a);
            SA45_Team09_LogicUEntities context = new SA45_Team09_LogicUEntities();
            Disbursement    disbursement       = disDAO.getDisbursmentbyId(disburseID);
            string          deptid             = disbursement.deptID;
            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          disbursementDate  = disbursement.disburseDate.ToShortDateString();
            string          collectionPointID = context.Departments.Where(x => x.deptID == deptid).Select(x => x.collectionPointID).ToList().First();
            string          collectionPoint   = context.CollectionPoints.Where(x => x.collectionPointID == collectionPointID).Select(x => x.description).ToList().First();
            NotificationDAO nDAO = new NotificationDAO();

            nDAO.addDeptNotification(repID, "Disbursement " + disbursement.disbursementID + " is confirmed on " + disbursementDate, DateTime.Now);

            Email email = new Email();

            email.sendDisbursementEmailToRep(repName, disbursementDate, collectionPoint);
        }