public string DelegateAuthorityOfDepartment(Models.Delegate delegat) { Employee user = AuthUtil.GetCurrentLoggedUser(); if (user == null) { return("Failed"); } delegat.Department = new Department { DeptId = user.DeptId }; long headId = DepartmentService.GetCurrentHead(user.DeptId); DelegateService.AddNewDelegate(delegat, headId); EmailNotification notice = new EmailNotification(); Employee MailReceiver = EmployeeService.GetEmployeeById(delegat.Employee.EmpId); notice.ReceiverMailAddress = MailReceiver.Email; notice.From = delegat.FromDate; notice.To = delegat.ToDate; Task.Run(() => emailService.SendMail(notice, EmailTrigger.ON_DELEGATED_AS_DEPT_HEAD)); return("Success"); }
public Dictionary <string, object> GetAllRepresentativesOfDepartment() { Dictionary <string, object> repDict = new Dictionary <string, object>(); Employee user = AuthUtil.GetCurrentLoggedUser(); if (user == null) { repDict.Add("repList", new List <Employee>()); repDict.Add("curRep", new Employee()); } else { long currentRepId = DepartmentService.GetCurrentRep(user.DeptId); List <Employee> employees = RepresentativeService.GetEmployeesByDepartment(user.DeptId); Employee emp = employees.Find(e => e.EmpId == currentRepId); if (emp == null) { emp = DepartmentDAO.GetCurrentRepInfoById(user.DeptId); } repDict.Add("repList", employees); repDict.Add("curRep", emp); } return(repDict); }
public string ChangeRepresentativeOfDepartement(long repId) { Employee user = AuthUtil.GetCurrentLoggedUser(); if (user == null) { return("Failed"); } long deptId = user.DeptId; long currentRep = DepartmentService.GetCurrentRep(deptId); bool all = DelegateService.CheckPreviousHeadForNav(deptId); long newRep = repId; EmailNotification notice = new EmailNotification(); RepresentativeService.UpdateEmployeeRole(newRep, currentRep, deptId); Employee newRepMailReceiver = EmployeeService.GetEmployeeById(newRep); Employee oldRepMailReceiver = EmployeeService.GetEmployeeById(currentRep); Task.Run(() => { notice.ReceiverMailAddress = newRepMailReceiver.Email; emailService.SendMail(notice, EmailTrigger.ON_ASSIGNED_AS_DEPT_REP); notice.ReceiverMailAddress = oldRepMailReceiver.Email; emailService.SendMail(notice, EmailTrigger.ON_REMOVED_DEPT_REP); }); return("Success"); }
public override void OnResultExecuted(ResultExecutedContext filterContext) { if (rExecuted) { Employee emp = AuthUtil.GetCurrentLoggedUser(); if (emp != null) { filterContext.HttpContext.Response.AddHeader(authHeaderKey, String.Format("Basic {0}", Base64Encode(emp.UserName + ":" + emp.Password))); } } }
public string ApproveOrdereOfDepartment(int reqId) { Employee user = AuthUtil.GetCurrentLoggedUser(); if (user == null) { return("Failed"); } long headId = DepartmentService.GetCurrentHead(user.EmpId); RequisitionService.ProcessRequisition(reqId, "Approved", headId); return("Success"); }
public string AcknowledgementOfRepresentative(long listId) { Employee emp = AuthUtil.GetCurrentLoggedUser(); if (emp == null) { return("Failed"); } DisbursementListDAO.AcknowledgeDisbursement(listId, emp.EmpName); UpdateChargeBack(listId); return("Success"); }
public Dictionary <string, List <DisbursementList> > GetAllPendingDisbursementsOfRep() { Dictionary <string, List <DisbursementList> > disDict = new Dictionary <string, List <DisbursementList> >(); Employee emp = AuthUtil.GetCurrentLoggedUser(); if (emp == null) { disDict.Add("disbursementList", new List <DisbursementList>()); } else { List <DisbursementList> disbursements = DisbursementListDAO.GetAllPendingDisbursementList(emp.DeptId); disDict.Add("disbursementList", disbursements); } return(disDict); }
public Dictionary <string, List <Requisition> > GetAllPastOrdersOfDepartment() { Dictionary <string, List <Requisition> > reqDict = new Dictionary <string, List <Requisition> >(); Employee user = AuthUtil.GetCurrentLoggedUser(); if (user == null) { reqDict.Add("reqList", new List <Requisition>()); } else { List <Requisition> reqs = RequisitionDAO.GetAllPastOrderReqs((int)user.DeptId); reqDict.Add("reqList", reqs); } return(reqDict); }
public Dictionary <string, List <Employee> > GetAllEmployeesOfDepartment() { Dictionary <string, List <Employee> > repDict = new Dictionary <string, List <Employee> >(); Employee user = AuthUtil.GetCurrentLoggedUser(); if (user == null) { repDict.Add("repList", new List <Employee>()); } else { List <Employee> employees = RepresentativeService.GetEmployeesByDepartment(user.DeptId); repDict.Add("repList", employees); } return(repDict); }
public Dictionary <string, object> GetDelegateInfoOfDepartment() { Dictionary <string, object> resDict = new Dictionary <string, object>(); Employee user = AuthUtil.GetCurrentLoggedUser(); if (user == null) { resDict.Add("auth", false); return(resDict); } resDict.Add("auth", true); Models.Delegate del = DelegateDAO.GetDelegateInfoByDeptId((int)user.DeptId); resDict.Add("delegated", (del != null)); resDict.Add("userInfo", del); return(resDict); }