// GET: RackSamples/Create public IActionResult Create(int BurialId, string Burial, string Subplot, int Num) { if (BurialId <= 0) { return(NotFound()); } ViewBag.Id = BurialId; ViewBag.Burial = Burial; ViewBag.Subplot = Subplot; ViewBag.Num = Num; RackViewModel viewModel = new RackViewModel { BurialId = BurialId, RackSample = new RackSample { BurialId = BurialId, }, BurialList = _context.Burial.Where(x => x.BurialId == BurialId).ToList(), }; var role = (mummyContext.UserRoles .Where(r => r.UserId == userManager.GetUserId(User)) .FirstOrDefault()); if (!(role is null)) { ViewBag.Role = Int32.Parse(role.RoleId); } ViewData["BurialId"] = new SelectList(_context.Burial, "BurialId", "BurialWrapping"); return(View(viewModel)); }
private void CreateLabels() { RackViewModel model = (RackViewModel)Model; Label lb = new Label { BackgroundColor = Color.FromHex("#3d567c"), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, TextColor = Color.White, }; lb.Text = model.No; lb.SetBinding(Label.FontSizeProperty, new Binding("SchemeFontSize")); if (model.RackOrientation == RackOrientationEnum.HorizontalLeft || model.RackOrientation == RackOrientationEnum.VerticalUp) { grid.Children.Add(lb, 0, 0); } if (model.RackOrientation == RackOrientationEnum.HorizontalRight) { grid.Children.Add(lb, model.Sections, 0); } if (model.RackOrientation == RackOrientationEnum.VerticalDown) { grid.Children.Add(lb, 0, model.Sections); } }
public RackSchemeView(RackViewModel rvm) : base(rvm) { InitializeComponent(); CreateSections(); CreateLabels(); FillSections(); }
public Player(IContainer ioc, Color color, Orientation orientation) { Color = color; Rack = new RackViewModel(this, ioc) { Orientation = orientation }; }
public void Update(RackViewModel rvm) { model = rvm; BindingContext = model; CreateGrid(); CreateLabels(); FillBins(); }
public RackCardPage(RackViewModel rvm) { model = rvm; BindingContext = model; InitializeComponent(); Title = AppResources.RackCardPage_Title + " " + model.No; MessagingCenter.Subscribe <BinsViewModel>(this, "BinsIsLoaded", BinsIsLoaded); }
protected override void OnSizeAllocated(double width, double height) { base.OnSizeAllocated(width, height); RackViewModel model = (RackViewModel)Model; model.SchemeWidth = width; model.SchemeHeight = height; model.SchemeFontSize = 12; }
public RackEditPage(RackViewModel rvm) { model = rvm; BindingContext = model; InitializeComponent(); Title = AppResources.RackEditPage_Title + " " + rvm.No; orientationpicker.ItemsSource = Global.OrientationList; orientationpicker.SelectedItem = Global.OrientationList.Find(x => x.RackOrientation == rvm.RackOrientation); }
public IActionResult Put(int id, [FromBody] RackViewModel value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } value.RackId = id; rackService.UpdateRack(value); return(Ok(rackService.GetRack(id))); }
public RackCardPage(RackViewModel rvm, ObservableCollection <RackViewModel> rsvm) { model = rvm; model.IsSelected = true; BindingContext = model; InitializeComponent(); LinkPlanRackViewModels = rsvm; ScaleMode = false; Title = AppResources.RackCardPage_Title + " " + model.No; UpdateToolbarLabels(); }
public JavaScriptResult Create(RackViewModel rackvm) { try { _rackService.Add(Mapper.Map <Rack>(rackvm)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/Rack"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
private async Task AddRackTaped() { Rack newrack = new Rack(); newrack.Sections = Settings.DefaultRackSections; newrack.Levels = Settings.DefaultRackLevels; newrack.Depth = Settings.DefaultRackDepth; newrack.SchemeVisible = true; RackViewModel rvm = new RackViewModel(Navigation, newrack, true); rvm.CanChangeLocationAndZone = true; await Navigation.PushAsync(new RackNewPage(rvm)); }
public void Update(RackViewModel rvm) { model = rvm; BindingContext = model; if (model.Sections > 0 && model.Levels > 0) { grid.IsVisible = false; CreateGrid(); CreateLabels(); FillBins(); grid.IsVisible = true; } }
public void Update(RackViewModel rvm) { model = rvm; if ((oldSections != model.Sections) || (oldLevels != model.Levels)) { CreateGrid(); CreateLabels(); oldSections = rvm.Sections; oldLevels = rvm.Levels; BinInEditRackViews.Clear(); EmptySpaceViewInRacks.Clear(); } FillBins(); }
public RackViewModel UpdateRack(RackViewModel model) { var result = new PHRMRackModel() { RackId = model.RackId, Name = model.Name, Description = model.Description, CreatedBy = model.CreatedBy, CreatedOn = model.CreatedOn }; db.Entry(result).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(model); }
protected override void OnSizeAllocated(double width, double height) { base.OnSizeAllocated(width, height); RackViewModel model = (RackViewModel)Model; model.SchemeWidth = width; model.SchemeHeight = height; double fs = width; if (width > height) { fs = width / (model.Sections + 1); } model.SchemeFontSize = fs * 0.6; }
public RackNewPage(RackViewModel rvm) { model = rvm; BindingContext = model; InitializeComponent(); Title = AppResources.RackNewPage_Title; infopanel.BindingContext = model.BinsViewModel; locationpicker.ItemsSource = model.Locations; zonepicker.ItemsSource = model.Zones; orientationpicker.ItemsSource = Global.OrientationList; bintemplatepicker.ItemsSource = model.BinTemplates; MessagingCenter.Subscribe <RackViewModel>(this, "ZonesIsLoaded", ZonesIsLoaded); MessagingCenter.Subscribe <RackViewModel>(this, "LocationsIsLoaded", LocationsIsLoaded); }
public RackViewModel GetRack(int id) { var query = db.PHRMRack.Where(x => x.RackId == id).FirstOrDefault(); var result = new RackViewModel() { RackId = query.RackId, Name = query.Name, ParentRackName = (from rack in db.PHRMRack where rack.RackId == query.ParentId select rack.Name).FirstOrDefault(), Description = query.Description, CreatedBy = query.CreatedBy, CreatedOn = query.CreatedOn }; return(result); }
public RackViewModel AddRack(PHRMRackModel model) { db.PHRMRack.Add(model); db.SaveChanges(); var result = new RackViewModel() { RackId = model.RackId, Name = model.Name, ParentRackName = (from rack in db.PHRMRack where rack.RackId == model.ParentId select rack.Name).FirstOrDefault(), Description = model.Description, CreatedBy = model.CreatedBy, CreatedOn = model.CreatedOn, }; return(result); }
public void UpdateUDS() { RackViewModel model = (RackViewModel)Model; foreach (Label lbl1 in udslabels) { if (grid.Children.Contains(lbl1)) { grid.Children.Remove(lbl1); } } udslabels.Clear(); for (int i = 1; i <= model.Sections; i++) { Label label1 = NewLabel(); label1.TextColor = Color.White; if (model.UDSSelects is List <SubSchemeSelect> ) { List <SubSchemeSelect> list = model.UDSSelects.FindAll(x => x.Section == i); if (list is List <SubSchemeSelect> ) { int quantity = 0; foreach (SubSchemeSelect sss in list) { quantity += sss.Value; label1.BackgroundColor = Color.FromHex(sss.HexColor); } if (quantity != 0) { label1.SetBinding(Label.FontSizeProperty, new Binding("SchemeFontSize")); label1.Text = quantity.ToString(); } } } AddToGrid(model, label1, i); udslabels.Add(label1); } }
private void AddToGrid(RackViewModel model, Label label1, int i) { switch (model.RackOrientation) { case RackOrientationEnum.HorizontalLeft: grid.Children.Add(label1, i, 0); break; case RackOrientationEnum.HorizontalRight: grid.Children.Add(label1, i - 1, 0); break; case RackOrientationEnum.VerticalUp: grid.Children.Add(label1, 0, i); break; case RackOrientationEnum.VerticalDown: grid.Children.Add(label1, 0, i - 1); break; } }
private void FillSections() { RackViewModel model = (RackViewModel)Model; for (int i = 1; i <= model.Sections; i++) { Label label1 = NewLabel(); if (model.SubSchemeSelects is List <SubSchemeSelect> ) { List <SubSchemeSelect> list = model.SubSchemeSelects.FindAll(x => x.Section == i); if (list is List <SubSchemeSelect> ) { if (list.Count > 0) { label1.BackgroundColor = Color.Red; label1.TextColor = Color.White; } int quantity = 0; foreach (SubSchemeSelect sss in list) { quantity += sss.Value; } if (quantity != 0) { label1.SetBinding(Label.FontSizeProperty, new Binding("SchemeFontSize")); label1.Text = quantity.ToString(); } } } AddToGrid(model, label1, i); } }
private void RackTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { //loadTrayButton.IsEnabled = true; if (e.NewValue == null) { return; } var eType = e.NewValue.GetType(); if (eType == typeof(Tray)) { var tray = (Tray)e.NewValue; var dataContext = DataContext as MainViewModel; dataContext.SelectedTrayInRack = tray; dataContext.SelectedTypeId = 0; if (tray.Status != TrayStatus.TS_Empty) { TrayUIWithLight trayUI = new TrayUIWithLight(); trayUI.DataContext = tray; ShowContent.Content = trayUI; } } else if (eType == typeof(Rack)) { //loadTrayButton.IsEnabled = true; Rack rack = (Rack)e.NewValue; var dataContext = DataContext as MainViewModel; dataContext.SelectedRack = rack; dataContext.SelectedTypeId = 1; RackUserControl rc = new RackUserControl(); RackViewModel rcVm = new RackViewModel(); rcVm.Rack = rack; rcVm.Trays = dataContext.Trays; rc.DataContext = rcVm; ShowContent.Content = rc; } }
private void CreateSections() { RackViewModel model = (RackViewModel)Model; if ((model.RackOrientation == RackOrientationEnum.HorizontalLeft || model.RackOrientation == RackOrientationEnum.HorizontalRight)) { for (int i = 1; i <= model.Sections + 1; i++) { grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); } } if ((model.RackOrientation == RackOrientationEnum.VerticalUp || model.RackOrientation == RackOrientationEnum.VerticalDown)) { for (int i = 1; i <= model.Sections + 1; i++) { grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); } } }
private async void RackList_SelectedItemChanged(object sender, EventArgs e) { RackViewModel rvm = (RackViewModel)sender; if (rvm != model) { RackViewModel lastrvm = model; model.IsSelected = false; model = rvm; BindingContext = model; lastrvm.BinsViewModel.BinViewModelsDispose(); model.IsSelected = true; model.State = ModelState.Loading; model.LoadingText = AppResources.RackCardPage_LoadingText; Title = AppResources.RackCardPage_Title + " " + model.No; await model.LoadBins(); await model.LoadUDF(); await model.LoadBinValues(); await model.LoadBinImages(); } }
private void UpdateRackViewModel(RackViewModel rvm) { }