Пример #1
0
 public static List<PrebookedEvent> GetAll(string staffUsername, int stage, bool isAdHoc)
 {
     List<PrebookedEvent> output = new List<PrebookedEvent>();
     string sql = string.Format("SELECT * FROM REQ_PrebookedEvents WHERE StaffUsername='******' AND Stage={1} AND IsAdHoc='{2}'",
         staffUsername, stage, isAdHoc.ToString());
     using (SqlConnection conn = UtilityDb.GetConnectionESS())
     {
         SqlDataReader dr = UtilityDb.GetDataReader(sql, conn);
         while (dr.Read())
         {
             PrebookedEvent obj = new PrebookedEvent();
             obj.LoadFromReader(dr);
             output.Add(obj);
         }
     }
     return output;
 }
Пример #2
0
 internal static List<PrebookedEvent> getByUsername(string Username)
 {
     List<PrebookedEvent> output = new List<PrebookedEvent>();
     string sql = string.Format("SELECT * FROM REQ_PrebookedEvents Where UPPER(StaffUsername)='{0}'", Username.ToUpper());
     using (SqlConnection conn = UtilityDb.GetConnectionESS())
     {
         SqlDataReader dr = UtilityDb.GetDataReader(sql, conn);
         while (dr.Read())
         {
             PrebookedEvent obj = new PrebookedEvent();
             obj.LoadFromReader(dr);
             output.Add(obj);
         }
     }
     return output;
 }
Пример #3
0
 internal static List<PrebookedEvent> getByEventID(int SelectedID)
 {
     List<PrebookedEvent> output = new List<PrebookedEvent>();
     string sql = string.Format("SELECT * FROM REQ_PrebookedEvents Where EventID={0}", SelectedID);
     using (SqlConnection conn = UtilityDb.GetConnectionESS())
     {
         SqlDataReader dr = UtilityDb.GetDataReader(sql, conn);
         while (dr.Read())
         {
             PrebookedEvent obj = new PrebookedEvent();
             obj.LoadFromReader(dr);
             output.Add(obj);
         }
     }
     return output;
 }
Пример #4
0
 public static List<PrebookedEvent> GetAllListing(string staffUsername, int? SelectedYear)
 {
     List<PrebookedEvent> output = new List<PrebookedEvent>();
     string sql = string.Format("SELECT * FROM REQ_PrebookedEvents WHERE StaffUsername='******'",
         staffUsername);
     //if (SelectedYear.HasValue)
     //    sql += " AND YEAR(RequestDate)=" + SelectedYear.Value;
     using (SqlConnection conn = UtilityDb.GetConnectionESS())
     {
         SqlDataReader dr = UtilityDb.GetDataReader(sql, conn);
         while (dr.Read())
         {
             PrebookedEvent obj = new PrebookedEvent();
             obj.LoadFromReader(dr);
             output.Add(obj);
         }
     }
     return output;
 }
Пример #5
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;
     }
 }
Пример #6
0
        public void LoadAll(TrainingType Type, string TrainingName, BookedEvent booked, PrebookedEvent prebooked)
        {
            Staff staff = new Staff();
            Staff supervisor = new Staff();
            switch (Type)
            {
                case TrainingType.Prebook:
                    DateRequest = prebooked.RequestDate;
                    staff = Staff.getStaffInfo(prebooked.StaffUsername);
                    if (staff != null)
                    {
                        StaffID = staff.StaffID;
                        StaffName = staff.Name;
                    }
                    supervisor = Staff.GetSupervisorByUsername(prebooked.StaffUsername);
                    if (supervisor != null)
                    {
                        SupervisorName = supervisor.Name.ToUpper();
                    }
                    else
                    {
                        SupervisorName = "NOT DEFINED";
                    }
                    ApplicationType = "PREBOOK";
                    Title = TrainingName.ToUpper();
                    Status = getTrainingStatus(prebooked.Stage, prebooked.SAPStatus, TrainingType.Prebook);
                    if (prebooked.SAPStatus == 1)
                        PostedSAPStatus = "PENDING";
                    if (prebooked.SAPStatus == 2)
                        PostedSAPStatus = "POSTED";
                    break;
                case TrainingType.Book:
                    DateRequest = booked.RequestDate;
                    staff = Staff.getStaffInfo(booked.StaffUsername);
                    if (staff != null)
                    {
                        StaffID = staff.StaffID;
                        StaffName = staff.Name;
                    }
                    supervisor = Staff.GetSupervisorByUsername(booked.StaffUsername);
                    if (supervisor != null)
                    {
                        SupervisorName = supervisor.Name.ToUpper();
                    }
                    else
                    {
                        SupervisorName = "NOT DEFINED";
                    }
                    ApplicationType = "BOOK";
                    Title = TrainingName.ToUpper();
                    Status = getTrainingStatus(booked.Stage, booked.SAPStatus, TrainingType.Book);

                    if (booked.SAPStatus == 0)
                        PostedSAPStatus = "PENDING";
                    if (booked.SAPStatus == 2)
                        PostedSAPStatus = "POSTED";
                    break;
            }
        }