/// <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); }
public MainMenuViewModel() { Menu = new ObservableCollection <ItemMenu>(); var product = new ItemMenu() { Name = "Продукт", Open = new Command((() => { var view = new ProductsView(); CurrentPage = view; })) }; var unit = new ItemMenu() { Name = "Единицы измерения", Open = new Command((() => { var view = new UnitsView(); CurrentPage = view; })) }; var recipe = new ItemMenu() { Name = "Рецепты", Open = new Command((() => { var view = new RecipeView(); CurrentPage = view; })) }; var provider = new ItemMenu() { Name = "Поставщики", Open = new Command((() => { var view = new ProductsView(); CurrentPage = view; })) }; var location = new ItemMenu() { Name = "Локации", Open = new Command((() => { var view = new LocationView(); CurrentPage = view; })) }; Menu.Add(product); Menu.Add(unit); Menu.Add(location); Menu.Add(recipe); Menu.Add(provider); }
public ActionResult Index() { var sched = new DHXScheduler(this); var unit = new UnitsView("unit1", "section_id"); sched.Views.Add(unit); var timeline = new TimelineView("timeline", "section_id") { RenderMode = TimelineView.RenderModes.Bar, X_Unit = TimelineView.XScaleUnits.Day, X_Size = 7, X_Date = "%d" }; sched.Views.Add(timeline); var list_name = "sections"; unit.ServerList = list_name; timeline.ServerList = list_name; sched.Config.show_loading = true; // check LoadTimelineSections/Index.cshtml for a client-side settings sched.BeforeInit.Add("customEvents()"); sched.InitialView = timeline.Name; return(View(sched)); }
public ActionResult Index() { var locale = SchedulerLocalization.Localizations.English; var skin = DHXScheduler.Skins.Standart; var request_lang = this.Request.QueryString["language"]; var request_skin = this.Request.QueryString["skin"]; if (!string.IsNullOrEmpty(request_lang)) { locale = (SchedulerLocalization.Localizations)Enum.Parse(typeof(SchedulerLocalization.Localizations), request_lang); } if (!string.IsNullOrEmpty(request_skin)) { skin = (DHXScheduler.Skins)Enum.Parse(typeof(DHXScheduler.Skins), request_skin); } var scheduler = new DHXScheduler(this); scheduler.Skin = skin; scheduler.Localization.Set(locale); scheduler.InitialDate = new DateTime(2011, 11, 24); scheduler.XY.scroll_width = 0; scheduler.Config.first_hour = 8; scheduler.Config.last_hour = 19; scheduler.Config.time_step = 30; scheduler.Config.multi_day = true; scheduler.Config.limit_time_select = true; scheduler.Localization.Directory = "locale"; var rooms = Repository.Rooms.ToList(); var unit = new UnitsView("unit1", "room_id"); unit.AddOptions(rooms); 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); scheduler.EnableDataprocessor = true; scheduler.LoadData = true; scheduler.InitialDate = new DateTime(2011, 9, 19); return(View(new LocaleData(scheduler, locale.ToString(), skin.ToString()))); }
Unit GetUnitsFromView(UnitsView unitView) { var unitType = Assembly .GetAssembly(GetType()) .GetTypes().FirstOrDefault(t => t.Name == unitView.ClassName); if (unitType == null) { return(null); } var newUnit = (Unit)Activator.CreateInstance(unitType); Mapper.Map(unitView, newUnit); return(newUnit); }
public ActionResult Index() { var sched = new DHXScheduler(this); var unit = new UnitsView("unit1", "room_id"); sched.Views.Add(unit); var context = new DHXSchedulerModelsDataContext(); unit.AddOptions(context.Rooms.ToList()); sched.Data.Parse(context.Events); sched.EnableDataprocessor = true; sched.InitialDate = new DateTime(2011, 9, 5); return View(sched); }
public LogBattle Optimize(BattleSettingsItem battleSettingsItem) { var watch = System.Diagnostics.Stopwatch.StartNew(); var threadCount = battleSettingsItem.ThreadCount; var quantumWeight = battleSettingsItem.HandWeight / (battleSettingsItem.Precision == 0 ? 1 : battleSettingsItem.Precision); var attackHandPattern = battleSettingsItem.AttackHands[0]; var quantumList = new List <List <UnitsView> >(); foreach (var paternUnit in attackHandPattern.UnitsView.Where(p => p.Weight > 0).Where(p => p.Count > 0)) { var unitsPerQuant = (int)Math.Max(quantumWeight / paternUnit.Weight, 1); var quantumPerHandCount = (int)(battleSettingsItem.HandWeight / (unitsPerQuant * paternUnit.Weight)); var quantumFromExistsUnitsCount = (int)paternUnit.Count / unitsPerQuant; var quantumCount = Math.Min(quantumPerHandCount, quantumFromExistsUnitsCount); var quantumListItem = new List <UnitsView>(); for (var i = 0; i < quantumCount; i++) { var quantomUnit = new UnitsView { Count = unitsPerQuant * (i + 1), ClassName = paternUnit.ClassName, UnitAttackPower = paternUnit.UnitAttackPower, UnitArmor = paternUnit.UnitArmor, Weight = paternUnit.Weight }; quantumListItem.Add(quantomUnit); } quantumList.Add(quantumListItem); } var combinations = new List <List <UnitsView> >(); for (var i = 0; i < quantumList.Count; i++) { Combine(quantumList, new List <UnitsView>(), battleSettingsItem.HandWeight, combinations, i); } var defenceHands = GetHandsFromViewGroups(battleSettingsItem.DefenceHands); var defenceTurrelsGroups = GetUnitGroupsFromViewGroups(battleSettingsItem.DefenceTurrels); var bestResult = decimal.MaxValue; var bestIndex = 0; var itemsForLastThread = combinations.Count % threadCount; var itemsPerThread = (combinations.Count - itemsForLastThread) / threadCount; var tasksList = new Task <(decimal BestResult, int BestIndex)> [threadCount];
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 List <UnitsView> GetDefaultUnitsView(Type unitType) { var ret = new List <UnitsView>(); var units = GetDefaultUnits(unitType); foreach (var unit in units) { var viewItem = new UnitsView { Name = unit.Name, Weight = unit.Weight, ClassName = unit.GetType().Name }; ret.Add(viewItem); } return(ret); }
public override void Render(StringBuilder builder, DHXScheduler par) { if (!this.HandleDifferentResources) { return; } List <SchedulerView> schedulerViewList = new List <SchedulerView>(); for (int index = 0; index < par.Views.Count; ++index) { if (par.Views[index] is UnitsView || par.Views[index] is TimelineView) { schedulerViewList.Add(par.Views[index]); } } if (schedulerViewList.Count == 0) { return; } List <string> stringList = new List <string>(); foreach (SchedulerView schedulerView in schedulerViewList) { UnitsView unitsView = schedulerView as UnitsView; if (unitsView != null) { stringList.Add(unitsView.Property); } else { TimelineView timelineView = schedulerView as TimelineView; if (timelineView != null) { stringList.Add(timelineView.Y_Property); } } } string[] strArray = new string[stringList.Count]; for (int index = 0; index < stringList.Count; ++index) { strArray[index] = string.Format("(ev.{0} == evs[i].{0})", (object)stringList[index]); } builder.Append(string.Format("\n\t{0}.attachEvent(\"onEventCollision\", function(ev, evs){{ var c = 0, l = {0}.config.collision_limit;for (var i=0; i<evs.length; i++) {{ if (", (object)par.Name)); builder.Append(string.Join("&&", strArray)); builder.Append("&& ev.id != evs[i].id) c++; } return !(c < l);});"); }
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)); }
// GET: StaticLoading public ActionResult Index() { var sched = new DHXScheduler(this); var unit = new UnitsView("unit1", "room_id"); sched.Views.Add(unit); var rooms = Repository.Rooms.ToList(); unit.AddOptions(rooms); sched.Data.Parse(Repository.Events); sched.EnableDataprocessor = true; sched.InitialDate = new DateTime(2011, 9, 5); return(View(sched)); }
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)); }
public ActionResult Index(FormCollection data) { var sched = new DHXScheduler(this); var rooms = new DHXSchedulerDataContext().Rooms.ToList(); var unit = new UnitsView("rooms", "room_id"); unit.Label = "Rooms"; unit.AddOptions(rooms); sched.Views.Add(unit); sched.InitialView = unit.Name; sched.InitialDate = new DateTime(2011, 9, 7); sched.LoadData = true; sched.EnableDataprocessor = true; return View(new SchedulerFilterModel(sched, rooms)); }
/// <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)); }
public ActionResult Index(FormCollection data) { var sched = new DHXScheduler(this); var rooms = new DHXSchedulerModelsDataContext().Rooms.ToList(); var unit = new UnitsView("rooms", "room_id"); unit.Label = "Rooms"; unit.AddOptions(rooms); sched.Views.Add(unit); sched.InitialView = unit.Name; sched.InitialDate = new DateTime(2011, 9, 7); sched.LoadData = true; sched.EnableDataprocessor = true; return(View(new SchedulerFilterModel(sched, rooms))); }
public override void Initialize() { // setup players var humanPlayer = new PlayerHuman(); // setup map/board Globals.Instance.GameWorld.Intialize(200, 160, humanPlayer, null); //humanPlayer.UnitMoved += Player_UnitMoved; //humanPlayer.TurnEnded += Player_TurnEnded; //humanPlayer.AddSettlement("Margeritaville", Point2.Create(1, 1), Globals.Instance.RaceTypes[0]); humanPlayer.AddUnit(4, Point2.Create(2, 2)); // cavalry humanPlayer.AddUnit(0, Point2.Create(0, 1)); // spearman humanPlayer.StartTurn(); _hud = new Hud(Game); _hud.Initialize(); _gameMapView = new GameMapView(Globals.Instance.GameWorld, new Rectangle(0, 0, Game.GraphicsDevice.Viewport.Width, Game.GraphicsDevice.Viewport.Height), _hud); _unitsView = new UnitsView(Globals.Instance.GameWorld); Globals.Instance.GameWorld.StartTurnForHumanPlayer(); }
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() { 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); }
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)); }
public ActionResult Index() { SchedulerLocalization.Localizations lang; var language = this.Request.QueryString["language"]; var skn = this.Request.QueryString["skin"]; DHXScheduler.Skins skin; #region language switch (this.Request.QueryString["language"]) { case "ar": lang = SchedulerLocalization.Localizations.Arabic; break; case "be": lang = SchedulerLocalization.Localizations.Belarusian; break; case "ca": lang = SchedulerLocalization.Localizations.Catalan; break; case "cn": lang = SchedulerLocalization.Localizations.Chinese; break; case "cs": lang = SchedulerLocalization.Localizations.Czech; break; case "da": lang = SchedulerLocalization.Localizations.Danish; break; case "nl": lang = SchedulerLocalization.Localizations.Dutch; break; case "fi": lang = SchedulerLocalization.Localizations.Finnish; break; case "fr": lang = SchedulerLocalization.Localizations.French; break; case "de": lang = SchedulerLocalization.Localizations.German; break; case "el": lang = SchedulerLocalization.Localizations.Greek; break; case "he": lang = SchedulerLocalization.Localizations.Hebrew; break; case "hu": lang = SchedulerLocalization.Localizations.Hungarian; break; case "id": lang = SchedulerLocalization.Localizations.Indonesia; break; case "it": lang = SchedulerLocalization.Localizations.Italian; break; case "jp": lang = SchedulerLocalization.Localizations.Japanese; break; case "no": lang = SchedulerLocalization.Localizations.Norwegian; break; case "pl": lang = SchedulerLocalization.Localizations.Polish; break; case "pt": lang = SchedulerLocalization.Localizations.Portuguese; break; case "ro": lang = SchedulerLocalization.Localizations.Romanian; break; case "ru": lang = SchedulerLocalization.Localizations.Russian; break; case "si": lang = SchedulerLocalization.Localizations.Slovenian; break; case "es": lang = SchedulerLocalization.Localizations.Spanish; break; case "sv": lang = SchedulerLocalization.Localizations.Swedish; break; case "tr": lang = SchedulerLocalization.Localizations.Turkish; break; case "ua": lang = SchedulerLocalization.Localizations.Ukrainian; break; default: lang = SchedulerLocalization.Localizations.English; language = "en"; break; } #endregion #region skin switch (this.Request.QueryString["skin"]) { case "glossy": skin = DHXScheduler.Skins.Glossy; break; case "terrace": skin = DHXScheduler.Skins.Terrace; break; default: skin = DHXScheduler.Skins.Standart; skn = "classic"; break; } #endregion var scheduler = new DHXScheduler(this); scheduler.Skin = DHXScheduler.Skins.Terrace; scheduler.InitialDate = new DateTime(2011, 11, 24); scheduler.XY.scroll_width = 0; scheduler.Config.first_hour = 8; scheduler.Config.last_hour = 19; scheduler.Config.time_step = 30; scheduler.Config.multi_day = true; scheduler.Config.limit_time_select = true; scheduler.Skin = skin; scheduler.Localization.Directory = "locale"; scheduler.Localization.Set(lang, false); var rooms = new DHXSchedulerModelsDataContext().Rooms.ToList(); var unit = new UnitsView("unit1", "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); scheduler.EnableDataprocessor = true; scheduler.LoadData = true; scheduler.InitialDate = new DateTime(2011, 9, 19); return View(new LocaleData(scheduler, language, skn)); }
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)); }
// GET: /Appointments/ /// <summary> /// The calendar. /// </summary> /// <param name="id"> /// The patient id. /// </param> /// <param name="firstName"> /// The first name. /// </param> /// <param name="lastName"> /// The last name. /// </param> /// <param name="view"> /// The view. /// </param> /// <param name="officeNum"> /// The officeNum. /// </param> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public ActionResult Calendar(int?id, string firstName, string lastName, string view, string officeNum) { if (id != null) { try { AccessControl.VerifyUserAccessToPatient(id.GetValueOrDefault()); } catch (HttpResponseException) { return(new HttpForbiddenResult()); } } var authorizationTicketHelper = new AuthorizationTicketHelper(); var user = authorizationTicketHelper.GetUserInfo(); var employeeId = this.appointmentManager.GetEmployeeIdByUserId(user.Id).GetValueOrDefault(); var startDate = DateTime.Now.Date.AddDays(-Convert.ToDouble(DateTime.Now.DayOfWeek)); var endDate = DateTime.Now.Date.AddDays(6 - Convert.ToDouble(DateTime.Now.DayOfWeek)); var userOfficeId = Convert.ToInt32(user.OfficeId); if (!string.IsNullOrEmpty(officeNum)) { if (user.OfficeNum != officeNum) { var companyId = OfficeHelper.GetCompanyId(officeNum); if (companyId != user.CompanyId) { return(new HttpForbiddenResult()); } } userOfficeId = this.officeHelper.GetOfficeById(officeNum).OfficeId; } var scheduler = this.appointmentManager.GetSchedulerConfiguration( userOfficeId, (int)employeeId, startDate, endDate, view, user.CompanyId); var sched = new DHXScheduler { DataAction = this.Url.Action("Data"), SaveAction = this.Url.Action("Save"), Skin = DHXScheduler.Skins.Terrace, Config = { multi_day = true, start_on_monday = false, use_select_menu_space = false, fix_tab_position = false, show_loading = false, mark_now = true, touch = true, touch_drag = 700, touch_tip = false, time_step = 5, hour_date = "%h:%i %A" }, InitialDate = DateTime.Now //// beginDate //// DateTime.Now }; sched.Extensions.Add(SchedulerExtensions.Extension.PDF); // load data initially sched.LoadData = true; sched.UpdateFieldsAfterSave(); // save client-side changes sched.EnableDataprocessor = true; sched.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Week); // add resource units to the scheduler and replace the normal daily view. sched.Views.Items.RemoveAt(2); ////day (will replace this one.) sched.Views.Items.RemoveAt(0); ////month ////initializes the view var agenda = new AgendaView { Label = "List", StartDate = startDate, EndDate = endDate }; sched.Views.Items.Insert(0, agenda); var units = new UnitsView("resource", "Id") { Label = "Day", Property = "resourceId", SkipIncorrect = true }; units.AddOptions( scheduler.Resources.Select( resource => new CalendarUnit { key = resource.Id.ToString(), label = resource.DisplayName }) .ToList()); units.Size = 50; sched.Views.Items.Insert(1, units); for (var i = 0; i < sched.Views.Count; i++) { sched.Views[i].TabPosition = 15 + (i * 60); sched.Views[i].TabClass = "week_tab"; } var preferences = SchedulerPreferencesVm.FromDictionary(new SchedulerPreferencesManager().GetSchedulerPreferences(user.OfficeNum)); if (view == "resource" || preferences.DefaultView == (int)WorkspaceType.DailyView) { sched.InitialView = sched.Views[1].Name; sched.InitialDate = endDate; } ////sched.DataAction = "Data?userId=" + userId + "&officeId=" + officeId; sched.DataAction = "Data?userId=" + user.Id + "&officeId=" + userOfficeId; sched.Calendars.AttachMiniCalendar(); ////var cal = sched.Calendars.AttachMiniCalendar(); ////cal.Navigation = true; ////cal.Position = "dhx_cal_tab"; scheduler.Scheduler = sched; this.ViewBag.id = id; this.ViewBag.firstName = firstName; this.ViewBag.lastName = lastName; var security = new Security(); var isExceptionPermitted = security.IsSingleLocationUserInRole(user.Id, "Schedule Exceptions"); this.ViewBag.isExceptionPermitted = isExceptionPermitted; return(this.View(scheduler)); }
private void mi_Units_Click(object sender, RoutedEventArgs e) { UnitsView v = new UnitsView(); v.ShowDialog(); }
// 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)); }
/// <summary> /// Block time areas /// </summary> /// <returns></returns> public ActionResult Limit() { var sched = new DHXScheduler(this); sched.InitialDate = new DateTime(2011, 9, 19); // block specific date range sched.TimeSpans.Add(new DHXBlockTime() { StartDate = new DateTime(2011, 9, 14), EndDate = new DateTime(2011, 9, 17) }); // block each tuesday from 12AM to 15PM sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Tuesday, Zones = new List<Zone>() { new Zone { Start = 0, End = 15 * 60 } } }); // block each sunday sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Sunday }); // block each monday from 12am to 8am, and from 18pm to 12am of the next day sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Monday, Zones = new List<Zone>() { new Zone { Start = 0, End = 8 * 60 }, new Zone { Start = 18 * 60, End = 24 * 60 } } }); #region add units and timeline var rooms = new DHXSchedulerDataContext().Rooms.ToList(); var unit = new UnitsView("unit", "room_id"); unit.AddOptions(rooms);//parse model objects sched.Views.Add(unit); var timeline = new TimelineView("timeline", "room_id"); timeline.RenderMode = TimelineView.RenderModes.Bar; timeline.FitEvents = false; timeline.AddOptions(rooms); sched.Views.Add(timeline); #endregion //block different sections in timeline and units view sched.TimeSpans.Add(new DHXBlockTime() { FullWeek = true, Sections = new List<Section>() { new Section(unit.Name, rooms.Take(2).Select(r => r.key.ToString()).ToArray()), new Section(timeline.Name, rooms.Skip(2).Select(r => r.key.ToString()).ToArray()) } }); sched.LoadData = true; sched.EnableDataprocessor = true; return View(sched); }
/// <summary> /// Index /// </summary> /// <returns></returns> public ActionResult Index() { _scheduler = new DHXScheduler(this) { Config = { first_hour = 5, last_hour = 24, hour_size_px = 88, time_step = 30, //full_day = true, // Chọn thời gian cho cả ngày separate_short_events = true, wide_form = true, show_loading = true, // show tooltip Tooltip_ClassName = "dhtmlXTooltip tooltip", Tooltip_timeout_to_display = 50, Tooltip_delta_x = 10, Tooltip_delta_y = -20, }, Skin = DHXScheduler.Skins.Flat, XY = { scroll_width = 0, }, Height = 650, //AjaxMode = TransactionModes.REST, }; // Set language //_scheduler.Localization.Directory = "locale"; //_scheduler.Localization.Set(SchedulerLocalization.Localizations.English, false); var evBox = new DHXEventTemplate { CssClass = _scheduler.Templates.event_class = "my_event", //<span class='event_date'>{start_date:date(%H:%i)} - {end_date:date(%H:%i)}</span><br/> Template = @"<div class='my_event_body'> <span>by: <strong style='color: red; font-weight: bold; text-decoration: underline; text-transform: uppercase;'> {user_name}</strong></span><br> <% if((ev.end_date - ev.start_date) / 60000 > 60) { %> Begin: <span class='event_date'>{start_date:date(%H:%i)}</span><br/> End: <span class='event_date'>{end_date:date(%H:%i)}</span><br/> <% } else { %> <span class='event_date'>{start_date:date(%H:%i)}</span><br/> <% } %> <span>{text}</span><br> <div style=""padding-top:5px;""> Duration: <b><%= (ev.end_date - ev.start_date) / (60 * 60 * 1000) %></b> hours </div> </div>" }; _scheduler.Templates.EventBox = evBox; _scheduler.Templates.tooltip_text = @"<div class='tootip_date'> <span>by: <strong style='color: red; font-weight: bold; text-decoration: underline; text-transform: uppercase;'> {user_name}</strong></span><br> <% if((ev.end_date - ev.start_date) / 60000 > 60) { %> Begin: <span class='event_date'>{start_date:date(%H:%i)}</span><br/> End: <span class='event_date'>{end_date:date(%H:%i)}</span><br/> <% } else { %> <span class='event_date'>{start_date:date(%H:%i)}</span><br/> <% } %> <strong>{text}</strong><br> <span>{details}</span><br> <span>Room: <strong>{label}</strong></span><br> <% if(ev.laptop_id == null) { %> <span>Laptop: <strong>Not Use</strong></span><br> <% } else { %> <span>Laptop: <strong>{laptop_id}</strong></span><br> <% } %> <% if(ev.projector_id == null) { %> <span>Projector: <strong>Not Use</strong></span><br> <% } else { %> <span>Projector: <strong>{projector_id}</strong></span><br> <% } %> <div style=""padding-top:5px;""> Duration: <b><%= (ev.end_date - ev.start_date) / (60 * 60 * 1000) %></b> hours </div> </div>"; #region views configuration //// Lock Time => //_scheduler.TimeSpans.Add(new DHXMarkTime() //{ // FullWeek = true, // Day = DayOfWeek.Thursday, // CssClass = "red_section",// apply this css class to the section // HTML = "LockTime", // inner html of the section // Zones = new List<Zone>() { new Zone { Start = 12 * 60, End = 14 * 60 } }, // SpanType = DHXTimeSpan.Type.BlockEvents//if specified - user can't create event in this area //}); //// BlockEvents Sunday //_scheduler.TimeSpans.Add(new DHXMarkTime() //{ // Day = DayOfWeek.Sunday, // CssClass = "green_section", // SpanType = DHXTimeSpan.Type.BlockEvents //}); _scheduler.UpdateFieldsAfterSave(); _scheduler.EnableDynamicLoading(SchedulerDataLoader.DynamicalLoadingMode.Day); _scheduler.Extensions.Add(SchedulerExtensions.Extension.Limit); _scheduler.Extensions.Add(SchedulerExtensions.Extension.PDF); _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("rooms", "room_id") { Label = "Rooms", }; List<Room> rooms = null; if (Request.IsAuthenticated) { if (User.IsInRole("Manager") || User.IsInRole("General Director") || User.IsInRole("GA")) { rooms = Repository.GetAll<Room>().OrderBy(r => r.position).ToList(); } //else if (User.IsInRole("GA")) //{ // rooms = Repository.GetAll<Room>().Where(r => r.for_dept == "GA").OrderBy(r => r.position).ToList(); //} else if (User.IsInRole("Employee")) { rooms = Repository.GetAll<Room>().Where(r => r.for_dept == "Employee").OrderBy(r => r.position).ToList(); } } else { rooms = Repository.GetAll<Room>().OrderBy(r => r.position).ToList(); } var listRooms = new List<object>(); if (rooms != null) { foreach (var room in rooms) { listRooms.Add(new { key = room.key, label = room.label }); } units.AddOptions(rooms); // sets X-Axis items to names of employees } _scheduler.Views.Add(units); //adds a tab with the units view _scheduler.PreventCache(); _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; string viewName = "meetingRoom/Home/LightboxCustomControl"; //string viewName = "Home/LightboxCustomControl"; var box = _scheduler.Lightbox.SetExternalLightbox(viewName, 730, 530); box.ClassName = "custom_lightbox"; #endregion //#region lightbox configuration //_scheduler.Lightbox.Add(new LightboxText("text", "Title") { Height = 28, Focus = true }); // adds the control to the lightbox //_scheduler.Lightbox.Add(new LightboxText("details", "Content") { Height = 60 }); //var selectRoom = new LightboxSelect("room_id", "Select Room"); //selectRoom.AddOptions(listRooms); //_scheduler.Lightbox.Add(selectRoom); //AddSelectLaptopAndProject(); //_scheduler.Lightbox.Add(new LightboxText("other_devices", "Other Devices") { Height = 50 }); //_scheduler.Lightbox.Add(new LightboxMiniCalendar("time", "Time")); //#endregion #region data // enables dataprocessor if (Request.IsAuthenticated) { _scheduler.EnableDataprocessor = true; } else { _scheduler.Config.isReadonly = true; } _scheduler.LoadData = true; //'says' to send data request after scheduler initialization _scheduler.Data.DataProcessor.UpdateFieldsAfterSave = true; //Responsive _scheduler.BeforeInit.Add(string.Format("initResponsive({0})", _scheduler.Name)); #endregion return View(_scheduler); }
/// <summary> /// Block time areas /// </summary> /// <returns></returns> public ActionResult Limit() { var sched = new DHXScheduler(this); sched.InitialDate = new DateTime(2011, 9, 19); // block specific date range sched.TimeSpans.Add(new DHXBlockTime() { StartDate = new DateTime(2011, 9, 14), EndDate = new DateTime(2011, 9, 17) }); // block each tuesday from 12AM to 15PM sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Tuesday, Zones = new List <Zone>() { new Zone { Start = 0, End = 15 * 60 } } }); // block each sunday sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Sunday }); // block each monday from 12am to 8am, and from 18pm to 12am of the next day sched.TimeSpans.Add(new DHXBlockTime() { Day = DayOfWeek.Monday, Zones = new List <Zone>() { new Zone { Start = 0, End = 8 * 60 }, new Zone { Start = 18 * 60, End = 24 * 60 } } }); #region add units and timeline var rooms = new DHXSchedulerModelsDataContext().Rooms.ToList(); var unit = new UnitsView("unit", "room_id"); unit.AddOptions(rooms);//parse model objects sched.Views.Add(unit); var timeline = new TimelineView("timeline", "room_id"); timeline.RenderMode = TimelineView.RenderModes.Bar; timeline.FitEvents = false; timeline.AddOptions(rooms); sched.Views.Add(timeline); #endregion //block different sections in timeline and units view sched.TimeSpans.Add(new DHXBlockTime() { FullWeek = true, Sections = new List <Section>() { new Section(unit.Name, rooms.Take(2).Select(r => r.key.ToString()).ToArray()), new Section(timeline.Name, rooms.Skip(2).Select(r => r.key.ToString()).ToArray()) } }); sched.LoadData = true; sched.EnableDataprocessor = true; return(View(sched)); }
public ActionResult Index() { SchedulerLocalization.Localizations lang; var language = this.Request.QueryString["language"]; var skn = this.Request.QueryString["skin"]; DHXScheduler.Skins skin; #region language switch (this.Request.QueryString["language"]) { case "ar": lang = SchedulerLocalization.Localizations.Arabic; break; case "be": lang = SchedulerLocalization.Localizations.Belarusian; break; case "ca": lang = SchedulerLocalization.Localizations.Catalan; break; case "cn": lang = SchedulerLocalization.Localizations.Chinese; break; case "cs": lang = SchedulerLocalization.Localizations.Czech; break; case "da": lang = SchedulerLocalization.Localizations.Danish; break; case "nl": lang = SchedulerLocalization.Localizations.Dutch; break; case "fi": lang = SchedulerLocalization.Localizations.Finnish; break; case "fr": lang = SchedulerLocalization.Localizations.French; break; case "de": lang = SchedulerLocalization.Localizations.German; break; case "el": lang = SchedulerLocalization.Localizations.Greek; break; case "he": lang = SchedulerLocalization.Localizations.Hebrew; break; case "hu": lang = SchedulerLocalization.Localizations.Hungarian; break; case "id": lang = SchedulerLocalization.Localizations.Indonesia; break; case "it": lang = SchedulerLocalization.Localizations.Italian; break; case "jp": lang = SchedulerLocalization.Localizations.Japanese; break; case "no": lang = SchedulerLocalization.Localizations.Norwegian; break; case "pl": lang = SchedulerLocalization.Localizations.Polish; break; case "pt": lang = SchedulerLocalization.Localizations.Portuguese; break; case "ru": lang = SchedulerLocalization.Localizations.Russian; break; case "ro": lang = SchedulerLocalization.Localizations.Romanian; break; case "si": lang = SchedulerLocalization.Localizations.Slovenian; break; case "es": lang = SchedulerLocalization.Localizations.Spanish; break; case "sv": lang = SchedulerLocalization.Localizations.Swedish; break; case "tr": lang = SchedulerLocalization.Localizations.Turkish; break; case "ua": lang = SchedulerLocalization.Localizations.Ukrainian; break; default: lang = SchedulerLocalization.Localizations.English; language = "en"; break; } #endregion #region skin switch (this.Request.QueryString["skin"]) { case "glossy": skin = DHXScheduler.Skins.Glossy; break; case "terrace": skin = DHXScheduler.Skins.Terrace; break; default: skin = DHXScheduler.Skins.Standart; skn = "classic"; break; } #endregion var scheduler = new DHXScheduler(this); scheduler.InitialDate = new DateTime(2011, 11, 24); scheduler.XY.scroll_width = 0; scheduler.Config.first_hour = 8; scheduler.Config.last_hour = 19; scheduler.Config.time_step = 30; scheduler.Config.multi_day = true; scheduler.Config.limit_time_select = true; scheduler.Skin = skin; scheduler.Localization.Directory = "locale"; scheduler.Localization.Set(lang, false); var rooms = new DHXSchedulerDataContext().Rooms.ToList(); var unit = new UnitsView("unit1", "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); scheduler.EnableDataprocessor = true; scheduler.LoadData = true; scheduler.InitialDate = new DateTime(2011, 9, 19); return(View(new LocaleData(scheduler, language, skn))); }