예제 #1
0
        // 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));
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        public RackSchemeView(RackViewModel rvm) : base(rvm)
        {
            InitializeComponent();

            CreateSections();
            CreateLabels();
            FillSections();
        }
예제 #4
0
 public Player(IContainer ioc, Color color, Orientation orientation)
 {
     Color = color;
     Rack  = new RackViewModel(this, ioc)
     {
         Orientation = orientation
     };
 }
예제 #5
0
 public void Update(RackViewModel rvm)
 {
     model          = rvm;
     BindingContext = model;
     CreateGrid();
     CreateLabels();
     FillBins();
 }
예제 #6
0
 public RackCardPage(RackViewModel rvm)
 {
     model          = rvm;
     BindingContext = model;
     InitializeComponent();
     Title = AppResources.RackCardPage_Title + " " + model.No;
     MessagingCenter.Subscribe <BinsViewModel>(this, "BinsIsLoaded", BinsIsLoaded);
 }
예제 #7
0
        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);
 }
예제 #9
0
 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();
 }
예제 #11
0
 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')"));
     }
 }
예제 #12
0
        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));
        }
예제 #13
0
        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;
            }
        }
예제 #14
0
        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);
        }
예제 #16
0
        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;
        }
예제 #17
0
        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);
        }
예제 #20
0
        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);
            }
        }
예제 #21
0
        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;
            }
        }
예제 #22
0
        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);
            }
        }
예제 #23
0
        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;
            }
        }
예제 #24
0
        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();
            }
        }
예제 #26
0
 private void UpdateRackViewModel(RackViewModel rvm)
 {
 }