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);
                    }

                }
            }
        }
 //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);
     }
 }
Exemple #3
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);
         }
     }
 }