public IActionResult CreateSchedule(PerformanceViewModel model) { if (!ModelState.IsValid) { var result = this.scheduleService.GetSchedule(); var performanceView = mapper.Map <PerformanceViewModel>(result); return(View(nameof(CreateSchedule), performanceView)); } var create = this.scheduleService.CreateSchedule(model.Time, model.Play, model.School, model.SelectedUsers); if (!create) { var result = this.scheduleService.GetSchedule(); var performanceView = mapper.Map <PerformanceViewModel>(result); performanceView.StatusMessage = MessageConstants.ScheduleWrongDateTime; return(View(nameof(CreateSchedule), performanceView)); } return(Redirect(nameof(CreateSchedule))); }
/// <summary> /// Details of each Performance-. /// </summary> /// <param name="id">PerformanceId</param> /// <returns>Performance, Details view</returns> // GET: Performance/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Performance performance = db.Performances.Find(id); if (performance == null) { return(HttpNotFound()); } var model = new PerformanceViewModel { Id = performance.PerformanceId, KPI = performance.KPI, Discipline = performance.Discipline, Status = performance.Status, IssueDate = performance.IssueDate, Comment = performance.Comment, Decision = performance.Decision, CreationDate = performance.CreationDate, EmployeeName = performance.Employee.FullName, }; return(View(model)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Performance performance = db.Performances.Find(id); if (performance == null) { return(HttpNotFound()); } PerformanceViewModel model = new PerformanceViewModel { Id = performance.PerformanceId, KPI = performance.KPI, Discipline = performance.Discipline, Status = performance.Status, IssueDate = performance.IssueDate, Comment = performance.Comment, Decision = performance.Decision, CreationDate = performance.CreationDate, }; ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FullName"); return(View(model)); }
public ActionResult Create(PerformanceViewModel model) { if (ModelState.IsValid) { var performance = new Performance { PerformanceId = model.Id, KPI = model.KPI, Discipline = model.Discipline, Status = model.Status, IssueDate = model.IssueDate, Comment = model.Comment, Decision = model.Decision, CreationDate = DateTime.Now, EmployeeId = model.EmployeeId, }; db.Performances.Add(performance); db.SaveChanges(); return(RedirectToAction("Index")); } var list = db.Employees.ToList().Select(e => new { e.Id, e.FullName }); ViewBag.EmployeeId = new SelectList(list, "Id", "FullName"); ViewBag.PerformanceId = new SelectList(db.Performances, "PerformanceId", "Decision"); return(View(model)); }
public MainWindow() { InitializeComponent(); // Binding Settings and SettingsViewModel settingViewModel = SettingsViewModel.Instance; SettingPanel.DataContext = settingViewModel; // Binding SearchedList and SearchListViewModel searchedListView.ItemsSource = SearchedListViewModel.GetInstance(); // Binding performance and PerformanceViewModel performanceViewModel = PerformanceViewModel.Instance; gridPerformance.DataContext = performanceViewModel; // Binding sbStatusBar and StatusBarViewModel statusBarViewModel = StatusBarViewModel.Instance; sbStatusBar.DataContext = statusBarViewModel; // Binding sbStatusBar and SearchProcViewModel searchProcViewModel = SearchProcViewModel.Instance; gdSearchProc.DataContext = searchProcViewModel; // Create searchManager if (settingViewModel.AdvancedSearch == true) { searchManager = new AdvancedSearchManager(); } else { searchManager = new BasedSearchManager(); } searchManager.IndexProc(); }
public PerformanceViewModel ReturnPerformanceDetails(int id) { Performance performance = CheckPerformanceNullValue(id); PerformanceViewModel viewModel = new PerformanceViewModel { Performance = Mapper.Map <Performance, PerformanceDto>(performance), Performers = Mapper.Map <IEnumerable <Performer>, ICollection <PerformerDto> > (_performerRepository.Collection()), Venues = Mapper.Map <IEnumerable <Venue>, ICollection <VenueDto> > (_venueRepository.Collection()), EventDate = performance.EventDateTime.ToShortDateString(), EventTime = performance.EventDateTime.ToShortTimeString(), BudgetPrice = _reservationRepository.GetPrices(id).Budget, ModeratePrice = _reservationRepository.GetPrices(id).Moderate, PremierPrice = _reservationRepository.GetPrices(id).Premier, }; viewModel.SeatsRemaining = CountRemainingReservations(performance); Mapper.Map(_performerRepository.Find(performance.PerformerId), viewModel.Performance.PerformerDto); Mapper.Map(_venueRepository.Find(performance.VenueId), viewModel.Performance.VenueDto); return(viewModel); }
public PerformancePage() { NavigationPage.SetBackButtonTitle(this, ""); InitializeComponent(); BindingContext = _performanceViewModel = new PerformanceViewModel(Navigation); MessagingCenter.Subscribe <PerformanceViewModel>(this, "UserModelFilled", (sender) => BindGraph()); }
public MainWindowViewModel() { ConnectedState = DeviceConncectState.NoDevice; MainDockPanelVM = new PerformanceViewModel(); _logDataReceived += ((PerformanceViewModel)MainDockPanelVM).OnLogDataReceived; _adbLogDataReceived += ((PerformanceViewModel)MainDockPanelVM).OnADBLogDataReceived; Devices = new DeviceCollection(); }
// GET: Performance Photos public ActionResult Index() { var myViewModel = new PerformanceViewModel(); myViewModel.PhotoViewModel = PhotoBackend.Instance.Index(); return(View(myViewModel)); }
public ActionResult Index() { PerformanceViewModel model = new PerformanceViewModel(); model.Performances.Add(cpuPer.getCPUCounter()); model.Performances.Add(networkPer.GetNetworkCounter()); return(View(model)); }
public ActionResult Performance() { var model = new PerformanceViewModel { Students = _workResultService.GetAllStudents() }; return(View(model)); }
public IActionResult ExamplePerformance() { var performanceViewModel = new PerformanceViewModel { Title = "Example Rest API", PerformanceActionsViewModel = this.actionViewModels.Where(m => m.PerformanceActionType == PerformanceActionType.ExamplePerformance).First() }; return(View(performanceViewModel)); }
public ActionResult Performance(string request, string weatherEvent) { var model = new PerformanceViewModel(); if (weatherEvent != null) { model = GetDataByWeatherEvent(weatherEvent); } else { model = GetDataByZmw(request); } return(View(model)); }
public NewMainWindowViewModel() { ConnectedState = DeviceConncectState.NoDevice; MainDockPanelVM = new PerformanceViewModel(); _logDataReceived += ((PerformanceViewModel)MainDockPanelVM).OnLogDataReceived; _adbLogDataReceived += ((PerformanceViewModel)MainDockPanelVM).OnADBLogDataReceived; Devices = new DeviceCollection(); SessionViewModelCollection = new ObservableCollection <PerformanceSessionViewModel>(); SessionViewModelCollection.CollectionChanged += SessionViewModelCollection_CollectionChanged; this.Init(); }
public PerformanceViewModel GetDataByWeatherEvent(string weatherEvent) { var model = new PerformanceViewModel(); if (weatherEvent == "Andrew") { model.Temp = "21"; model.Humidity = "100"; model.Pressure = "922"; model.WindSpeed = "280"; model.Location = "Hurricane Andrew 08/24/1992"; } return(model); }
public async Task <IActionResult> OnPostAsync([FromBody] PerformanceViewModel vm) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); ApplicationUser user = _context.Users.Where(u => u.Id == userId).FirstOrDefault(); if (user == null) { return(BadRequest(new { status = 400, datail = "user not found" })); } user.Performance = vm.Performance; await _context.SaveChangesAsync(); return(Ok()); }
public void IndexProc(object sender = null) { StatusBarViewModel.Instance.ProcStatus = "Start Indexing..."; DateTime start = System.DateTime.Now; IndexProcRun(sender); DateTime end = System.DateTime.Now; PerformanceViewModel pvm = PerformanceViewModel.Instance; double interval = (end - start).TotalMilliseconds; pvm.AddIndexTime(interval, settingsVM.AdvancedSearch); StatusBarViewModel.Instance.ProcStatus = string.Format("Finish Indexing : {0}ms", interval.ToString("0.000")); }
public IHttpActionResult PutPerformance(int id, PerformanceViewModel performance) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != performance.Id) { return(BadRequest()); } //db.Entry(performance).State = EntityState.Modified; using (var ctx = new Tuks_Athletics_SystemEntities()) { var existingPerformance = ctx.Performances.Where(s => s.Performance_ID == performance.Id).FirstOrDefault <Performance>(); if (existingPerformance != null) { existingPerformance.Result = performance.Result; existingPerformance.Date = performance.Date; existingPerformance.Athlete_ID = performance.AthleteId; existingPerformance.Heat_ID = performance.HeatId; existingPerformance.Event_ID = performance.EventId; existingPerformance.Medal_ID = performance.MedalId; existingPerformance.Age_ID = performance.AgeId; existingPerformance.Competition_ID = performance.CompetitionId; } try { ctx.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PerformanceExists(id)) { return(NotFound()); } else { throw; } } } return(StatusCode(HttpStatusCode.NoContent)); }
protected override void Init() { _BuildInfo = GetBuildNumber(); _DeviceIdentifier = CrossDeviceInfo.Current.Id; _DeviceIdiom = CrossDeviceInfo.Current.Idiom.ToString(); _DeviceModel = CrossDeviceInfo.Current.Model; #if __ANDROID__ && TEST_EXPERIMENTAL_RENDERERS _DevicePlatform = "Android Fast Renderers"; #else _DevicePlatform = CrossDeviceInfo.Current.Platform.ToString(); #endif _DeviceVersionNumber = CrossDeviceInfo.Current.VersionNumber.ToString(); MessagingCenter.Subscribe <PerformanceTracker>(this, PerformanceTracker.RenderCompleteMessage, HandleRenderComplete); BindingContext = new PerformanceViewModel(_PerformanceProvider); Performance.SetProvider(_PerformanceProvider); _TestCases.AddRange(InflatePerformanceScenarios()); var nextButton = new Button { Text = Pending, IsEnabled = false, AutomationId = NextButtonId }; nextButton.Clicked += NextButton_Clicked; ViewModel.TestRunReferenceId = Guid.NewGuid(); var testRunRef = new Label { AutomationId = TestRunRefId, Text = ViewModel.TestRunReferenceId.ToString(), FontSize = 6, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, BackgroundColor = Color.Accent, TextColor = Color.White }; Content = new StackLayout { Children = { testRunRef, nextButton, _PerformanceTracker } }; ViewModel.BenchmarkResults = Task.Run(() => PerformanceDataManager.GetScenarioResults(_DeviceIdentifier)).GetAwaiter().GetResult(); nextButton.IsEnabled = true; nextButton.Text = Next; }
public PerformanceViewModel NewPerformanceViewModel() { var viewModel = new PerformanceViewModel { Performance = new PerformanceDto(), Performers = Mapper.Map <IEnumerable <Performer>, ICollection <PerformerDto> > (_performerRepository.Collection()), Venues = Mapper.Map <IEnumerable <Venue>, ICollection <VenueDto> > (_venueRepository.Collection()) }; return(viewModel); }
public void SearchProc(string input) { Tuple <long, List <long> > relevantList = relevantProvider.GetRelevantDocs(input); StatusBarViewModel.Instance.ProcStatus = "Start Searching..."; DateTime start = System.DateTime.Now; SearchProcRun(input, relevantList.Item1, relevantList.Item2); DateTime end = System.DateTime.Now; double interval = (end - start).TotalMilliseconds; PerformanceViewModel pvm = PerformanceViewModel.Instance; pvm.AddSearchTime(interval, settingsVM.AdvancedSearch); StatusBarViewModel.Instance.ProcStatus = string.Format("Finish Searching : {0}ms", interval.ToString("0.000")); }
public ActionResult Performancev1point1(string request, string weatherEvent) { var model = new PerformanceViewModel(); if (weatherEvent != null) { model = GetDataByWeatherEvent(weatherEvent); } else { model = GetDataByZmw(request); } ViewResult vr = View(model); vr.MasterName = "~/Views/Shared/_LayoutEmpty.cshtml"; return(vr); }
/* * PRIVATE METHOD */ private void CheckDateTime(PerformanceViewModel performanceViewModel) { var date = performanceViewModel.EventDate; var time = performanceViewModel.EventTime; if (!DateTime.TryParse($"{date} {time}", out var dateValue)) { ModelState.AddModelError("Performance.EventDateTime", "Please insert a valid Date and Time"); } if (DateTime.Compare(dateValue, DateTime.Now) < 0) { ModelState.AddModelError("Performance.EventDateTime", "Please submit a value later than current date/time"); } performanceViewModel.Performance.EventDateTime = dateValue; }
public IActionResult ViewAsPDF() { PerformanceViewModel pvm = new PerformanceViewModel(); // находим студента для текущего пользователя, если он не студент, то ничего не выводим var userId = _context.Users.First(u => u.UserName == User.Identity.Name).Id; var student = _context.Students.Where(e => e.AccountId == userId).FirstOrDefault(); if (student != null) { pvm.ListLines = _context.Marks.Where(m => m.StudentId == student.Id).Select(m => new PerformanceListItem() { Mark = m.MarkValue.Name, Subject = m.Statement.Subject.Name }).ToList(); pvm.StudentName = student.Name; } return(new ViewAsPdf("Index", pvm)); }
public PerformanceViewModel GetDataByZmw(string request) { var param = "api/4b22bd927f7356b7/conditions/q/zmw:" + request + ".json"; var model = new PerformanceViewModel(); HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://api.wunderground.com/"); // Add an Accept header for JSON format. client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); // List data response. HttpResponseMessage response = client.GetAsync(param).Result; // Blocking call! if (response.IsSuccessStatusCode) { string text = response.Content.ReadAsStringAsync().Result; JObject responseJObject = JObject.Parse(text); if (responseJObject["current_observation"] != null) { model.Temp = responseJObject["current_observation"]["temp_c"].ToString(); model.Humidity = responseJObject["current_observation"]["relative_humidity"].ToString().Replace("%", ""); model.Pressure = responseJObject["current_observation"]["pressure_mb"].ToString(); model.WindSpeed = responseJObject["current_observation"]["wind_kph"].ToString(); model.Location = responseJObject["current_observation"]["display_location"]["full"].ToString(); } //model.Humidity = xmlDoc //foreach (var d in dataObjects) //{ // Console.WriteLine("{0}", d.Name); //} } else { Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase); } return(model); }
public IActionResult GetPerformance() { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); ApplicationUser user = _context.Users.Where(u => u.Id == userId).FirstOrDefault(); if (user == null) { return(BadRequest(new { status = 400, datail = "user not found" })); } var result = new PerformanceViewModel() { StartDate = user.StartDate, Cash = user.Cash, Performance = user.Performance }; return(Ok(result)); }
public Byte[] GetPhotoByZmw(string request) { var param = "api/4b22bd927f7356b7/satellite/q/zmw:" + request + ".json"; var model = new PerformanceViewModel(); string imgUrl = ""; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://api.wunderground.com/"); // Add an Accept header for JSON format. client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); // List data response. HttpResponseMessage response = client.GetAsync(param).Result; // Blocking call! if (response.IsSuccessStatusCode) { string text = response.Content.ReadAsStringAsync().Result; JObject responseJObject = JObject.Parse(text); imgUrl = responseJObject["satellite"]["image_url"].ToString(); imgUrl = imgUrl.Replace("height=300", "height=1200"); imgUrl = imgUrl.Replace("width=300", "width=1200"); imgUrl = imgUrl.Replace("radius=75", "radius=100"); imgUrl += "&smooth=1"; } else { Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase); } var webClient = new WebClient(); Byte[] b = webClient.DownloadData(imgUrl); return(b); }
public void EditPerformance(PerformanceViewModel performanceViewModel, int id) { Performance performanceToEdit = CheckPerformanceNullValue(id); performanceToEdit.EventDateTime = performanceViewModel.Performance.EventDateTime; performanceToEdit.IsActive = true; performanceToEdit.PerformerId = performanceViewModel.Performance.PerformerDto.Id; performanceToEdit.VenueId = performanceViewModel.Performance.VenueDto.Id; ReservationPrices prices = new ReservationPrices { Budget = performanceViewModel.BudgetPrice, Moderate = performanceViewModel.ModeratePrice, Premier = performanceViewModel.PremierPrice }; reservationService.SetNewReservationPrices(id, prices); _repository.Commit(); }
public void CreatePerformance(PerformanceViewModel performanceViewModel) { var performance = new Performance { EventDateTime = performanceViewModel.Performance.EventDateTime, IsActive = true, PerformerId = performanceViewModel.Performance.PerformerDto.Id, VenueId = performanceViewModel.Performance.VenueDto.Id, }; IEnumerable <SimpleReservation> budgetReservations = reservationService.CreateSimpleReservations(performance.VenueId, SeatType.Budget, performanceViewModel.BudgetPrice); IEnumerable <SimpleReservation> moderateReservations = reservationService.CreateSimpleReservations(performance.VenueId, SeatType.Moderate, performanceViewModel.ModeratePrice); IEnumerable <SimpleReservation> premierReservations = reservationService.CreateSimpleReservations(performance.VenueId, SeatType.Premier, performanceViewModel.PremierPrice); IEnumerable <SimpleReservation> allReservations = reservationService.CombineReservations(budgetReservations, moderateReservations, premierReservations); _repository.Insert(performance); _repository.Commit(); _reservationRepository.BulkInsertReservations(allReservations, performance.Id); }
// to display the performance of all the employees public IActionResult Performance() { var performance = new PerformanceViewModel(); performance.DataPoint = new List <DataPointViewModel> (); performance.Rating = new List <RatingViewModel> (); var updatedEmployes = _employee.Print(userId()); for (int i = 0; i < updatedEmployes.Count; i++) { performance.Rating.Add(new RatingViewModel { Id = updatedEmployes[i].Id, FirstName = updatedEmployes[i].FirstName, Rating = updatedEmployes[i].Rating }); performance.DataPoint.Add((new DataPointViewModel(updatedEmployes[i].FirstName, updatedEmployes[i].Rating))); } ViewBag.DataPoints = JsonConvert.SerializeObject(performance.DataPoint); return(View(performance)); }
public void UpdatePerformancesForDay() { PerformancesForDay.Clear(); Task.Run(() => { List<Performance> performances = performanceService.GetPerformancesForDay(CurrentDay.DateTime); foreach (var perf in performances) { PerformanceViewModel vm = new PerformanceViewModel(this, performanceService, perf, artistService.GetArtistById(perf.ArtistId), venueService.GetVenueById(perf.VenueId)); PlatformService.Instance.RunByUiThread(() => { PerformancesForDay.Add(vm); }); } }); }
public void AddNotification(PerformanceViewModel performance, NotificationType type) { if (NotificationCollection == null) { NotificationCollection = new Dictionary<string, List<NotificationViewModel>>(); } List<NotificationViewModel> list; if (!NotificationCollection.TryGetValue(performance.ArtistViewModel.EMail, out list)) { list = new List<NotificationViewModel>(); } list.Add(new NotificationViewModel { Performance = performance, NotificationType = type }); NotificationCollection[performance.ArtistViewModel.EMail] = list; }