protected void btn_SendToManager_Click(object sender, EventArgs e) { AdjustmentVoucher adjv = adjvdao.findAdjustmentVoucherByadjvId(adjvoucherID); adjvdao.SendtoManageranother(adjv);//Method2 //send email and notification to rep SA45_Team09_LogicUEntities context = new SA45_Team09_LogicUEntities(); string supervisorName = Session["loginName"].ToString(); StoreStaff manager = context.StoreStaffs.Where(x => x.role == "manager").ToList().First(); string managerID = manager.storeStaffID; string managerName = manager.storeStaffName; string confirmDate = DateTime.Now.ToShortDateString(); NotificationDAO nDAO = new NotificationDAO(); nDAO.addStoreNotification(managerID, supervisorName + " has send an adjustment voucher!" + confirmDate, DateTime.Now); Email email = new Email(); email.sendAdjustmentEmailToManager(supervisorName, managerName); Response.Redirect("./SS_ViewAdjustment.aspx"); }
protected void Btn_Approve_Click(object sender, EventArgs e) { string supervisor = (string)Session["loginID"]; { if (dropdownlist1.Text != "---Select Clerk for this time---" && dropdownlist2.Text != "---Select Clerk for this time---" && dropdownlist3.Text != "---Select Clerk for this time---" && dropdownlist4.Text != "---Select Clerk for this time---" && dropdownlist5.Text != "---Select Clerk for this time---" && dropdownlist6.Text != "---Select Clerk for this time---") { string staff1 = storeStaffDAO.getStoreStaffIDbyName(dropdownlist1.Text); string staff2 = storeStaffDAO.getStoreStaffIDbyName(dropdownlist2.Text); string staff3 = storeStaffDAO.getStoreStaffIDbyName(dropdownlist3.Text); string staff4 = storeStaffDAO.getStoreStaffIDbyName(dropdownlist4.Text); string staff5 = storeStaffDAO.getStoreStaffIDbyName(dropdownlist5.Text); string staff6 = storeStaffDAO.getStoreStaffIDbyName(dropdownlist6.Text); collectionDAO.updatecollection(staff1, Label_CollectionPoint1.Text); collectionDAO.updatecollection(staff2, Label_CollectionPoint2.Text); collectionDAO.updatecollection(staff3, Label_CollectionPoint3.Text); collectionDAO.updatecollection(staff4, Label_CollectionPoint4.Text); collectionDAO.updatecollection(staff5, Label_CollectionPoint5.Text); collectionDAO.updatecollection(staff6, Label_CollectionPoint6.Text); NotificationDAO nDAO = new NotificationDAO(); string supervisorName = Session["loginName"].ToString(); nDAO.addStoreNotification(staff1, supervisorName + " assigned you in collection point " + Label_CollectionPoint1.Text, DateTime.Now); nDAO.addStoreNotification(staff2, supervisorName + " assigned you in collection point " + Label_CollectionPoint2.Text, DateTime.Now); nDAO.addStoreNotification(staff3, supervisorName + " assigned you in collection point " + Label_CollectionPoint3.Text, DateTime.Now); nDAO.addStoreNotification(staff4, supervisorName + " assigned you in collection point " + Label_CollectionPoint4.Text, DateTime.Now); nDAO.addStoreNotification(staff5, supervisorName + " assigned you in collection point " + Label_CollectionPoint5.Text, DateTime.Now); nDAO.addStoreNotification(staff6, supervisorName + " assigned you in collection point " + Label_CollectionPoint6.Text, DateTime.Now); } else { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>win.alert('Notice', 'Please select all the clerks name for this time disbursements!');</script>"); } } }
protected void Submit_Click(object sender, EventArgs e) { string name = this.staffID; SA45_Team09_LogicUEntities m = new DBEntities().getDBInstance(); List <AdjustmentVoucherItemcart> lac = new List <AdjustmentVoucherItemcart>(); lac = (List <AdjustmentVoucherItemcart>)Session["adjvcart"]; if (lac.Count > 0) { int num = 0; int judge = 0; foreach (Control i in cartRepeater.Items) //get Quantity { LinkButton deletebtn = i.FindControl("cart_deleteButton") as LinkButton; //get itemID TextBox cartqty = i.FindControl("cart_qtyTextBox") as TextBox; //get quantity TextBox cartrecord = i.FindControl("cart_recordTextBox") as TextBox; //get record lac[num].ItemID = deletebtn.CommandArgument.ToString(); if (cartqty.Text.Trim() == "") { judge = 1; break; } try { lac[num].Qty = Int32.Parse(cartqty.Text.ToString()); } catch { judge = 1; break; } if ((lac[num].Qty % 1 != 0) || (lac[num].Qty == 0)) { judge = 1; break; } if ((lac[num].Qty < 0) && (Math.Abs(lac[num].Qty) > itemDAO.getItemByitemID(lac[num].ItemID).First().qtyOnHand)) { judge = 2; break; } lac[num].Record = cartrecord.Text; num++; } if (judge == 0) { AdjustmentVoucherDAO adjvdao = new AdjustmentVoucherDAO(); adjvdao.addAdjustmentVoucher(name, lac); lac = new List <AdjustmentVoucherItemcart>();//clear the cart session Session["adjvcart"] = lac; //send email and notification to rep SA45_Team09_LogicUEntities context = new SA45_Team09_LogicUEntities(); string clerkName = Session["loginName"].ToString(); StoreStaff supervisor = context.StoreStaffs.Where(x => x.role == "supervisor").ToList().First(); string supervisorID = supervisor.storeStaffID; string supervisorName = supervisor.storeStaffName; string confirmDate = DateTime.Now.ToShortDateString(); NotificationDAO nDAO = new NotificationDAO(); nDAO.addStoreNotification(supervisorID, clerkName + " has send an adjustment voucher!" + confirmDate, DateTime.Now); Email email = new Email(); email.sendAdjustmentEmailToSupervisor(clerkName, supervisorName); HttpContext.Current.Response.Redirect("SC_ViewAdjustmentVoucher.aspx"); } else { if (judge == 1) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>win.alert('Notice', 'Input must be integer!');</script>"); } else { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>win.alert('Notice', 'Input must be lower than qty on hand!');</script>"); } } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage2", "alert('Nothing in cart')", true); return; } }