public frmFacBookingDetails(User u, Events e, EventDay d,List<Facility> m)
     : this()
 {
     this.user = u;
     this.models = m;
     this.event_ = e;
     this.eventDay_ = d;
 }
Exemplo n.º 2
0
 public ExportData(Events evnt, EventDay[] days, Task[] tasks, FacilityBookingConfirmed[][] facilities, Program[][] programs, Guest[][] guests, Participant[] participants
     , OptimizedBudgetItems optitems, BudgetIncome[] budgetincomes, Field[] field)
 {
     this.evnts = evnt;
     this.days = days;
     this.tasks = tasks;
     this.facilities = facilities;
     this.programs = programs;
     this.guests = guests;
     this.participants = participants;
     this.optitems = optitems;
     this.budgetincomes = budgetincomes;
     this.field = field;
 }
Exemplo n.º 3
0
        public static void DeleteDay(EventDay d, DAL dalDataContext)
        {
            try
            {
                EventDay matchedday = (from days in dalDataContext.days
                                  where days.DayID == d.DayID
                                  select days).FirstOrDefault();

                dalDataContext.days.DeleteOnSubmit(matchedday);
                dalDataContext.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(ex.Message),
                   new FaultReason("An Error occured While Deleting Day, Please Try Again!"));
            }
        }
Exemplo n.º 4
0
        public frmOverview_Old(User u, Events e, EventDay evd, Events pEvent)
            : this()
        {
            this.user = u;
            this.event_ = e;
            this.eventday_ = evd;

            if (e != null && evd != null && (pEvent == null || pEvent.EventID != e.EventID))
            {
                //when evd and e are not null, pEvent not null or pEvent ID is not equal to EID
                loadEventItems();

            }
            else if (e != null && evd != null && e.EventID == evd.EventID)
            {
                //when both id are the same
                loadDayItems();
            }
        }
Exemplo n.º 5
0
        public static void AddDay(int EventID, int EventDay)
        {
            try
            {
                DAL dalDataContext = new DAL();
                Table<EventDay> days = dalDataContext.days;

                EventDay creatingday = new EventDay(EventID, EventDay);

                days.InsertOnSubmit(creatingday);

                days.Context.SubmitChanges();

            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Day, Please Try Again!"));
            }
        }
Exemplo n.º 6
0
        public void loadFacilityBookings(EventDay day)
        {
            FacilityBookingsHelper client = new FacilityBookingsHelper();
            List<FacilityBookingConfirmed> fbc = client.GetConfirmedFacBookings(day.EventID,
                day.StartDateTime.Date).ToList<FacilityBookingConfirmed>();

            if (fbc.Count == 0)
            {
                txtLocationMsg.Text = "The venue to hold the event is not confirmed yet";
            }
            else
            {
                txtLocationMsg.Text = "The venue to hold this event are (is) " + Environment.NewLine;
                foreach (FacilityBookingConfirmed confirmedReq in fbc)
                {
                    txtLocationMsg.Text += confirmedReq.Faculty.ToString().Replace('_', ' ') + " " + " at " + confirmedReq.Venue
                        + "  booked from " + confirmedReq.RequestStartDateTime.ToString("HH:mm")
                        + " to " + confirmedReq.RequestEndDateTime.ToString("HH:mm") + Environment.NewLine
                        ;

                }
            }
            client.Close();
        }
Exemplo n.º 7
0
        public static bool AddBookingRequest(User sender, EventDay evntDay, DateTime reqStart,
            DateTime reqEnd, Faculties fac, List<FacilityBookingRequestDetails> reqDetails)
        {
            if (sender.isFacilityAdmin ||
                sender.isAuthorized(EventController.GetEvent(evntDay.EventID),
                EnumFunctions.Manage_Facility_Bookings))//, EnumFunctions.ManageFacBookings))
            {
                bool success;
                try
                {
                    //request start > evnt.StartDateTime do not check, can book earlier...
                    if (reqStart.AddHours(2) < evntDay.StartDateTime)
                    {
                        throw new FaultException<SException>(new SException(),
                      new FaultReason("You cannot book a facility more than 2hours before your event start time"));
                    }

                    if (reqEnd.AddHours(-2) > evntDay.EndDateTime)
                    {
                        throw new FaultException<SException>(new SException(),
                      new FaultReason("You cannot book a facility for more than 2 hours after your event end time"));
                    }

                    if (reqEnd.Date != reqStart.Date)
                    {
                        if (reqEnd.Date == reqStart.Date.AddDays(1) && reqEnd.Hour == 0 && reqEnd.Minute == 0 && reqEnd.Second == 0)
                        {
                            reqEnd = reqEnd.AddSeconds(-1);
                        }
                        else
                        {
                            throw new FaultException<SException>(new SException(),
                                new FaultReason("You cannot book a across multiple days"));
                        }
                    }

                    DAL dalDataContext = new DAL();
                    Table<FacilityBookingRequest> facReq = dalDataContext.facBookReqs;
                    using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required))
                    {
                        FacilityBookingRequest f = new FacilityBookingRequest(evntDay.EventID,
                            sender.UserID, reqStart, reqEnd, fac);
                        facReq.InsertOnSubmit(f);
                        facReq.Context.SubmitChanges();

                        f = (from req in dalDataContext.facBookReqs
                             where req.EventID == evntDay.EventID &&
                             req.RequestorID == sender.UserID
                             orderby req.BookingTime descending
                             select req).FirstOrDefault<FacilityBookingRequest>();

                        success = FaciReqDetailsController.AddFacilityBookingReqDetails(f.RequestID, reqDetails);
                        tScope.Complete();
                    }
                }
                catch (Exception ex)
                {
                    throw new FaultException<SException>(new SException(),
                      new FaultReason("An Error occured While Adding Booking Request: " + ex.Message));
                }
                if (success)
                {

                    string msg = sender.Name + " has sent you a facility booking request for "
                                    + EventController.GetEvent(evntDay.EventID).Name +
                                     Environment.NewLine + Environment.NewLine +
                                    " Please check the Facility Requests for more details.";

                    string title = "New Facility Booking Request";
                    string facAdmin = SysRoleController.GetFacilityAdmin(fac);

                    NotificationController.sendNotification(sender.UserID, facAdmin, title, msg);
                }
                return success;
            }
            else
            {
                throw new FaultException<SException>(new SException(),
                    new FaultReason("User is not authorized to add a facility booking request!"));
            }
        }
 public frmProgramManagement(User u, EventDay day)
     : this()
 {
     this.user = u;
     this.eventDay_ = day;
 }
 //Create the list on the client
 public static bool AddBookingRequest(User user, EventDay evntDay, DateTime reqStart,
     DateTime reqEnd, Faculties fac, List<FacilityBookingRequestDetails> reqDetails)
 {
     return FaciRequestController.AddBookingRequest(user, evntDay, reqStart, reqEnd, fac, reqDetails);
 }
Exemplo n.º 10
0
        private void createDays(DateTime EventStartDateTime, DateTime EventEndDatetime)
        {
            days.Clear();

            DateTime current_date = EventStartDateTime;
            int day = 1;
            do
            {
                EventDay tempday = new EventDay();
                tempday.DayNumber = day;

                days.Add(tempday);
                //programs.Add(new List<Program>());
                //guests.Add(new List<Guest>());

                day++;

                current_date = current_date.Date;
                current_date = current_date.AddDays(1);
            } while (current_date < EventEndDatetime);
        }
Exemplo n.º 11
0
        private void loadPrograms(EventDay d)
        {
            try
            {

                DateTime curr = GetStartDateTime(d);
                DateTime end = GetEndDateTime(d);

                List<Program> progList = _programs[d.DayNumber - 1];
                List<Program> newprogList = new List<Program>();
                while (curr.CompareTo(end) < 0)
                {
                    for (int i = 0; i < progList.Count; i++)
                    {
                        if (progList[i].StartDateTime.CompareTo(curr) == 0)
                        {
                            newprogList.Add(progList[i]);
                            curr = progList[i].EndDateTime;

                            goto next;
                        }
                    }

                    Program p = new Program();
                    p.Name = "";
                    p.StartDateTime = curr;
                    p.EndDateTime = curr.AddMinutes(30);
                    newprogList.Add(p);
                    curr = curr.AddMinutes(30);

                next:
                    continue;

                }
                //lstProgram.SelectedIndex = -1;
                lstProgram.ItemsSource = newprogList.OrderBy(x => x.StartDateTime)
                                                 .ThenBy(x => x.EndDateTime).ToList<Program>();
                lstProgram_SelectionChanged(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 12
0
 private DateTime GetStartDateTime(EventDay d)
 {
     if(d.DayNumber == 1)
         return _event.StartDateTime;
     DateTime dt = _event.StartDateTime.AddDays(d.DayNumber - 1).Date;
     return dt;
 }
Exemplo n.º 13
0
 private DateTime GetEndDateTime(EventDay d)
 {
     if (d.DayNumber == _day.Count)
         return _event.EndDateTime;
     DateTime dt = _event.StartDateTime.AddDays(d.DayNumber).Date;
     return dt;
 }
Exemplo n.º 14
0
 public frmGuestList(User u, EventDay day)
     : this()
 {
     this.user = u;
     this.eventDay_ = day;
 }