Esempio n. 1
0
        public List <SupplierProductsViewModel> GetProductLink([FromBody] CodesViewModel model)
        {
            List <SchoolProductsLink>        ls         = _context.SchoolProductsLink.Where(m => m.ProductId.ToString() == model.Code).ToList();
            List <SupplierProductsViewModel> returnList = new List <SupplierProductsViewModel>();

            ls.ForEach(pl => {
                SupplierProducts sp = _context.SupplierProducts.Where(p => p.ProductId.ToString() == pl.ProductCode).FirstOrDefault();


                returnList.Add(new SupplierProductsViewModel {
                    BrandCode     = sp.BrandCode,
                    ProductCode   = sp.ProductCode,
                    CatalogueCode = sp.CatalogueCode,
                    CategoryCode  = sp.CategoryCode,
                    Description   = sp.Description,
                    Image         = sp.Image,
                    ProductId     = sp.ProductId,
                    RetailPrice   = sp.RetailPrice,
                    SupplierPrice = sp.SupplierPrice,
                    SuppliersId   = sp.SuppliersId,
                    UOMCode       = sp.UOMCode,
                    UserID        = sp.UserID,
                    Colour        = sp.Color
                });
            });


            return(returnList);
        }
Esempio n. 2
0
        public bool Code012Delete([FromBody] CodesViewModel model)
        {
            Codes dbCode = _context.Codes.Where(c => c.Type == "012" && c.Code == model.Code).FirstOrDefault();

            dbCode.Active = false;
            _context.Codes.Remove(dbCode);
            _context.SaveChanges();
            return(true);
        }
Esempio n. 3
0
        public bool Code012Update([FromBody] CodesViewModel model)
        {
            Codes dbCode = _context.Codes.Where(c => c.Type == "012" && c.Code == model.Code).FirstOrDefault();

            dbCode.CodeDescription = model.CodeDescription;
            _context.Codes.Update(dbCode);
            _context.SaveChanges();
            return(true);
        }
Esempio n. 4
0
        public IActionResult Codes()
        {
            var data      = RouteData.Values["data"];
            var dataValue = (data != null) ? RouteData.Values["data"].ToString() : string.Empty;


            var vm = new CodesViewModel()
            {
                Data = dataValue
            };

            return(View(vm));
        }
Esempio n. 5
0
        // GET: Codes
        public async Task <IActionResult> Index(int?CodeId, int?CodebookId)
        {
            CodesViewModel Model = new CodesViewModel();

            Model.CodeId     = CodeId;
            Model.CodebookId = CodebookId;
            if (CodeId == null && CodebookId == null)
            {
                return(NotFound());
            }
            else if (CodeId != null)
            {
                Model.Rows = _context.Codes.Where(x => x.CodeId == CodeId).Select(x => new CodesViewModel.Row()
                {
                    Id        = x.Id,
                    Code      = x.Code,
                    Title     = x.Title,
                    Company   = x.Company,
                    Ordinal   = x.Ordinal,
                    CreatedOn = x.CreatedOn
                }).ToList();
                var code = _context.Codes.Where(x => x.Id == CodeId);
                Model.Superior = code.FirstOrDefault().Title;
                Model.scid     = code.FirstOrDefault().CodeId;
                Model.scbid    = code.FirstOrDefault().CodebookId;
            }
            else if (CodebookId != null)
            {
                Model.Rows = _context.Codes.Where(x => x.CodebookId == CodebookId).Select(x => new CodesViewModel.Row()
                {
                    Id        = x.Id,
                    Code      = x.Code,
                    Title     = x.Title,
                    Company   = x.Company,
                    Ordinal   = x.Ordinal,
                    CreatedOn = x.CreatedOn
                }).ToList();
                Model.Superior = _context.Codebooks.Where(x => x.Id == CodebookId).FirstOrDefault().Title;
                Model.scbid    = _context.Codebooks.Where(x => x.Id == CodebookId).FirstOrDefault().Id;
            }
            return(View(Model));
        }
Esempio n. 6
0
		public override void CreateViewModels()
		{
			ServiceFactory.Events.GetEvent<SelectGKZoneEvent>().Subscribe(OnSelectGKZone);
			ServiceFactory.Events.GetEvent<SelectGKZonesEvent>().Subscribe(OnSelectGKZones);
			ServiceFactory.Events.GetEvent<SelectGKGuardZoneEvent>().Subscribe(OnSelectGKGuardZone);
			ServiceFactory.Events.GetEvent<SelectGKGuardZonesEvent>().Subscribe(OnSelectGKGuardZones);
			ServiceFactory.Events.GetEvent<SelectGKDelayEvent>().Subscribe(OnSelectGKDelay);
			ServiceFactory.Events.GetEvent<SelectGKDelaysEvent>().Subscribe(OnSelectGKDelays);
			ServiceFactory.Events.GetEvent<SelectGKDirectionEvent>().Subscribe(OnSelectGKDirection);
			ServiceFactory.Events.GetEvent<SelectGKDirectionsEvent>().Subscribe(OnSelectGKDirections);
			ServiceFactory.Events.GetEvent<SelectGKMPTEvent>().Subscribe(OnSelectGKMPT);
			ServiceFactory.Events.GetEvent<SelectGKMPTsEvent>().Subscribe(OnSelectGKMPTs);
			ServiceFactory.Events.GetEvent<SelectGKDoorEvent>().Subscribe(OnSelectGKDoor);
			ServiceFactory.Events.GetEvent<SelectGKDoorsEvent>().Subscribe(OnSelectGKDoors);
			ServiceFactory.Events.GetEvent<SelectGKDeviceEvent>().Subscribe(OnSelectGKDevice);
			ServiceFactory.Events.GetEvent<SelectGKDevicesEvent>().Subscribe(OnSelectGKDevices);
			ServiceFactory.Events.GetEvent<SelectGKPumpStationEvent>().Subscribe(OnSelectGKPumpStation);
			ServiceFactory.Events.GetEvent<SelectGKPumpStationsEvent>().Subscribe(OnSelectGKPumpStations);

			DevicesViewModel = new DevicesViewModel();
			ParameterTemplatesViewModel = new ParameterTemplatesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			DelaysViewModel = new DelaysViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			MPTsViewModel = new MPTsViewModel();
			CodesViewModel = new CodesViewModel();
			GuardZonesViewModel = new GuardZonesViewModel();
			DoorsViewModel = new DoorsViewModel();
			SKDZonesViewModel = new SKDZonesViewModel();
			DeviceLidraryViewModel = new LibraryViewModel();
			OPCViewModel = new OPCsViewModel();
			DescriptorsViewModel = new DescriptorsViewModel();
			DiagnosticsViewModel = new DiagnosticsViewModel();
			_planExtension = new GKPlanExtension();
		}
Esempio n. 7
0
		public GuardMenuViewModel(CodesViewModel context)
		{
			Context = context;
		}