Пример #1
0
        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");
        }
Пример #2
0
        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);
        }
Пример #3
0
        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");
        }
Пример #4
0
 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)));
         }
     }
 }
Пример #5
0
        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");
        }
Пример #6
0
        public string AcknowledgementOfRepresentative(long listId)
        {
            Employee emp = AuthUtil.GetCurrentLoggedUser();

            if (emp == null)
            {
                return("Failed");
            }

            DisbursementListDAO.AcknowledgeDisbursement(listId, emp.EmpName);

            UpdateChargeBack(listId);

            return("Success");
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        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);
        }
Пример #10
0
        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);
        }