Example #1
0
        private void ConfigureLightBox(DHXScheduler scheduler, List <ResourceViewModel> rooms)
        {
            var name = new LightboxText("text", "Name");

            name.Height = 24;
            scheduler.Lightbox.Add(name);

            var roomsSelect = new LightboxSelect("room_number", "Room");

            roomsSelect.AddOptions(rooms.ToList());
            scheduler.Lightbox.Add(roomsSelect);

            //var status = new LightboxRadio("status", "Status");
            //var statuses = new List<object>(); // new Repository<BookingStatus>().ReadAll().Select(s => new { key = s.Id, label = s.Title });
            //status.AddOptions(statuses);
            //scheduler.Lightbox.Add(status);
            //scheduler.InitialValues.Add("status", statuses.First().key);

            var isPaid = new LightboxCheckbox("is_paid", "Paid");

            scheduler.Lightbox.Add(isPaid);
            scheduler.InitialValues.Add("is_paid", false);

            var date = new LightboxMiniCalendar("time", "Time");

            scheduler.Lightbox.Add(date);


            scheduler.InitialValues.Add("text", String.Empty);
        }
        /// <summary>
        /// applying client side filters for each view
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var scheduler = new DHXScheduler();

            var rooms = new DHXSchedulerDataContext().Rooms.ToList();

            //each view can have multiple rules
            //they also can be added on the client
            scheduler.Views[1].Filter.Rules.Add(//month
                new Rule("start_date", Operator.GreaterOrEqual, new DateTime(2011, 9, 6))
            );
            scheduler.Views[1].Filter.Rules.Add(
                new Rule("end_date", Operator.LowerOrEqual, new DateTime(2011, 9, 14))
            );

            scheduler.Views[2].Filter.Rules.Add(//day
                new Rule("room_id", Operator.Equals, rooms.First().key)
            );
            scheduler.Views[2].Filter.Rules.Add(//day
                new ExpressionRule("{text}.length > 4 && {text}.length < 20")
            );

            var select = new LightboxSelect("room_id", "Room");
            select.AddOptions(rooms);
            scheduler.Lightbox.AddDefaults();
            scheduler.Lightbox.Add(select);

            scheduler.Controller = "BasicScheduler";//using BasicSchedulerController to load data
            scheduler.LoadData = true;
            scheduler.InitialDate = new DateTime(2011, 9, 7);
            return View(scheduler);
        }
    protected void _ConfigureLightbox(DHXScheduler scheduler, IEnumerable cars, IEnumerable locations, IEnumerable users, IEnumerable trangthais)
    {
        scheduler.Lightbox.Add(new LightboxText("text", "Ghi chú")
        {
            Height = 42, Focus = true
        });

        var select = new LightboxSelect("carid", "Tên Xe");

        scheduler.Lightbox.Add(select);
        var select2 = new LightboxSelect("pick_location", "Địa điểm nhận xe");

        scheduler.Lightbox.Add(select2);
        var select3 = new LightboxSelect("drop_location", "Địa điểm trả xe");

        scheduler.Lightbox.Add(select3);
        var select4 = new LightboxSelect("userid", "Khách hàng thuê");

        scheduler.Lightbox.Add(select4);
        var select5 = new LightboxSelect("tinh_trang", "Trạng thái thuê xe");

        scheduler.Lightbox.Add(select5);

        select.AddOptions(cars);
        select2.AddOptions(locations);
        select3.AddOptions(locations);
        select4.AddOptions(users);
        select5.AddOptions(trangthais);

        scheduler.Lightbox.Add(new LightboxTime("time", "Thời gian thuê"));
    }
        /// <summary>
        /// Add resources views - units and timeline
        /// </summary>
        /// <returns></returns>
        public ActionResult MultipleResources()
        {
            var scheduler = new DHXScheduler(this);
            scheduler.Skin = DHXScheduler.Skins.Terrace;
            var rooms = new DHXSchedulerModelsDataContext().Rooms.ToList();

            scheduler.Views.Clear();
            scheduler.Views.Add(new MonthView());

            var unit = new UnitsView("unit", "room_id");
            unit.AddOptions(rooms);//parse model objects
            scheduler.Views.Add(unit);

            var timeline = new TimelineView("timeline", "room_id");
            timeline.RenderMode = TimelineView.RenderModes.Bar;
            timeline.FitEvents = false;
            timeline.AddOptions(rooms);
            scheduler.Views.Add(timeline);

            //show timeline view by default
            scheduler.InitialView = timeline.Name;

            scheduler.Lightbox.AddDefaults();//add default set of options - text and timepicker
            //add controls to the details form
            var select = new LightboxSelect("room_id", "Room id");
            select.AddOptions(rooms);
            scheduler.Lightbox.Add(select);

            scheduler.LoadData = true;
            scheduler.InitialDate = new DateTime(2011, 9, 7);
            scheduler.EnableDataprocessor = true;

            return View(scheduler);
        }
Example #5
0
        public ActionResult Index()
        {
            //each scheduler must have unique name
            var scheduler  = new DHXScheduler("sched1");
            var scheduler2 = new DHXScheduler("sched2");

            scheduler.DataAction  = Url.Action("Data", "OffDays");
            scheduler.SaveAction  = Url.Action("Save", "OffDays");
            scheduler2.DataAction = Url.Action("Data1", "OffDays");
            scheduler2.SaveAction = Url.Action("Save1", "OffDays");

            scheduler.LoadData             = true;
            scheduler.EnableDataprocessor  = true;
            scheduler2.LoadData            = true;
            scheduler2.EnableDataprocessor = true;

            var context     = new CRMDBContext();
            var multiselect = new LightboxSelect("employee", "Employee");

            multiselect.AddOptions(context.Employees.Select(t => new { key = t.ID, label = t.Name }));

            scheduler.Lightbox.Add(new LightboxText("text", "Title"));
            scheduler.Lightbox.Add(multiselect);
            scheduler.Lightbox.Add(new LightboxMiniCalendar("time", "Time"));

            scheduler2.Lightbox.Add(new LightboxText("text", "Title"));
            scheduler2.Lightbox.Add(multiselect);
            scheduler2.Lightbox.Add(new LightboxMiniCalendar("time", "Time"));

            return(View(new Mod {
                Sh1 = scheduler, Sh2 = scheduler2
            }));
        }
        public ActionResult Details()
        {
            var sched = new DHXScheduler(this);

            sched.XY.scroll_width = 0;
            sched.Config.first_hour = 8;
            sched.Config.last_hour = 19;
            sched.Config.time_step = 30;
            sched.Config.limit_time_select = true;

            var text = new LightboxText("text", "Description");
            text.Height = 50;
            sched.Lightbox.Add(text);
            var select = new LightboxSelect("textColor", "Priority");
            var items = new List<object>();
            items.Add(new { key = "gray", label = "Low" });
            items.Add(new { key = "blue", label = "Medium" });
            items.Add(new { key = "red", label = "Hight" });
            select.AddOptions(items);
            var check = new LightboxRadio("category", "Category");
            check.AddOption(new LightboxSelectOption("job", "Job"));
            check.AddOption(new LightboxSelectOption("family", "Family"));
            check.AddOption(new LightboxSelectOption("other", "Other"));
            sched.Lightbox.Add(check);
            sched.Lightbox.Add(select);
            sched.Lightbox.Add(new LightboxMiniCalendar("time", "Time:"));

            sched.Lightbox.Add(new LightboxCheckbox("remind", "Remind"));
            sched.LoadData = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate = new DateTime(2011, 9, 11);

            return View(sched);
        }
Example #7
0
        public ActionResult Index()
        {
            //Being initialized in that way, scheduler will use CalendarController.Data as a the datasource and CalendarController.Save to process changes
            var scheduler = new DHXScheduler();

            scheduler.DataAction = Url.Action("Data");
            scheduler.SaveAction = Url.Action("Save");

            /*
             * It's possible to use different actions of the current controller
             *      var scheduler = new DHXScheduler(this);
             *      scheduler.DataAction = "ActionName1";
             *      scheduler.SaveAction = "ActionName2";
             *
             * Or to specify full paths
             *      var scheduler = new DHXScheduler();
             *      scheduler.DataAction = Url.Action("Data", "Calendar");
             *      scheduler.SaveAction = Url.Action("Save", "Calendar");
             */

            /*
             * The default codebase folder is ~/Scripts/dhtmlxScheduler. It can be overriden:
             *      scheduler.Codebase = Url.Content("~/customCodebaseFolder");
             */


            //scheduler.InitialDate = new DateTime(2012, 09, 03);

            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;

            var context = new CRMDBContext();

            scheduler.Lightbox.Add(new LightboxText("text", "Title"));

            var multiselect = new LightboxSelect("staff", "Staff");

            multiselect.AddOptions(context.Employees.Select(t => new { key = t.ID, label = t.Name }));
            scheduler.Lightbox.Add(multiselect);

            var selectcategory = new LightboxSelect("category", "Category");
            var items          = new List <object>()
            {
                new { key = "employee", label = "Employee" },
                new { key = "manager", label = "Management" },
                new { key = "visitor", label = "Visitor" }
            };

            selectcategory.AddOptions(items);
            scheduler.Lightbox.Add(selectcategory);

            scheduler.Lightbox.Add(new LightboxMiniCalendar("time", "Time"));

            return(View(scheduler));
        }
        public ActionResult Index()
        {
            //Being initialized in that way, scheduler will use CalendarController.Data as a the datasource and CalendarController.Save to process changes
            var scheduler = new DHXScheduler(this);

            scheduler.Extensions.Add(SchedulerExtensions.Extension.PDF);

            var year = new YearView();     //initializes the view

            scheduler.Views.Add(year);     //adds the view to the scheduler

            var agenda = new AgendaView(); //initializes the view

            scheduler.Views.Add(agenda);   //adds the view to the scheduler

            var modulos = new LightboxSelect("FK_Id_Modulo", "Modulo");

            var items = new List <object>();

            foreach (var item in db.Modulo)
            {
                items.Add(new { key = item.Id_Modulo, label = item.Nombre });
            }

            modulos.AddOptions(items);


            var profesores = new LightboxSelect("FK_Id_Profesor", "Profesor");

            var itemsProfesor = new List <object>();

            foreach (var item in db.Profesor)
            {
                itemsProfesor.Add(new { key = item.Id_Profesor, label = item.Nombre });
            }

            profesores.AddOptions(itemsProfesor);


            var time = new LightboxTime("Time");
            var nota = new LightboxText("text", "Nota");

            scheduler.Lightbox.Add(modulos);
            scheduler.Lightbox.Add(profesores);
            scheduler.Lightbox.Add(time);
            scheduler.Lightbox.Add(nota);

            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;


            scheduler.BeforeInit.Add(string.Format("initResponsive({0})", scheduler.Name));

            return(View(scheduler));
        }
Example #9
0
        public ActionResult Details()
        {
            var sched = new DHXScheduler(this)
            {
                XY = { scroll_width = 0 },
                Config = { first_hour = 7, last_hour = 20, time_step = 30, limit_time_select = true }
            };
            var text = new LightboxText("text", "Description") { Height = 50 };
            sched.Lightbox.Add(text);

            var select = new LightboxSelect("color", "Priority");
            select.AddOptions(new List<object>{
                new { key = "#ccc", label = "Low" },
                new { key = "#76B007", label = "Medium" },
                new { key = "#FE7510", label = "Hight" }
            });
            sched.Lightbox.Add(select);

            var check = new LightboxRadio("category", "Category");
            check.AddOption(new LightboxSelectOption("job", "Job"));
            check.AddOption(new LightboxSelectOption("family", "Family"));
            check.AddOption(new LightboxSelectOption("other", "Other"));
            sched.Lightbox.Add(check);

            var check2 = new LightboxRadio("category2", "Category2");
            check2.AddOption(new LightboxSelectOption("test1", "test1"));
            check2.AddOption(new LightboxSelectOption("test2", "test2"));
            check2.AddOption(new LightboxSelectOption("test3", "test3"));
            sched.Lightbox.Add(check2);

            sched.Lightbox.Add(new LightboxMiniCalendar("time", "Time:"));

            sched.Lightbox.Add(new LightboxCheckbox("remind", "Remind"));
            sched.LoadData = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate = new DateTime(2011, 9, 11);

            // ADD YEAR VIEW
            var year = new YearView();
            sched.Views.Add(year);
            sched.LoadData = true;
            sched.EnableDataprocessor = true;

            // SET LOCALE
            var locale = SchedulerLocalization.Localizations.English;
            sched.Localization.Set(locale);

            return View(sched);
        }
Example #10
0
        public ActionResult Index()
        {
            var sched = new DHXScheduler(this);
            var unit  = new UnitsView("unit1", "room_id");

            sched.Views.Add(unit);

            //can add IEnumerable of objects, native units or dictionary

            var rooms = Repository.Rooms.ToList();

            unit.AddOptions(rooms);//parse model objects
            sched.Config.details_on_create   = true;
            sched.Config.details_on_dblclick = true;

            var timeline = new TimelineView("timeline", "room_id")
            {
                RenderMode = TimelineView.RenderModes.Bar
            };

            sched.XY.scale_height = 40;
            timeline.X_Date       = "%d<br>%D";
            timeline.FitEvents    = false;
            sched.Views.Add(timeline);

            timeline.AddOptions(rooms);

            var select = new LightboxSelect("color", "Priority");

            select.AddOptions(new List <object> {
                new { key = "#ccc", label = "Low" },
                new { key = "#76B007", label = "Medium" },
                new { key = "#FE7510", label = "Hight" }
            });
            sched.Lightbox.Add(select);


            select = new LightboxSelect("room_id", "Room id");
            select.AddOptions(rooms);

            sched.Lightbox.Add(select);

            sched.LoadData            = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate         = new DateTime(2011, 9, 5);
            return(View(sched));
        }
        public ActionResult Index()
        {
            var scheduler = new DHXScheduler();

            scheduler.DataAction = Url.Action("Data");
            scheduler.SaveAction = Url.Action("Save");

            var selectDoctor = new LightboxSelect("DoctorID", "Doctor");
            var items        = new List <object>();
            IEnumerable <DoctorMiniInfoViewModel> doctorList = doctorRepository.getDoctorMiniInfoList();

            foreach (DoctorMiniInfoViewModel item in doctorList)
            {
                items.Add(new { key = item.DoctorID, label = item.DoctorName });
            }
            selectDoctor.AddOptions(items);



            var selectPatientStatus = new LightboxSelect("Status", "Status");
            var Statusitems         = new List <object>();

            //Statusitems.Add(new { key = PatientSchduelStatus.canceled, label = PatientSchduelStatus.canceled });
            Statusitems.Add(new { key = PatientSchduelStatus.Finished, label = PatientSchduelStatus.Finished });
            Statusitems.Add(new { key = PatientSchduelStatus.Postponed, label = PatientSchduelStatus.Postponed });
            Statusitems.Add(new { key = PatientSchduelStatus.InProgress, label = PatientSchduelStatus.InProgress });
            Statusitems.Add(new { key = PatientSchduelStatus.waiting, label = PatientSchduelStatus.waiting });
            selectPatientStatus.AddOptions(Statusitems);



            var Reason = new LightboxText("reason", "Reason");
            var Define = new LightboxText("text", "Define");
            var date   = new LightboxMiniCalendar("Date");

            scheduler.Lightbox.Add(Define);
            scheduler.Lightbox.Add(Reason);
            scheduler.Lightbox.Add(selectDoctor);
            scheduler.Lightbox.Add(selectPatientStatus);
            scheduler.Lightbox.Add(date);

            scheduler.Config.hour_size_px = 100;

            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;
            return(View(scheduler));
        }
Example #12
0
        public ActionResult Wide()
        {
            var sched = new DHXScheduler(this);

            sched.Config.wide_form = true;


            sched.XY.scroll_width          = 0;
            sched.Config.first_hour        = 8;
            sched.Config.last_hour         = 19;
            sched.Config.time_step         = 30;
            sched.Config.limit_time_select = true;


            var text = new LightboxText("text", "Description");

            text.Height = 50;
            sched.Lightbox.Add(text);

            var select = new LightboxSelect("color", "Priority");

            select.AddOptions(new List <object> {
                new { key = "#ccc", label = "Low" },
                new { key = "#76B007", label = "Medium" },
                new { key = "#FE7510", label = "Hight" }
            });
            sched.Lightbox.Add(select);


            var check = new LightboxRadio("category", "Category");

            check.AddOption(new LightboxSelectOption("job", "Job"));
            check.AddOption(new LightboxSelectOption("family", "Family"));
            check.AddOption(new LightboxSelectOption("other", "Other"));
            sched.Lightbox.Add(check);

            sched.Lightbox.Add(new LightboxMiniCalendar("time", "Time:"));

            sched.Lightbox.Add(new LightboxCheckbox("remind", "Remind"));
            sched.LoadData            = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate         = new DateTime(2011, 9, 11);

            return(View(sched));
        }
        public ActionResult Index(FormCollection data)
        {
            var sched = new DHXScheduler(this);

            sched.Extensions.Add(SchedulerExtensions.Extension.Cookie);

            var rooms = Repository.Rooms.ToList();

            int selectedRoom;

            if (Request.QueryString["filter"] != null)
            {
                // parameters will be added to data url
                sched.Data.Loader.AddParameters(Request.QueryString);
                selectedRoom = int.Parse(Request.QueryString["rooms"]);
            }
            else
            {
                selectedRoom = rooms.First().key;
            }


            var unit = new UnitsView("rooms", "room_id")
            {
                Label = "Rooms"
            };

            unit.AddOptions(rooms);
            sched.Views.Add(unit);


            sched.Lightbox.AddDefaults();
            var select = new LightboxSelect("room_id", "Room");

            select.AddOptions(rooms);
            sched.Lightbox.Add(select);


            sched.LoadData            = true;
            sched.EnableDataprocessor = true;
            sched.InitialView         = unit.Name;
            ViewData["rooms"]         = selectedRoom;
            sched.InitialDate         = new DateTime(2011, 9, 7);
            return(View(new SchedulerFilterModel(sched, rooms)));
        }
        public ActionResult Index()
        {
            var sched = new DHXScheduler(this);

            sched.Skin = DHXScheduler.Skins.Terrace;
            var unit = new UnitsView("unit1", "room_id");

            sched.Views.Add(unit);


            var context = new DHXSchedulerDataContext();

            //can add IEnumerable of objects, native units or dictionary
            unit.AddOptions(context.Rooms);//parse model objects
            sched.Config.details_on_create   = true;
            sched.Config.details_on_dblclick = true;

            var timeline = new TimelineView("timeline", "room_id");

            var items = new List <object>();

            timeline.FitEvents = false;
            sched.Views.Add(timeline);
            timeline.AddOptions(context.Rooms);


            var select = new LightboxSelect("textColor", "Priority");

            items = new List <object>();
            items.Add(new { key = "gray", label = "Low" });
            items.Add(new { key = "blue", label = "Medium" });
            items.Add(new { key = "red", label = "Hight" });
            select.AddOptions(items);
            sched.Lightbox.Add(select);


            select = new LightboxSelect("room_id", "Room id");
            select.AddOptions(context.Rooms);
            sched.Lightbox.Add(select);

            sched.LoadData            = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate         = new DateTime(2011, 9, 5);
            return(View(sched));
        }
Example #15
0
        public ActionResult Index()
        {
            ViewBag.Title            = "Scheduler | Multiday Units View";
            ViewBag.SampleTitle      = "Multiday Units View";
            ViewBag.ShortDescription = "Show several days in units view";
            ViewBag.LongDescription  = "A view can have any number of days";

            var sched = new DHXScheduler(this);
            var unit  = new UnitsView("unit1", "room_id");

            unit.Days = 7;
            sched.Views.Add(unit);

            //can add IEnumerable of objects, native units or dictionary

            var rooms = Repository.Rooms.ToList();

            unit.AddOptions(rooms);//parse model objects
            sched.Config.details_on_create   = true;
            sched.Config.details_on_dblclick = true;



            var select = new LightboxSelect("color", "Priority");

            select.AddOptions(new List <object> {
                new { key = "#ccc", label = "Low" },
                new { key = "#76B007", label = "Medium" },
                new { key = "#FE7510", label = "Hight" }
            });
            sched.Lightbox.Add(select);


            select = new LightboxSelect("room_id", "Room id");
            select.AddOptions(rooms);

            sched.Lightbox.Add(select);

            sched.LoadData            = true;
            sched.EnableDataprocessor = true;
            sched.InitialView         = unit.Name;
            sched.InitialDate         = new DateTime(2011, 9, 5);
            return(View(sched));
        }
Example #16
0
        /// <summary>
        /// Add resources views - units and timeline
        /// </summary>
        /// <returns></returns>
        public ActionResult MultipleResources()
        {
            var scheduler = new DHXScheduler(this);

            scheduler.Skin = DHXScheduler.Skins.Terrace;
            var rooms = Repository.Rooms.ToList();

            scheduler.Views.Clear();
            scheduler.Views.Add(new MonthView());

            var unit = new UnitsView("unit", "room_id");

            unit.AddOptions(rooms);//parse model objects

            scheduler.Views.Add(unit);

            var timeline = new TimelineView("timeline", "room_id")
            {
                RenderMode = TimelineView.RenderModes.Bar,
                FitEvents  = false
            };

            timeline.AddOptions(rooms);
            scheduler.Views.Add(timeline);


            //show timeline view by default
            scheduler.InitialView = timeline.Name;

            scheduler.Lightbox.AddDefaults();//add default set of options - text and timepicker
            //add controls to the details form
            var select = new LightboxSelect("room_id", "Room id");

            select.AddOptions(rooms);
            scheduler.Lightbox.Add(select);


            scheduler.LoadData            = true;
            scheduler.InitialDate         = new DateTime(2011, 9, 7);
            scheduler.EnableDataprocessor = true;

            return(View(scheduler));
        }
Example #17
0
        public ActionResult Index()
        {
            ViewBag.Title            = "Scheduler | Daily Timeline View";
            ViewBag.SampleTitle      = "Daily Timeline View";
            ViewBag.ShortDescription = "Use days as sections of the Timeline view";
            ViewBag.LongDescription  = "A view can have any number of days";

            var sched = new DHXScheduler(this);

            sched.Config.details_on_create   = true;
            sched.Config.details_on_dblclick = true;

            var timeline = new TimelineView("timeline", "room_id")
            {
                RenderMode = TimelineView.RenderModes.Days,
                Days       = 7
            };

            timeline.X_Date    = "%H:%i";
            timeline.FitEvents = false;
            sched.Views.Add(timeline);

            var select = new LightboxSelect("color", "Priority");

            select.AddOptions(new List <object> {
                new { key = "#ccc", label = "Low" },
                new { key = "#76B007", label = "Medium" },
                new { key = "#FE7510", label = "Hight" }
            });
            sched.Lightbox.Add(select);

            var rooms = Repository.Rooms.ToList();

            select = new LightboxSelect("room_id", "Room id");
            select.AddOptions(rooms);
            sched.Lightbox.Add(select);

            sched.LoadData            = true;
            sched.EnableDataprocessor = true;
            sched.InitialView         = timeline.Name;
            sched.InitialDate         = new DateTime(2011, 9, 5);
            return(View(sched));
        }
Example #18
0
        /// <summary>
        /// Configure lightbox
        /// </summary>
        /// <param name="scheduler">scheduler</param>
        /// <param name="cars">cars</param>
        protected void _ConfigureLightbox(DHXScheduler scheduler, IEnumerable cars)
        {
            scheduler.Lightbox.Add(new LightboxText("text", "Contact details")
            {
                Height = 42, Focus = true
            });
            scheduler.Lightbox.Add(new LightboxText("description", "Note")
            {
                Height = 63
            });
            var select = new LightboxSelect("section_id", "Car");

            scheduler.Lightbox.Add(select);
            // scheduler.Lightbox.Add(new LightboxText("pick_location", "Pick up location") { Height = 21 });
            // scheduler.Lightbox.Add(new LightboxText("drop_location", "Drop off location") { Height = 21 });
            select.ServerList = "SelectOptions";

            scheduler.Lightbox.Add(new LightboxMiniCalendar("time", "Time period"));
        }
Example #19
0
        /// <summary>
        /// applying client side filters for each view
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var scheduler = new DHXScheduler();

            var rooms = Repository.Rooms.ToList();

            //new DHXSchedulerModelsDataContext().Rooms.ToList();

            //each view can have multiple rules
            //they also can be added on the client
            scheduler.Views[1].Filter.Rules.Add(//month
                new Rule("start_date", Operator.GreaterOrEqual, new DateTime(2011, 9, 6))
                );
            scheduler.Views[1].Filter.Rules.Add(
                new Rule("end_date", Operator.LowerOrEqual, new DateTime(2011, 9, 14))
                );

            scheduler.Views[2].Filter.Rules.Add(//day
                new Rule("room_id", Operator.Equals, rooms.First().key)
                );
            scheduler.Views[2].Filter.Rules.Add(//day
                new ExpressionRule("{text}.length > 4 && {text}.length < 20")
                );

            var select = new LightboxSelect("room_id", "Room");

            select.AddOptions(rooms);


            scheduler.Lightbox.AddDefaults();
            scheduler.Lightbox.Add(select);

            scheduler.Controller = "BasicScheduler";//using BasicSchedulerController to load data
            scheduler.LoadData   = true;

            //added save client-side changes
            //scheduler.EnableDataprocessor = true;

            scheduler.UpdateFieldsAfterSave();
            scheduler.InitialDate = new DateTime(2011, 9, 7);
            return(View(scheduler));
        }
Example #20
0
    protected void _ConfigureLightbox(DHXScheduler scheduler, IEnumerable cars, IEnumerable locations)
    {
        //  scheduler.Lightbox.Add(new LightboxText("text", "Contact details") { Height = 42, Focus = true });

        var select = new LightboxSelect("carid", "Tên Xe");

        scheduler.Lightbox.Add(select);
        var select2 = new LightboxSelect("pick_location", "Địa điểm nhận xe");

        scheduler.Lightbox.Add(select2);
        var select3 = new LightboxSelect("drop_location", "Địa điểm trả xe");

        scheduler.Lightbox.Add(select3);
        // scheduler.Lightbox.Add(new LightboxText("pick_location", "Địa điểm nhận xe") { Height = 21 });
        // scheduler.Lightbox.Add(new LightboxText("drop_location", "Địa điểm trả xe") { Height = 21 });

        select.AddOptions(cars);
        select2.AddOptions(locations);
        select3.AddOptions(locations);
        scheduler.Lightbox.Add(new LightboxTime("time", "Thời gian thuê"));
    }
        public ActionResult Index()
        {
            var sched = new DHXScheduler(this);
            sched.Skin = DHXScheduler.Skins.Terrace;
            var unit = new UnitsView("unit1", "room_id");
            sched.Views.Add(unit);

            var context = new DHXSchedulerDataContext();

            //can add IEnumerable of objects, native units or dictionary
            unit.AddOptions(context.Rooms);//parse model objects
            sched.Config.details_on_create = true;
            sched.Config.details_on_dblclick = true;

            var timeline = new TimelineView("timeline", "room_id");

            var items = new List<object>();
            timeline.FitEvents = false;
            sched.Views.Add(timeline);
            timeline.AddOptions(context.Rooms);

            var select = new LightboxSelect("textColor", "Priority");
            items = new List<object>();
            items.Add(new { key = "gray", label = "Low" });
            items.Add(new { key = "blue", label = "Medium" });
            items.Add(new { key = "red", label = "Hight" });
            select.AddOptions(items);
            sched.Lightbox.Add(select);

            select = new LightboxSelect("room_id", "Room id");
            select.AddOptions(context.Rooms);
            sched.Lightbox.Add(select);

            sched.LoadData = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate = new DateTime(2011, 9, 5);
            return View(sched);
        }
        public ActionResult Index(FormCollection data)
        {
            var sched = new DHXScheduler(this);

            sched.Extensions.Add(SchedulerExtensions.Extension.Cookie);

            var rooms = new DHXSchedulerDataContext().Rooms.ToList();

            int selectedRoom;
            if (this.Request.QueryString["filter"] != null)
            {
                // parameters will be added to data url
                sched.Data.Loader.AddParameters(this.Request.QueryString);
                selectedRoom = int.Parse(this.Request.QueryString["rooms"]);
            }
            else
            {
                selectedRoom = rooms.First().key;
            }

            var unit = new UnitsView("rooms", "room_id");
            unit.Label = "Rooms";
            unit.AddOptions(rooms);
            sched.Views.Add(unit);

            sched.Lightbox.AddDefaults();
            var select = new LightboxSelect("room_id", "Room");
            select.AddOptions(rooms);
            sched.Lightbox.Add(select);

            sched.LoadData = true;
            sched.EnableDataprocessor = true;
            sched.InitialView = unit.Name;
            ViewData["rooms"] = selectedRoom;
            sched.InitialDate = new DateTime(2011, 9, 7);
            return View(new SchedulerFilterModel(sched, rooms));
        }
Example #23
0
        public static void Initialize(DHXScheduler scheduler)
        {
            int roleID = 0;
            int userID = 0;

            int.TryParse(System.Web.HttpContext.Current.Session["RoleId"].ToString(), out roleID);

            scheduler.Codebase = "../../js/dhtmlxScheduler";

            //scheduler.DataFormat = SchedulerDataLoader.DataFormats.iCal;

            scheduler.Config.first_hour = 5;//sets the minimum value for the hour scale (Y-Axis)
            scheduler.Config.last_hour = 19;//sets the maximum value for the hour scale (Y-Axis)
            scheduler.Config.time_step = 60;//sets the scale interval for the time selector in the lightbox.
            //scheduler.Config.full_day = true;// blocks entry fields in the 'Time period' section of the lightbox and sets time period to a full day from 00.00 the current cell date untill 00.00 next day.
            scheduler.Config.multi_day = true;
            scheduler.Config.limit_time_select = true;

            scheduler.Skin = DHXScheduler.Skins.Terrace;

            scheduler.Extensions.Add(SchedulerExtensions.Extension.Collision);
            scheduler.Extensions.Add(SchedulerExtensions.Extension.Limit);

            #region lightbox configuration
            var text = new LightboxText("text", "Task");// initializes a text input with the label 'Task'
            text.Height = 20;// sets the height of the control
            text.Focus = true;// set focus to the control
            scheduler.Lightbox.Add(text);// adds the control to the lightbox

            var description = new LightboxText("details", "Details");// initializes a text input with the label 'Task'
            description.Height = 20;
            scheduler.Lightbox.Add(description);

            var status = new LightboxSelect("status_id", "Status");// initializes a dropdown list with the label 'Status'
            status.AddOptions(TasksManager.GetStatuses());// populates the list with values from the 'Statuses' table
            scheduler.Lightbox.Add(status);

            var owners = new LightboxSelect("owner_id", "Owner");

            if (roleID == (int)UserRole.Administrator)
                owners.AddOptions(TasksManager.GetOwners());
            else {
                int.TryParse(System.Web.HttpContext.Current.Session["UserId"].ToString(), out userID);

                owners.AddOptions(TasksManager.GetOwners(userID));
            }

            scheduler.Lightbox.Add(owners);

            // poplicy types
            var policyTypes = new LightboxSelect("policy_type", "Policy Type");
            policyTypes.AddOptions(LeadPolicyTypeManager.GetPolicyTypesForScheduler());
            scheduler.Lightbox.Add(policyTypes);

            //var lead_name = new LightboxText("lead_name", "Lead Name");// initializes a text input with the label 'Task'
            //lead_name.Height = 20;
            //scheduler.Lightbox.Add(lead_name);

            // initializes and adds a control area for setting start and end times of a task
            //scheduler.Lightbox.Add(new LightboxTime("Time"));
            scheduler.Lightbox.Add(new LightboxMiniCalendar("cal", "Time"));
            #endregion

            scheduler.LoadData = true;
            scheduler.EnableDataprocessor = true;
            scheduler.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Week);
            scheduler.UpdateFieldsAfterSave();
        }
Example #24
0
        // GET: DoctorInforms/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DoctorInform doctorInform = db.DoctorInforms.Find(id);

            if (doctorInform == null)
            {
                return(HttpNotFound());
            }

            ViewBag.doctorId = id;
            if (Request.IsAuthenticated)
            {
                ApplicationUser user = db.Users.Find(User.Identity.GetUserId());
                ViewBag.Role = db.Roles.Find(user.Roles.FirstOrDefault().RoleId).Name;
            }
            var ID        = doctorInform.ApplicationUsers.FirstOrDefault().Id;
            var feedbacks = db.Feedbacks.Where(u => u.DoctorId == ID).ToList();

            ViewBag.Feedbacks = feedbacks;
            if (feedbacks.Count != 0)
            {
                ViewBag.Average = feedbacks.Average(u => u.Stars) * 20;
            }
            var scheduler = new DHXScheduler(this);

            scheduler.Skin                = DHXScheduler.Skins.Material;
            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;
            scheduler.Config.first_hour   = 6;
            scheduler.Config.last_hour    = 20;

            scheduler.Data.Loader.AddParameter("id", id);
            scheduler.Localization.Set(SchedulerLocalization.Localizations.Ukrainian);
            scheduler.Config.drag_lightbox = true;
            scheduler.Lightbox.Clear();
            var select   = new LightboxSelect("service", "Послуга");
            var services = new List <object>();

            foreach (TypeOfService type in doctorInform.ApplicationUsers.FirstOrDefault().TypeOfServices)
            {
                services.Add(new { key = type.Id, label = type.Name });
            }
            scheduler.Config.icons_select = new EventButtonList()
            {
                EventButtonList.Details
            };
            scheduler.Config.drag_create     = false;
            scheduler.Config.drag_lightbox   = false;
            scheduler.Config.drag_resize     = false;
            scheduler.Config.drag_move       = false;
            scheduler.Config.dblclick_create = false;
            scheduler.Config.show_loading    = true;
            var items = services;

            select.AddOptions(items);
            scheduler.Lightbox.Add(select);
            scheduler.Config.buttons_left = new LightboxButtonList
            {
                new EventButton
                {
                    Label   = "Записатися на прийом",
                    OnClick = "appointment",
                    Name    = "appointment"
                },
                LightboxButtonList.Cancel,
            };
            scheduler.Config.buttons_right = new LightboxButtonList();
            if (!User.Identity.IsAuthenticated)
            {
                scheduler.Config.isReadonly = true;
            }
            ViewBag.Scheduler = scheduler;
            return(View(doctorInform));
        }
Example #25
0
        static public void Initialize(DHXScheduler scheduler)
        {
            int roleID = 0;
            int userID = 0;

            int.TryParse(System.Web.HttpContext.Current.Session["RoleId"].ToString(), out roleID);

            scheduler.Codebase = "../../js/dhtmlxScheduler";

            //scheduler.DataFormat = SchedulerDataLoader.DataFormats.iCal;

            scheduler.Config.first_hour = 5;            //sets the minimum value for the hour scale (Y-Axis)
            scheduler.Config.last_hour  = 19;           //sets the maximum value for the hour scale (Y-Axis)
            scheduler.Config.time_step  = 60;           //sets the scale interval for the time selector in the lightbox.
            //scheduler.Config.full_day = true;// blocks entry fields in the 'Time period' section of the lightbox and sets time period to a full day from 00.00 the current cell date untill 00.00 next day.
            scheduler.Config.multi_day         = true;
            scheduler.Config.limit_time_select = true;

            scheduler.Skin = DHXScheduler.Skins.Terrace;

            scheduler.Extensions.Add(SchedulerExtensions.Extension.Collision);
            scheduler.Extensions.Add(SchedulerExtensions.Extension.Limit);



            #region lightbox configuration
            var text = new LightboxText("text", "Task");              // initializes a text input with the label 'Task'
            text.Height = 20;                                         // sets the height of the control
            text.Focus  = true;                                       // set focus to the control
            scheduler.Lightbox.Add(text);                             // adds the control to the lightbox

            var description = new LightboxText("details", "Details"); // initializes a text input with the label 'Task'
            description.Height = 20;
            scheduler.Lightbox.Add(description);

            var status = new LightboxSelect("status_id", "Status");   // initializes a dropdown list with the label 'Status'
            status.AddOptions(TasksManager.GetStatuses());            // populates the list with values from the 'Statuses' table
            scheduler.Lightbox.Add(status);

            var owners = new LightboxSelect("owner_id", "Owner");

            if (roleID == (int)UserRole.Administrator)
            {
                owners.AddOptions(TasksManager.GetOwners());
            }
            else
            {
                int.TryParse(System.Web.HttpContext.Current.Session["UserId"].ToString(), out userID);

                owners.AddOptions(TasksManager.GetOwners(userID));
            }

            scheduler.Lightbox.Add(owners);


            // poplicy types
            var policyTypes = new LightboxSelect("policy_type", "Policy Type");
            policyTypes.AddOptions(LeadPolicyTypeManager.GetPolicyTypesForScheduler());
            scheduler.Lightbox.Add(policyTypes);

            //var lead_name = new LightboxText("lead_name", "Lead Name");// initializes a text input with the label 'Task'
            //lead_name.Height = 20;
            //scheduler.Lightbox.Add(lead_name);

            // initializes and adds a control area for setting start and end times of a task
            //scheduler.Lightbox.Add(new LightboxTime("Time"));
            scheduler.Lightbox.Add(new LightboxMiniCalendar("cal", "Time"));
            #endregion

            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;
            scheduler.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Week);
            scheduler.UpdateFieldsAfterSave();
        }
Example #26
0
        // GET: Calendar
        public ActionResult Index()
        {
            //Initialize scheduler dropdowns and agenda view
            var scheduler       = new DHXScheduler(this);
            var patientDropDown = new LightboxSelect("patient", "Patient ID");
            var roomDropDown    = new LightboxSelect("room", "Room ");
            var agenda          = new WeekAgendaView();



            //Add agenda view
            scheduler.Views.Add(agenda);

            //Create room list
            var items = new List <object>()
            {
                new { key = "1", label = "Room 1" },
                new { key = "2", label = "Room 2" },
                new { key = "3", label = "Room 3" },
                new { key = "4", label = "Consultation Room" }
            };

            //create Patient ID List
            var tempPeeps = new List <object>()
            {
                new { key = "5", label = "1" },
                new { key = "6", label = "2" },
                new { key = "7", label = "3" },
                new { key = "8", label = "3" },
                new { key = "9", label = "4" },
                new { key = "10", label = "5" }
            };



            scheduler.Templates.agenda_text = "{text}";


            patientDropDown.AddOptions(tempPeeps);
            roomDropDown.AddOptions(items);



            scheduler.Lightbox.AddDefaults();
            scheduler.Lightbox.Add(patientDropDown);
            scheduler.Lightbox.Add(roomDropDown);


            scheduler.Skin = DHXScheduler.Skins.Flat;
            scheduler.Config.drag_resize       = false;
            scheduler.Config.drag_move         = false;
            scheduler.Config.drag_in           = false;
            scheduler.Config.drag_out          = false;
            scheduler.Config.limit_drag_out    = true;
            scheduler.Config.limit_time_select = true;
            scheduler.Config.collision_limit   = 2;
            scheduler.Config.dblclick_create   = true;
            scheduler.Config.drag_create       = false;
            scheduler.Config.event_duration    = 30;
            scheduler.Config.auto_end_date     = true;
            scheduler.Config.first_hour        = 8;
            scheduler.Config.last_hour         = 17;
            scheduler.Config.hour_date         = "%h:%i%A";



            scheduler.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Month);

            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;


            return(View(scheduler));
        }
Example #27
0
        public ActionResult Details()
        {
            var sched = new DHXScheduler(this)
            {
                XY = { scroll_width = 0 },
                Config = { first_hour = 7, last_hour = 20, time_step = 30, limit_time_select = true }
            };

            var text = new LightboxText("text", "Description") { Height = 50 };
            sched.Lightbox.Add(text);

            var select = new LightboxSelect("color", "Priority");
            select.AddOptions(new List<object>{
                new { key = "#ccc", label = "Low" },
                new { key = "#76B007", label = "Medium" },
                new { key = "#FE7510", label = "Hight" }
            });
            sched.Lightbox.Add(select);

            // ------------------------- COMBOBOX ------------------------------
            var select2 = new LightboxSelect("Test", "Test");

            DataTable subjects = new DataTable();

            List<Cust> columnCust = new List<Cust>();

            using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
            {
                string query = "SELECT * FROM SchedulerContext.dbo.ColoredEvents";
                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    connection.Open();
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            columnCust.Add(new Cust
                            {
                                key = reader.GetInt32(0),
                                label = reader.GetString(1)
                            });
                        }
                    }
                    connection.Close();
                }
            }

            select2.AddOptions(columnCust);

            sched.Lightbox.Add(select2);
            // ------------------------- /COMBOBOX -----------------------------

            var check = new LightboxRadio("category", "Category");
            check.AddOption(new LightboxSelectOption("job", "Job"));
            check.AddOption(new LightboxSelectOption("family", "Family"));
            check.AddOption(new LightboxSelectOption("other", "Other"));
            sched.Lightbox.Add(check);

            var check2 = new LightboxRadio("category2", "Category2");
            check2.AddOption(new LightboxSelectOption("test1", "test1"));
            check2.AddOption(new LightboxSelectOption("test2", "test2"));
            check2.AddOption(new LightboxSelectOption("test3", "test3"));
            sched.Lightbox.Add(check2);

            sched.Lightbox.Add(new LightboxMiniCalendar("time", "Time:"));

            sched.Lightbox.Add(new LightboxCheckbox("remind", "Remind"));
            sched.LoadData = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate = new DateTime(2011, 9, 11);

            // ADD YEAR VIEW
            var year = new YearView();
            sched.Views.Add(year);
            sched.LoadData = true;
            sched.EnableDataprocessor = true;

            // SET LOCALE
            var locale = SchedulerLocalization.Localizations.English;
            sched.Localization.Set(locale);

            // block each sunday
            sched.TimeSpans.Add(new DHXBlockTime()
            {
                Day = DayOfWeek.Sunday
            });

            return View(sched);
        }
        public ActionResult Manager()
        {
            var scheduler = new DHXScheduler(this);

            #region check rights
            if (!RoleIs("Manager"))                          // checks the role
            {
                return(RedirectToAction("Index", "System")); //in case the role is not manager, redirects to the login page
            }
            #endregion

            #region configuration

            scheduler.Config.first_hour   = 8;    //sets the minimum value for the hour scale (Y-Axis)
            scheduler.Config.hour_size_px = 88;
            scheduler.Config.last_hour    = 17;   //sets the maximum value for the hour scale (Y-Axis)
            scheduler.Config.time_step    = 30;   //sets the scale interval for the time selector in the lightbox.
            scheduler.Config.full_day     = true; // blocks entry fields in the 'Time period' section of the lightbox and sets time period to a full day from 00.00 the current cell date untill 00.00 next day.

            scheduler.Skin = DHXScheduler.Skins.Flat;
            scheduler.Config.separate_short_events = true;

            scheduler.Extensions.Add(SchedulerExtensions.Extension.ActiveLinks);

            #endregion

            #region views configuration
            scheduler.Views.Clear();             //removes all views from the scheduler
            scheduler.Views.Add(new WeekView()); // adds a tab with the week view
            var units = new UnitsView("staff", "owner_id")
            {
                Label = "Staff"
            };                                                                 // initializes the units view

            var users = AppUserManagerProvider.Users;
            var staff = new List <object>();

            foreach (var user in users)
            {
                if (AppUserManagerProvider.GetUserRolesName(user.Id).Contains("Employee"))
                {
                    staff.Add(new { key = user.Id, label = user.UserName });
                }
            }

            units.AddOptions(staff);              // sets X-Axis items to names of employees
            scheduler.Views.Add(units);           //adds a tab with the units view
            scheduler.Views.Add(new MonthView()); // adds a tab with the Month view
            scheduler.InitialView = units.Name;   // makes the units view selected initially

            scheduler.Config.active_link_view = units.Name;
            #endregion

            #region lightbox configuration
            var text = new LightboxText("text", "Task")
            {
                Height = 20, Focus = true
            };                            // initializes a text input with the label 'Task'
            scheduler.Lightbox.Add(text); // adds the control to the lightbox
            var description = new LightboxText("details", "Details")
            {
                Height = 80
            };                                                      // initializes a text input with the label 'Task'
            scheduler.Lightbox.Add(description);
            var status = new LightboxSelect("status_id", "Status"); // initializes a dropdown list with the label 'Status'
            status.AddOptions(Repository.GetAll <Status>().Select(s => new
            {
                key   = s.id,
                label = s.title
            }));// populates the list with values from the 'Statuses' table
            scheduler.Lightbox.Add(status);
            //add users list
            var sUser = new LightboxSelect("owner_id", "Employee");
            sUser.AddOptions(staff);
            //--
            scheduler.Lightbox.Add(sUser);

            scheduler.Lightbox.Add(new LightboxTime("time"));// initializes and adds a control area for setting start and end times of a task
            #endregion

            #region data
            scheduler.EnableDataprocessor = true;                      // enables dataprocessor
            scheduler.LoadData            = true;                      //'says' to send data request after scheduler initialization
            scheduler.Data.DataProcessor.UpdateFieldsAfterSave = true; // Tracks after server responses for modified event fields
            #endregion

            var employees = users.Select(o => new Employees
            {
                key      = o.Id,
                userName = o.UserName
            }).ToArray();

            var statuses = Repository.GetAll <Status>().ToList();

            var js = new DataContractJsonSerializer(typeof(Employees[]));
            var ms = new MemoryStream();
            js.WriteObject(ms, employees);
            ms.Position = 0;
            var sr   = new StreamReader(ms);
            var json = sr.ReadToEnd();
            sr.Close();
            ms.Close();
            var model = new SystemModel(scheduler, json, statuses);
            return(View(model));
        }
Example #29
0
        // GET: User
        public ActionResult UserLogin()
        {
            ViewBag.AllQuestions = new SelectList(entities.Questions.ToList(), "Question1", "Question1");
            var scheduler = new DHXScheduler(this);

            scheduler.Skin                = DHXScheduler.Skins.Terrace;
            scheduler.Config.multi_day    = true;//render multiday events
            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;

            scheduler.Extensions.Add(SchedulerExtensions.Extension.Collision);
            scheduler.Extensions.Add(SchedulerExtensions.Extension.Limit);

            scheduler.Config.first_hour        = 8;
            scheduler.Config.last_hour         = 19;
            scheduler.XY.scroll_width          = 0;
            scheduler.Config.time_step         = 30; // minimum event length
            scheduler.Config.multi_day         = true;
            scheduler.Config.limit_time_select = true;

            scheduler.Config.cascade_event_display = true;


            scheduler.AfterInit = new List <string>()
            {
                "attachRules();"
            };                                                            // The required client-side handlers have to be added after Scheduler initialization but before events load.


            scheduler.LoadData = true;
            var context = new ClassroomAllocationSystemEntities();


            scheduler.Views.Items.RemoveAt(2);//remove DayView


            var units = new UnitsView("classrooms", "roomid");

            var rooms = context.ClassRooms.ToList();

            units.Label = "Rooms";
            units.AddOptions(rooms);
            scheduler.Views.Add(units);
            scheduler.Views.Add(new WeekAgendaView());



            LightboxSelect lbsEvent  = new LightboxSelect("ClassRoomId", "Classroom");
            var            resEvents = from a in new ClassroomAllocationSystemEntities().ClassRooms
                                       //where a.EndDate >= DateTime.Now &&
                                       //       a.StartDate <= DateTime.Now
                                       select new { a.ClassRoomId, a.ClassRoomName };



            foreach (var res in resEvents)
            {
                lbsEvent.AddOption(new LightboxSelectOption(res.ClassRoomId, res.ClassRoomName));
            }


            //var select = new LightboxSelect("roomid", "ClassRoom");
            //select.AddOptions(context.ClassRooms);

            scheduler.Lightbox.AddDefaults();
            scheduler.Lightbox.Items.Insert(1, lbsEvent);

            return(View(scheduler));
        }
Example #30
0
        public void AddSelectLaptopAndProject()
        {
            var events = Repository.GetAll<CalendarEvent>().Where(ev => ev.start_date.Day == DateTime.Now.Day).ToList();
            var laptops = Repository.GetAll<Laptop>().Where(l => l.is_empty == false).OrderBy(l=>l.position).ToList();
            var projectors = Repository.GetAll<Projector>().Where(p => p.is_empty == false).OrderBy(p => p.position).ToList();
            var phones = Repository.GetAll<Phone>().Where(p => p.is_empty == false).OrderBy(p => p.position).ToList();
            // List laptop
            List<Laptop> listlaptops = (from lap in laptops
                where events.All(ev => lap.laptop_id != ev.laptop_id)
                select lap).ToList();

            // List projector
            List<Projector> listprojectors = (from project in projectors
                where events.All(ev => project.projector_id != ev.projector_id)
                select project).ToList();

            // List Phone

            List<Phone> listphones = (from phone in phones
                where events.All(ev => phone.phone_id != ev.phone_id)
                select phone).ToList();


            // laptop select
            var laptopsSelect = new LightboxSelect("laptop_id", "Laptops");
            if (listlaptops.Count > 0)
            {
                laptopsSelect.AddOptions(listlaptops.Select(s => new
                {
                    key = s.laptop_id,
                    label = s.laptop_name
                }));
            }
            else
            {
                laptopsSelect.AddOptions(Repository.GetAll<Laptop>().Where(p => p.is_empty).ToList().Select(
                    p => new
                    {
                        key = p.laptop_id,
                        label = p.laptop_name,
                    }));
            }
            _scheduler.Lightbox.Add(laptopsSelect);

            // charging
            _scheduler.Lightbox.Add(new LightboxCheckbox("is_charging", "Use charging"));

            // projector
            var projectorsSelect = new LightboxSelect("projector_id", "Projector");
            if (listprojectors.Count > 0)
            {
                projectorsSelect.AddOptions(listprojectors.Select(s => new
                {
                    key = s.projector_id,
                    label = s.projector_name
                }));
            }
            else
            {
                projectorsSelect.AddOptions(Repository.GetAll<Projector>().Where(p => p.is_empty).ToList().Select(
                    p => new
                    {
                        key = p.projector_id,
                        label = p.projector_name,
                    }));
            }

            _scheduler.Lightbox.Add(projectorsSelect);

            // Phone
            var phoneSelect = new LightboxSelect("phone_id", "Phone");
            if (listphones.Count > 0)
            {
                phoneSelect.AddOptions(listphones.Select(
                    p => new
                    {
                        key = p.phone_id,
                        label = p.phone_name,
                    }));
            }
            else
            {
                phoneSelect.AddOptions(Repository.GetAll<Phone>().Where(p => p.is_empty).ToList().Select(
                    p => new
                    {
                        key = p.phone_id,
                        label = p.phone_name,
                    }));
            }
            _scheduler.Lightbox.Add(phoneSelect);

        }
        // GET: Spotkanies
        public ActionResult Index(int?id)
        {
            ModelCaledar kalendarz = new ModelCaledar();

            var scheduler = new DHXScheduler(this);

            scheduler.Extensions.Add(SchedulerExtensions.Extension.ActiveLinks);
            scheduler.Extensions.Add(SchedulerExtensions.Extension.Limit);
            scheduler.Extensions.Add(SchedulerExtensions.Extension.Collision);
            scheduler.Extensions.Add(SchedulerExtensions.Extension.Readonly);

            scheduler.Extensions.Add("../scheduler.config.js");
            scheduler.Extensions.Add("../scheduler-client.js");
            // scheduler.AfterInit.Add("readonlyEvents();");
            scheduler.BeforeInit.Add("init();");
            //scheduler.BeforeInit.Add("readonlyEvents();");
            // scheduler.Extensions.Add("../scheduler-client.js");
            scheduler.BeforeInit.Add("scheduler.customConfiguration();");
            scheduler.Skin = DHXScheduler.Skins.Flat;
            var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            scheduler.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Month);
            scheduler.Localization.Set(SchedulerLocalization.Localizations.Polish);
            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;
            scheduler.UpdateFieldsAfterSave();
            scheduler.Config.isReadonly = true;
            scheduler.Config.first_hour = 6;


            // scheduler.AfterInit.Add("block_readonly();");
            //var idl = id;
            int?idZalogowanego = null;

            if (rolaUser() == null && id == null)
            {
                kalendarz.wlasciciel = true;
            }
            else
            {
                {
                    if (Request.IsAuthenticated == true && getUser() == null)
                    {
                        return(Redirect("/Uzytkownik/Create"));
                    }
                    if (rolaUser() == null && id != null)
                    {
                        kalendarz.niezalogowany = true;
                    }
                    if (rolaUser() == "administrator")
                    {
                        scheduler.Config.isReadonly = false;
                    }
                    if (rolaUser() != null && rolaUser() != "administrator")
                    {
                        idZalogowanego = getUser().Id;
                    }
                    if (rolaUser() == "klient" && id == null)
                    {
                        kalendarz.klient     = getUser();
                        kalendarz.wlasciciel = true;
                    }


                    if (rolaUser() == "klient" && id != null && id != idZalogowanego) // dla klienta i nie zalogowanego uzytkownika
                    {
                        kalendarz.klient    = getUser();
                        kalendarz.funkcyjna = getUserID(id);
                    }
                    if (rolaUser() == "trener" || rolaUser() == "dietetyk" || kalendarz.wlasciciel == false || rolaUser() == "administrator")
                    {
                        if (idZalogowanego == id || id == null || rolaUser() == "administrator")
                        {
                            kalendarz.wlasciciel = true;
                            scheduler.Lightbox.Add(new LightboxText("text", "Opis")
                            {
                                Height = 42, Focus = true
                            });
                            var select = new LightboxSelect("status", "status");
                            var items  = new List <object>()
                            {
                                new { key = "dostepne", label = "dostepne" },
                                new { key = "zarezerwowane", label = "zarezerwowane" },
                                new { key = "inne", label = "inne" }
                            };
                            select.AddOptions(items);
                            scheduler.Lightbox.Add(select);
                            scheduler.Lightbox.Add(new LightboxTime("time", "Data"));

                            scheduler.Config.isReadonly = false;
                            if (id == null)
                            {
                                kalendarz.funkcyjna = getUser();
                                if (kalendarz.funkcyjna == null)
                                {
                                    return(Redirect("/Uzytkownik/Create"));
                                }
                                else
                                {
                                    List <Spotkanie> pom = new List <Spotkanie>();
                                    var spotkania        = db.Lista_spotkan.Where(x => x.id_funkcyjna == kalendarz.funkcyjna.Id).ToList();
                                    if (spotkania != null)
                                    {
                                        foreach (Lista_spotkan sp in spotkania)
                                        {
                                            pom.Add(sp.Spotkanie);
                                        }
                                        kalendarz.lista = pom;
                                    }
                                }
                            }
                            else
                            {
                                kalendarz.funkcyjna = getUserID(id);
                                var spotkania        = db.Lista_spotkan.Where(x => x.id_funkcyjna == kalendarz.funkcyjna.Id).ToList();
                                List <Spotkanie> pom = new List <Spotkanie>();
                                if (spotkania != null)
                                {
                                    foreach (Lista_spotkan sp in spotkania)
                                    {
                                        pom.Add(sp.Spotkanie);
                                    }
                                    kalendarz.lista = pom;
                                }
                            }
                        }
                        else
                        {
                            kalendarz.funkcyjna = getUserID(id);
                            kalendarz.klient    = getUser();
                            var spotkania        = db.Lista_spotkan.Where(x => x.id_funkcyjna == kalendarz.funkcyjna.Id).ToList();
                            List <Spotkanie> pom = new List <Spotkanie>();
                            if (spotkania != null)
                            {
                                foreach (Lista_spotkan sp in spotkania)
                                {
                                    pom.Add(sp.Spotkanie);
                                }
                                kalendarz.lista = pom;
                            }
                        }
                    }
                    else // czyli inny trener wchodzi na konto innego trenerea to co klient
                    {
                        kalendarz.funkcyjna = getUserID(id);
                    }
                }
            }



            idl = id;
            kalendarz.scheduler = scheduler;

            if (kalendarz.lista != null)
            {
                var stands =
                    kalendarz.lista
                    .Where(s => s.color == "#baed91" && s.data_start > DateTime.Now)
                    .Select(s => new
                {
                    Id          = s.Id,
                    Description = string.Format("{0}-{1}", s.data_start.Value.ToString("MM/dd/yyyy HH:mm"), s.data_koniec.Value.TimeOfDay.ToString(@"hh\:mm"))
                })
                    .ToList();
                if (stands.Count() != 0)
                {
                    ViewBag.spotkanieID = new SelectList(stands, "Id", "Description");
                }
                else
                {
                    kalendarz.lista = null;
                }
            }


            // else ViewBag.spotkanieID = new SelectList();


            return(View(kalendarz));
        }
        public ActionResult Index()
        {
            var sched = new DHXScheduler(this);
            var unit = new UnitsView("unit1", "room_id");
            sched.Views.Add(unit);

            var context = new DHXSchedulerModelsDataContext();

            //can add IEnumerable of objects, native units or dictionary
            unit.AddOptions(context.Rooms);//parse model objects
            sched.Config.details_on_create = true;
            sched.Config.details_on_dblclick = true;

            var timeline = new TimelineView("timeline", "room_id");
            timeline.RenderMode = TimelineView.RenderModes.Bar;
            var rooms = context.Rooms.ToList();
            timeline.FitEvents = false;
            sched.Views.Add(timeline);
            timeline.AddOptions(rooms);

            var select = new LightboxSelect("color", "Priority");
            select.AddOptions(new List<object>{
                new { key = "#ccc", label = "Low" },
                new { key = "#76B007", label = "Medium" },
                new { key = "#FE7510", label = "Hight" }
            });
            sched.Lightbox.Add(select);

            select = new LightboxSelect("room_id", "Room id");
            select.AddOptions(rooms);
            sched.Lightbox.Add(select);

            sched.LoadData = true;
            sched.EnableDataprocessor = true;
            sched.InitialDate = new DateTime(2011, 9, 5);
            return View(sched);
        }