Ejemplo n.º 1
0
        void InsertAppointment()
        {
            ValidationSchedule schedule = SchedulerDataHelper.GetAppointmentToInsert <ValidationSchedule>(
                SchedulerDataHelper.CustomDataObject, SchedulerDemoHelper.CustomAppointmentStorage);

            if (schedule != null && TryValidateModel(schedule))
            {
                CarsDataProvider.InsertSchedule <ValidationSchedule>(schedule);
            }
            else
            {
                ViewData["EditableSchedule"] = schedule;
            }
        }
Ejemplo n.º 2
0
    public override void Assign(ScheduleBase source)
    {
        base.Assign(source);
        ValidationSchedule validationSchedule = source as ValidationSchedule;

        if (validationSchedule != null)
        {
            Subject     = validationSchedule.Subject;
            Price       = validationSchedule.Price;
            StartTime   = validationSchedule.StartTime;
            EndTime     = validationSchedule.EndTime;
            Description = validationSchedule.Description;
            ContactInfo = validationSchedule.ContactInfo;
        }
    }
        public static SchedulerSettings CreateSchedulerSettings(this HtmlHelper htmlHelper)
        {
            SchedulerSettings settings = new SchedulerSettings();

            settings.Name = "scheduler";
            settings.CallbackRouteValues        = new { Controller = "Home", Action = "SchedulerPartial" };
            settings.EditAppointmentRouteValues = new { Controller = "Home", Action = "EditAppointment" };

            settings.Storage.Appointments.Assign(DefaultAppointmentStorage);
            settings.Storage.Resources.Assign(DefaultResourceStorage);

            settings.AppointmentFormShowing = (sender, e) => {
                MVCxScheduler scheduler = sender as MVCxScheduler;
                if (scheduler != null)
                {
                    e.Container = new CustomAppointmentFormTemplateContainer(scheduler);
                }
            };

            settings.OptionsForms.SetAppointmentFormTemplateContent(c => {
                CustomAppointmentFormTemplateContainer container = (CustomAppointmentFormTemplateContainer)c;
                ValidationSchedule schedule = new ValidationSchedule()
                {
                    ID        = container.Appointment.Id == null ? -1 : (int)container.Appointment.Id,
                    Subject   = container.Appointment.Subject,
                    StartTime = container.Appointment.Start,
                    EndTime   = container.Appointment.End,
                    Price     = container.Price,
                };

                htmlHelper.ViewData["DeleteButtonEnabled"] = container.CanDeleteAppointment;

                htmlHelper.RenderPartial("CustomAppointmentFormPartial", schedule);
            });

            settings.Storage.Appointments.ResourceSharing = true;
            settings.Start = new DateTime(2008, 7, 11);
            return(settings);
        }