예제 #1
0
        public ActionResult CreateEventDate(EventDateViewModel Model)
        {
            tblEventDate EventDate = new tblEventDate();

            if (ModelState.IsValid)
            {
                EventDate = Model.As_tblEventDate();
                _ODB.tblEventDates.AddObject(EventDate);
                _ODB.SaveChanges();
                this.ShowPageMessage(String.Format("The event date for '{0}' was created successfully.", EventDate.DateOfEvent.ToShortDateString()));
            }
            else
            {
                this.ShowPageError(DataConstants.ModelStateInvalidError);
                tblEvent existingEvent = _ODB.tblEvents.Where(e => e.ID == Model.EventID).SingleOrDefault();
                if (existingEvent != null)
                {
                    return(View("Event", new EventViewModel(existingEvent)));
                }
                else
                {
                    this.ShowPageError(DataConstants.ModelStateInvalidError + " Also, an event could not be found for the given Event ID.");
                    return(this.RedirectToAction <EventsController>(c => c.Index()));
                }
            }

            SecureAccess.Utilities.Logging.Log(SecureAccess.Utilities.Logging.LogType.Audit, String.Format("User {0} created an event date with ID {1}; Date: '{2}.'", Current.User.Username, EventDate.ID, EventDate.DateOfEvent.ToShortDateString()));
            return(this.RedirectToAction <EventsController>(c => c.Event(EventDate.EventID)));
        }
예제 #2
0
 public void Init()
 {
     EventDateViewModel.ClearDict();
     h      = session.Load <HealthRecord>(IntToGuid <HealthRecord>(1));
     emptyH = session.Load <HealthRecord>(IntToGuid <HealthRecord>(71));
     vm     = EventDateViewModel.FromHr(h);
 }
예제 #3
0
        public void EmptySetAge()
        {
            var vm = EventDateViewModel.FromHr(emptyH);

            vm.AtAge = 5;

            Assert.AreEqual(EventDateViewModel.ShowAs.AtAge, vm.FirstSet);
        }
예제 #4
0
        public void EmptySetOffset()
        {
            var vm = EventDateViewModel.FromHr(emptyH);

            vm.Offset = 5;

            Assert.AreEqual(EventDateViewModel.ShowAs.Offset, vm.FirstSet);
        }
예제 #5
0
        public void EmptySetToMonth()
        {
            var vm = EventDateViewModel.FromHr(emptyH);

            vm.to.Month = 5;

            Assert.AreEqual(EventDateViewModel.ShowAs.Date, vm.FirstSet);
        }
예제 #6
0
 public void Clean()
 {
     EventDateViewModel.ClearDict();
     if (vm != null)
     {
         vm.Dispose();
     }
 }
예제 #7
0
        public void EmptySetUnit()
        {
            var vm = EventDateViewModel.FromHr(emptyH);

            vm.Unit = DateUnit.Month;

            Assert.IsTrue(vm.IsEmpty);
            Assert.AreEqual(null, vm.FirstSet);
        }
예제 #8
0
        public ActionResult SaveEventDate(EventDateViewModel Model)
        {
            tblEventDate existingEventDate = _ODB.tblEventDates.Where(e => e.ID == Model.ID).SingleOrDefault();

            if (existingEventDate != null)
            {
                if (ModelState.IsValid)
                {
                    existingEventDate.ConfirmationEmailID = Model.ConfirmationEmailID;
                    existingEventDate.ReminderEmailID     = Model.ReminderEmailID;
                    existingEventDate.DateOfEvent         = Model.DateOfEvent;
                    existingEventDate.EventDateType       = Model.EventDateType;
                    existingEventDate.EventID             = Model.EventID;
                    existingEventDate.ID                        = Model.ID;
                    existingEventDate.IsEnabled                 = Model.IsEnabled;
                    existingEventDate.MaxNumberOfStudents       = Model.MaxNumberOfStudents;
                    existingEventDate.AutomaticallyClearSOHolds = Model.AutomaticallyClearSOHolds;
                    existingEventDate.Description               = Model.Description;
                    existingEventDate.AllowGuestRegistration    = Model.AllowGuestRegistration;
                    existingEventDate.MaxNumberGuests           = Model.MaxNumberGuests;
                    existingEventDate.CostPerGuest              = Model.CostPerGuest;
                    existingEventDate.UpdateSGBSTDN_ORSN        = Model.UpdateORSN;
                    existingEventDate.HideEventDate             = Model.HideEventDate;
                    _ODB.SaveChanges();
                    this.ShowPageMessage(String.Format("Event Date '{0}' was updated successfully.", existingEventDate.DateOfEvent.ToShortDateString()));
                    SecureAccess.Utilities.Logging.Log(SecureAccess.Utilities.Logging.LogType.Audit, String.Format("User {0} updated Event Date {1}.", Current.User.Username, existingEventDate.ID));
                    return(this.RedirectToAction <EventsController>(c => c.Event(existingEventDate.EventID)));
                }
                else
                {
                    tblEvent existingEvent = _ODB.tblEvents.Where(e => e.ID == Model.EventID).SingleOrDefault();
                    if (existingEvent != null)
                    {
                        return(View("Event", new EventViewModel(existingEvent)));
                    }
                    else
                    {
                        this.ShowPageError(DataConstants.ModelStateInvalidError + " Also, an event could not be found for the given Event ID.");
                        return(this.RedirectToAction <EventsController>(c => c.Index()));
                    }
                }
            }
            else
            {
                this.ShowPageError("An event could not be found for the given Event ID.");
                return(this.RedirectToAction <EventsController>(c => c.Index()));
            }
        }
예제 #9
0
        /// <summary>
        /// Displays Event Date Details
        /// </summary>
        /// <param name="ID">Event Date ID</param>
        /// <returns>ActionResult</returns>
        public ActionResult EventDate(int ID)
        {
            tblEventDate       EventDate = _ODB.tblEventDates.Where(e => e.ID == ID).SingleOrDefault();
            EventDateViewModel Model     = new EventDateViewModel();

            if (EventDate != null)
            {
                Model = new EventDateViewModel(EventDate);
            }
            else
            {
                this.ShowPageError(string.Format("An event date could not be found for the given ID {0}", ID));
            }

            return(View(Model));
        }
예제 #10
0
        public DateEditorViewModel(HealthRecord hr)
        {
            Contract.Requires(hr != null);
            this.healthRecord            = hr;
            hr.FromDate.PropertyChanged += FromDate_PropertyChanged;

            healthRecord.PropertyChanged += healthRecord_PropertyChanged;

            EventDate = EventDateViewModel.FromHr(healthRecord);
            EventDate.PropertyChanged += EventDateVm_PropertyChanged;
            DateSuggestions            = new ObservableCollection <DateSuggestion>();

            IsIntervalEditorOpened = hr.FromDate != hr.ToDate;

            SetupDateSuggsetions();
        }
예제 #11
0
        /// <summary>
        /// Sends Event Date Reminder for the selected Event Date
        /// </summary>
        /// <param name="ID">Event Date ID</param>
        /// <returns>ActionResult</returns>
        public ActionResult EventDateReminder(int ID)
        {
            tblEventDate       EventDate = _ODB.tblEventDates.Where(e => e.ID == ID).SingleOrDefault();
            EventDateViewModel Model     = new EventDateViewModel();

            if (EventDate != null)
            {
                Notifications.EventDateReminder(EventDate);
                this.ShowPageMessage(string.Format("Sending reminder for Event Date: '{0}' taking place on {1} to confirmed reservations.", EventDate.Description, EventDate.DateOfEvent.ToShortDateString()));
                return(this.RedirectToAction <EventsController>(c => c.Event(EventDate.EventID)));
            }
            else
            {
                this.ShowPageError(string.Format("An event date could not be found for the given ID {0}", ID));
            }

            return(this.RedirectToAction <EventsController>(c => c.Index()));
        }
예제 #12
0
        public ShortHealthRecordViewModel(HealthRecord hr)
        {
            Contract.Requires(hr != null);
            this.healthRecord = hr;

            patient = hr.GetPatient();
            patient.PropertyChanged += patient_PropertyChanged;

            healthRecord.PropertyChanged += healthRecord_PropertyChanged;
            healthRecord.ItemsChanged    += healthRecord_ItemsChanged;

            SyncCheckedAndSelected = true;
            EventDate = EventDateViewModel.FromHr(healthRecord);
            EventDate.PropertyChanged += (s, e) =>
            {
                OnPropertyChanged(() => EventDateString);
            };
            DropHandler         = new DropTargetHandler(this);
            IsDropTargetEnabled = true;
        }