示例#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);
        }
        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);
        }
        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));
        }
示例#4
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);
        }
        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));
        }
示例#6
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));
        }
示例#7
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();
        }
        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));
        }
示例#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);

            // ------------------------- 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);
        }
示例#10
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();
        }