public AgendaViewModel() { CustomerServiceAdapter = new ServiceAdapter <ICustomerService>(); Refresh(); View = new AgendaView { DataContext = this }; View.ShowDialog(); }
public AgendaViewModel() { CustomerServiceInstance = ClientServiceLocator.Instance().ContractLocator.CustomerServices; Refresh(); View = new AgendaView { DataContext = this }; View.ShowDialog(); }
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)); }
private void WeekRouletteView_DateChanged(object sender, RoutedEventArgs e) { DateChangeEvent change = (DateChangeEvent)sender; if (change.index > 0) { WeekRouletteView.SetActive(change.index); } AgendaView.RemoveAll(); LectureCont[] todaysLectures = Array.FindAll(lectures, (l) => l.Start.Date == change.date); Array.ForEach(todaysLectures, (l) => AgendaView.Add(new Lecture(l))); }
public IEnumerable <AgendaView> GetList(AgendaParams agendaParams) { CommonRepository rep = new CommonRepository(); //var dbset = rep.GetDBContext<AgendaTarget>(); List <AgendaView> list = (List <AgendaView>)repository.GetList(agendaParams); list.ForEach((v) => v.canManage = (v.authorid == agendaParams.userID)); for (int i = 0; i < list.Count(); i++) { AgendaView agenda = list.ElementAt(i); IEnumerable <AgendaTarget> targets = repository.GetTargetsList(Convert.ToInt32(agenda.id)); List <AgendaTarget> newTargets = new List <AgendaTarget>(); for (int j = 0; j < targets.Count(); j++) { var tar = targets.ElementAt(j); if (!string.IsNullOrWhiteSpace(tar.resAvatarUrl)) { //TODO 改成真正的图片地址 tar.resAvatarUrl = "https://demo.twproject.com/avatars/015403_9i9nB.jpeg"; } else { string resname = tar.resname; if (resname.Length == 2 || resname.Replace(" ", "").Length == 2) { // eg:刘 真,取:刘 真 tar.resAvatarUrl = string.Format("/img/svgAvatar?code={0}&fill=hsl%28180%2C70%25%2C80%25%29&stroke=hsl%28180%2C90%25%2C20%25%29" , System.Web.HttpUtility.UrlEncode(tar.resname.Replace(" ", ""), System.Text.Encoding.UTF8)); } else if (resname.Replace(" ", "").Length == 3) { // eg:刘天真,取:天真 tar.resAvatarUrl = string.Format("/img/svgAvatar?code={0}&fill=hsl%28180%2C70%25%2C80%25%29&stroke=hsl%28180%2C90%25%2C20%25%29" , System.Web.HttpUtility.UrlEncode(tar.resname.Replace(" ", "").Substring(1, 2), System.Text.Encoding.UTF8)); } else if (resname.IndexOf(" ") > 0) { // eg:Jimmy Smith,取:JM string[] arr = resname.Split(' '); string s = string.Empty; for (int m = 0; m < arr.Length; m++) { s += arr[m].Substring(0, 1); } tar.resAvatarUrl = string.Format("/img/svgAvatar?code={0}&fill=hsl%28180%2C70%25%2C80%25%29&stroke=hsl%28180%2C90%25%2C20%25%29" , System.Web.HttpUtility.UrlEncode(s, System.Text.Encoding.UTF8)); } else { tar.resAvatarUrl = string.Format("/img/svgAvatar?code={0}&fill=hsl%28180%2C70%25%2C80%25%29&stroke=hsl%28180%2C90%25%2C20%25%29" , System.Web.HttpUtility.UrlEncode(resname, System.Text.Encoding.UTF8)); } } newTargets.Add(tar); } agenda.targets = newTargets; agenda.schedule = repository.GetSchedule(agenda.scheduleid); if (agenda.schedule != null) { agenda.schedule.type = "period"; } } return(list); }
// 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)); }
// 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 Number"); var agenda = new AgendaView(); //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)); }