Exemplo n.º 1
0
 //for filter by Training status
 private static void LoadObjectForStatus(TrainingType Type, ref List<Listing> output, string SelectedValue, BookedEvent bk, PrebookedEvent pk)
 {
     Listing newList = new Listing();
     Staff staff = new Staff();
     Staff supervisor = new Staff();
     string TrainingName = "";
     switch (Type)
     {
         case TrainingType.Book:
             staff = Staff.getStaffInfo(bk.StaffUsername);
             if (staff != null)
             {
                 newList.StaffID = staff.StaffID;
                 newList.StaffName = staff.Name.ToUpper();
             }
             supervisor = Staff.GetSupervisorByUsername(staff.Username);
             if (supervisor != null)
             {
                 newList.SupervisorName = supervisor.Name.ToUpper();
             }
             else
             {
                 newList.SupervisorName = "NOT DEFINED";
             }
             newList.ApplicationType = "BOOK";
             TrainingName = EventGroup.getTitle(bk.EventId);
             if (TrainingName != null || TrainingName != "")
                 newList.Title = TrainingName.ToUpper();
             newList.DateRequest = bk.RequestDate;
             newList.Status = SelectedValue.ToUpper();
             if (bk.SAPStatus == 0)
                 newList.PostedSAPStatus = "PENDING";
             if (bk.SAPStatus == 2)
                 newList.PostedSAPStatus = "POSTED";
             output.Add(newList);
             break;
         case TrainingType.Prebook:
             staff = Staff.getStaffInfo(pk.StaffUsername);
             if (staff != null)
             {
                 newList.StaffID = staff.StaffID;
                 newList.StaffName = staff.Name.ToUpper();
             }
             supervisor = Staff.GetSupervisorByUsername(staff.Username);
             if (supervisor != null)
             {
                 newList.SupervisorName = supervisor.Name.ToUpper();
             }
             else
             {
                 newList.SupervisorName = "NOT DEFINED";
             }
             newList.ApplicationType = "PREBOOK";
             TrainingName = EventGroup.getTitle(pk.EventId);
             if (TrainingName != null || TrainingName != "")
                 newList.Title = TrainingName.ToUpper();
             newList.DateRequest = pk.RequestDate;
             newList.Status = SelectedValue.ToUpper();
             if (pk.SAPStatus == 0)
                 newList.PostedSAPStatus = "PENDING";
             if (pk.SAPStatus == 2)
                 newList.PostedSAPStatus = "POSTED";
             output.Add(newList);
             break;
     }
 }
Exemplo n.º 2
0
        protected static void getbyFilterWorkflow(string SelectedValue, ref List<Listing> output)
        {
            if (SelectedValue == "NOT DEFINED")
            {
                List<BookedEvent> bkEventsLst = BookedEvent.GetAll();
                List<PrebookedEvent> pbkEventsLst = PrebookedEvent.GetAll();
                foreach (BookedEvent bk in bkEventsLst)
                {
                    Staff supervisor = Staff.GetSupervisorByUsername(bk.StaffUsername);
                    Listing newBookedList = new Listing();
                    if (supervisor == null)
                    {
                        string TrainingName = EventGroup.getTitle(bk.EventId);
                        newBookedList.LoadAll(TrainingType.Book, TrainingName, bk, null);
                        output.Add(newBookedList);
                    }
                }
                foreach (PrebookedEvent pk in pbkEventsLst)
                {
                    Staff supervisor = Staff.GetSupervisorByUsername(pk.StaffUsername);
                    Listing newPrebookList = new Listing();
                    if (supervisor == null)
                    {
                        string TrainingName = EventGroup.getTitle(pk.EventId);
                        newPrebookList.LoadAll(TrainingType.Prebook, TrainingName, null, pk);
                        output.Add(newPrebookList);
                    }

                }
            }
        }
Exemplo n.º 3
0
 //for filter by Training SAP status
 private static void BindToObjectSAPStatus(ref List<Listing> output, string SelectedValue, List<BookedEvent> bkEventsLst, List<PrebookedEvent> pbkEventsLst)
 {
     foreach (BookedEvent booked in bkEventsLst)
     {
         Listing newBookedList = new Listing();
         string TrainingName = EventGroup.getTitle(booked.EventId);
         switch (booked.SAPStatus)
         {
             case 0:
                 if (SelectedValue == "SAVED")
                     newBookedList.LoadAll(TrainingType.Book, TrainingName, booked, null);
                 break;
             case 1:
                 if (SelectedValue == "APPLIED")
                     newBookedList.LoadAll(TrainingType.Book, TrainingName, booked, null);
                 break;
             case 2:
                 if (SelectedValue == "APPROVED SV")
                     newBookedList.LoadAll(TrainingType.Book, TrainingName, booked, null);
                 break;
             case 3:
                 if (SelectedValue == "APPROVED HR")
                     newBookedList.LoadAll(TrainingType.Prebook, TrainingName, booked, null);
                 break;
         }
         output.Add(newBookedList);
     }
     foreach (PrebookedEvent prebooked in pbkEventsLst)
     {
         Listing newPrebookList = new Listing();
         string TrainingName = EventGroup.getTitle(prebooked.EventId);
         switch (prebooked.SAPStatus)
         {
             case 0:
                 if (SelectedValue == "SAVED")
                     newPrebookList.LoadAll(TrainingType.Prebook, TrainingName, null, prebooked);
                 break;
             case 1:
                 if (SelectedValue == "APPLIED")
                     newPrebookList.LoadAll(TrainingType.Prebook, TrainingName, null, prebooked);
                 break;
             case 2:
                 if (SelectedValue == "APPROVED SV")
                     newPrebookList.LoadAll(TrainingType.Prebook, TrainingName, null, prebooked);
                 break;
         }
         output.Add(newPrebookList);
     }
 }
Exemplo n.º 4
0
 public static void BindToObject(ref List<Listing> output, Staff staff, List<BookedEvent> bkEventsLst, List<PrebookedEvent> pbkEventsLst, Mode mode, bool IsUnapproved)
 {
     foreach (BookedEvent booked in bkEventsLst)
     {
         string TrainingName = EventGroup.getTitle(booked.EventId);
         if (!string.IsNullOrEmpty(TrainingName) || TrainingName != "")
         {
             Listing newBookedList = new Listing();
             if (mode == Mode.Admin)
                 newBookedList.LoadAll(TrainingType.Book, TrainingName, booked, null);
             if (mode == Mode.Staff)
             {
                 AttendedEvent ae = AttendedEvent.GetByEventDateIDAndUsername(booked.EventDateId, booked.StaffUsername);
                 string CEF = "";
                 if (ae.EventDateId != 0 && ae.StaffUsername != null)
                 {
                     if (CheckCompletedPTA(ae.EventDateId, ae.StaffUsername))
                         CEF = "COMPLETED";
                     else
                         CEF = "NOT COMPLETED";
                 }
                 else
                 {
                     CEF = "NOT COMPLETED";
                 }
                 newBookedList.LoadbyStaff(staff, TrainingType.Book, TrainingName, booked.Stage, booked.SAPStatus, booked.RequestDate, booked.RequesterUsername, IsUnapproved, CEF);
             }
             output.Add(newBookedList);
         }
     }
     foreach (PrebookedEvent prebooked in pbkEventsLst)
     {
         string CEF = "N/A";
         string TrainingName = EventGroup.getTitle(prebooked.EventId);
         if (!string.IsNullOrEmpty(TrainingName) || TrainingName != "")
         {
             Listing newPrebookList = new Listing();
             if (mode == Mode.Admin)
                 newPrebookList.LoadAll(TrainingType.Prebook, TrainingName, null, prebooked);
             if (mode == Mode.Staff)
                 newPrebookList.LoadbyStaff(staff, TrainingType.Prebook, TrainingName, prebooked.Stage, prebooked.SAPStatus, prebooked.RequestDate, prebooked.RequesterUsername, IsUnapproved, CEF);
             output.Add(newPrebookList);
         }
     }
 }