コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<PendingVacationRequestViewItem> GetPendingRequests()
        {
            String currentUserId = User.Identity.GetUserId();
            List<String> statesListWithShiftPartner = new List<string> { DBQuery.AGREED, DBQuery.REJECTED_BY_DEPUTY };
            List<String> statesListWithoutShiftPartner = new List<string> { DBQuery.SUBMITTED };

            DBQuery dbq = new DBQuery();

            var DivisionVacationRequestList = new List<PendingVacationRequestViewItem>();
            var SortedDivisionVacationRequestList = new List<PendingVacationRequestViewItem>();
            var EmployeeList = new List<Employee>();

            EmployeeList.AddRange(dbq.SelectEmployeesOfDivision(currentUserId));
            if (EmployeeList.Count() > 0)
            {
                foreach (Employee e in EmployeeList)
                {
                    // look for all employees of division but Division Manager self
                    if (!e.getEmployeeID().Equals(currentUserId))
                    {
                        var vrList = new List<VacationManagement.VacationRequest>();
                        String requesterName = e.getFullName();
                        String deputyID = dbq.SelectShiftPartner(e.getEmployeeID());
                        int remainingVacationDays = dbq.SelectRemainingVacationDays(e.getEmployeeID());

                        // has shiftpartner
                        if (!deputyID.Equals("null"))
                        {
                            String deputyName = dbq.SelectEmployeeFullName(deputyID);

                            foreach (string s in statesListWithShiftPartner)
                            {
                                vrList.AddRange(dbq.SelectVacationRequestsInState(e.getEmployeeID(), s));
                            }
                            foreach (VacationManagement.VacationRequest vr in vrList)
                            {
                                DivisionVacationRequestList.Add(new PendingVacationRequestViewItem(vr, requesterName, deputyName, remainingVacationDays));
                            }
                        }
                        else
                        {
                            String deputyName = "-";
                            foreach (string s in statesListWithoutShiftPartner)
                            {
                                vrList.AddRange(dbq.SelectVacationRequestsInState(e.getEmployeeID(), s));
                            }
                            foreach (VacationManagement.VacationRequest vr in vrList)
                            {
                                DivisionVacationRequestList.Add(new PendingVacationRequestViewItem(vr, requesterName, deputyName, remainingVacationDays));
                            }
                        }
                    }
                }
                // Sort all Vacation Requests by Startdate, Ascending
               SortedDivisionVacationRequestList = DivisionVacationRequestList.OrderBy(c => c.getVacationStartDate()).ToList();
            }
            return SortedDivisionVacationRequestList;
        }
コード例 #2
0
        public List<EmployeeVacationRequestViewItem> GetVacationRequests()
        {
            String currentUserId = User.Identity.GetUserId();

            List<GUIManagement.EmployeeVacationRequestViewItem> resultList = new List<GUIManagement.EmployeeVacationRequestViewItem>();
            DBQuery dbq = new DBQuery();

            List<VacationManagement.VacationRequest> vacationRequestList = dbq.SelectAllVacationRequestsOfEmployee(currentUserId);

            String shiftPartnerID = dbq.SelectShiftPartner(currentUserId);
            String shiftParterName = "-";

            if (shiftPartnerID != null)
            {
                Employee shiftPartner = dbq.SelectDeputy(currentUserId);
                shiftParterName = dbq.SelectEmployeeFullName(shiftPartner.getEmployeeID());
            }

            foreach (VacationManagement.VacationRequest vr in vacationRequestList)
            {
                var employeeVacationRequest = new GUIManagement.EmployeeVacationRequestViewItem(vr, shiftParterName);
                resultList.Add(employeeVacationRequest);
            }
            return resultList;
        }
コード例 #3
0
        // GET: VacationReplacementRequests
        public ActionResult Index()
        {
            // identify logged-in user
            String currentUserId = User.Identity.GetUserId();

            DBQuery dbq = new DBQuery();
            var ReplacementReqList = new List<GUIManagement.VacationReplacementRequestViewItem>();

            String shiftPartnerID = dbq.SelectShiftPartner(currentUserId);

            if (shiftPartnerID != null)
            {
                var VRList = dbq.SelectSubmittedVacationRequestsOfShiftPartner(shiftPartnerID);
                String name = dbq.SelectEmployeeFullName(shiftPartnerID);

                foreach (VacationManagement.VacationRequest vr in VRList)
                {
                    GUIManagement.VacationReplacementRequestViewItem vrr = new GUIManagement.VacationReplacementRequestViewItem(vr, name);
                    ReplacementReqList.Add(vrr);
                }
            }
            else
            {
                // Labelausgabe GUI

            }
            return View(ReplacementReqList);
        }