Exemplo n.º 1
0
        public ActionResult InventoryDetails(int id)
        {
            ViewData["AssetsManagement"] = "active";
            var viewModel = new InventoryDetailsViewModel()
            {
                Inventory      = assetsManagementService.GetSiteInventory(id),
                InventoryItems = assetsManagementService.GetSiteInventoryItemsByInventoryId(id)
            };

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public ActionResult Inventory()
        {
            var repo = CarMasterRepoFactory.Create();

            var vehicles        = repo.GetVehiclesForSale();
            var newVehicleList  = vehicles.Where(x => x.VehicleType.TypeDescription.Equals("New"));
            var usedVehicleList = vehicles.Where(x => x.VehicleType.TypeDescription.Equals("Used"));

            //Set inventoryVM lists to new list of detailVM
            InventoryViewModel viewModel = new InventoryViewModel();

            viewModel.NewVehicles  = new List <InventoryDetailsViewModel>();
            viewModel.UsedVehicles = new List <InventoryDetailsViewModel>();

            //List of new vehicles
            foreach (var vehicle in newVehicleList)
            {
                InventoryDetailsViewModel view = new InventoryDetailsViewModel();
                view.Year       = vehicle.Year;
                view.Make       = vehicle.Model.Make.MakeDescription;
                view.Model      = vehicle.Model.ModelDescription;
                view.Count      = newVehicleList.Count();
                view.StockValue = newVehicleList.Select(x => x.MSRP).Sum();
                viewModel.NewVehicles.Add(view);
            }
            //List of used vehicles
            foreach (var vehicle in usedVehicleList)
            {
                InventoryDetailsViewModel view = new InventoryDetailsViewModel();
                view.Year       = vehicle.Year;
                view.Make       = vehicle.Model.Make.MakeDescription;
                view.Model      = vehicle.Model.ModelDescription;
                view.Count      = usedVehicleList.Count();
                view.StockValue = usedVehicleList.Select(x => x.MSRP).Sum();
                viewModel.UsedVehicles.Add(view);
            }
            //Send list of new and used to view
            return(View(viewModel));
        }
 public dynamic GetDetailsViewModels()
 {
     using (var context = _entities.GetDbContext(database))
     {
         return(((IEnumerable <dynamic>)context.InventoryDetails).Select(x =>
         {
             dynamic newItem = new InventoryDetailsViewModel();
             newItem.LongDescription = x.LongDescription;
             newItem.Alias = x.Alias;
             newItem.Version = x.Version;
             newItem.RevisionDate = x.RevisionDate;
             newItem.RevisionReason = x.RevisionReason;
             newItem.Predecessor = x.Predecessor;
             newItem.InventoryTypeID = x.InventoryTypeID;
             newItem.DocumentType = x.DocumentType;
             newItem.FormOwner = x.FormOwner;
             newItem.FormCostCenter = x.FormCostCenter;
             newItem.ProductCategory = x.ProductCategory;
             newItem.ProductNumber = x.ProductNumber;
             newItem.Channel = x.Channel;
             newItem.Viewability = x.Viewability;
             newItem.CanBackorder = x.CanBackorder;
             newItem.IsFulfillment = x.IsFulfillment;
             newItem.IsMarketing = x.IsMarketing;
             newItem.IsUserKitContainer = x.IsUserKitContainer;
             newItem.IsBulkOrder = x.IsBulkOrder;
             newItem.SpecialMessage = x.SpecialMessage;
             newItem.SpecialMessageActivationDate = x.SpecialMessageActivationDate;
             newItem.SpecialMessageDeactivationDate = x.SpecialMessageDeactivationDate;
             newItem.InventoryPricingTypeID = x.InventoryPricingTypeID;
             newItem.IsPrintCostApproved = x.IsPrintCostApproved;
             newItem.NoCostItem = x.NoCostItem;
             newItem.PricingType = x.PricingType;
             newItem.PrintCost = x.PrintCost;
             newItem.FulfillmentCost = x.FulfillmentCost;
             newItem.ChargebackCost = x.ChargebackCost;
             newItem.OrderQtyMin = x.OrderQtyMin;
             newItem.OrderQtyMax = x.OrderQtyMax;
             newItem.OrderQtyMax = x.OrderQtyMax;
             newItem.ReplaceDate = x.ReplaceDate;
             newItem.ReplacePart = x.ReplacePart;
             newItem.ReplaceReason = x.ReplaceReason;
             newItem.EffectiveDate = x.EffectiveDate;
             newItem.ObsoleteDate = x.ObsoleteDate;
             newItem.IsObsoleted = x.IsObsoleted;
             newItem.IsReplaced = x.IsReplaced;
             newItem.IncludeState = x.IncludeState;
             newItem.ExcludeState = x.ExcludeState;
             newItem.Popularity = x.Popularity;
             newItem.PageflexJobName = x.PageflexJobName;
             newItem.CalculatedMaxOrderQty = x.CalculatedMaxOrderQty;
             newItem.BusinessOwnerRoleID = x.BusinessOwnerRoleID;
             newItem.OrderQtyMaxFrequency = x.OrderQtyMaxFrequency;
             newItem.CreateDate = x.CreateDate;
             newItem.CreateUser = x.CreateUser;
             newItem.ModDate = x.ModDate;
             newItem.ModUser = x.ModUser;
             newItem.IsAppBuilder = x.IsAppBuilder;
             newItem.AppBuilderSort = x.AppBuilderSort;
             newItem.CanRemoveDuplicates = x.CanRemoveDuplicates;
             newItem.PersonalizeFillableFields = x.PersonalizeFillableFields;
             newItem.ServiceProductIds = x.ServiceProductIds;
             return newItem;
         }).ToList());
     }
 }
Exemplo n.º 4
0
        public void Test3()
        {
            //make sure different entities can have different properties
            using (var context = _entities.GetDbContext(Databases.ABC))
            {
                var item = ((IEnumerable <dynamic>)context.InventoryDetails).Where(x => x.MultimediaURL != null).Select(
                    x =>
                {
                    dynamic newItem                        = new InventoryDetailsViewModel();
                    newItem.LongDescription                = x.LongDescription;
                    newItem.Alias                          = x.Alias;
                    newItem.Version                        = x.Version;
                    newItem.RevisionDate                   = x.RevisionDate;
                    newItem.RevisionReason                 = x.RevisionReason;
                    newItem.Predecessor                    = x.Predecessor;
                    newItem.InventoryTypeID                = x.InventoryTypeID;
                    newItem.DocumentType                   = x.DocumentType;
                    newItem.FormOwner                      = x.FormOwner;
                    newItem.FormCostCenter                 = x.FormCostCenter;
                    newItem.ProductCategory                = x.ProductCategory;
                    newItem.ProductNumber                  = x.ProductNumber;
                    newItem.Program                        = x.Program;
                    newItem.Viewability                    = x.Viewability;
                    newItem.CanBackorder                   = x.CanBackorder;
                    newItem.IsFulfillment                  = x.IsFulfillment;
                    newItem.IsMarketing                    = x.IsMarketing;
                    newItem.IsUserKitContainer             = x.IsUserKitContainer;
                    newItem.IsBulkOrder                    = x.IsBulkOrder;
                    newItem.SpecialMessage                 = x.SpecialMessage;
                    newItem.SpecialMessageActivationDate   = x.SpecialMessageActivationDate;
                    newItem.SpecialMessageDeactivationDate = x.SpecialMessageDeactivationDate;
                    newItem.InventoryPricingTypeID         = x.InventoryPricingTypeID;
                    newItem.IsPrintCostApproved            = x.IsPrintCostApproved;
                    newItem.NoCostItem                     = x.NoCostItem;
                    newItem.PricingType                    = x.PricingType;
                    newItem.PrintCost                      = x.PrintCost;
                    newItem.FulfillmentCost                = x.FulfillmentCost;
                    newItem.ChargebackCost                 = x.ChargebackCost;
                    newItem.OrderQtyMin                    = x.OrderQtyMin;
                    newItem.OrderQtyMax                    = x.OrderQtyMax;
                    newItem.OrderQtyMax                    = x.OrderQtyMax;
                    newItem.ReplaceDate                    = x.ReplaceDate;
                    newItem.ReplacePart                    = x.ReplacePart;
                    newItem.ReplaceReason                  = x.ReplaceReason;
                    newItem.EffectiveDate                  = x.EffectiveDate;
                    newItem.ObsoleteDate                   = x.ObsoleteDate;
                    newItem.IsObsoleted                    = x.IsObsoleted;
                    newItem.IsReplaced                     = x.IsReplaced;
                    newItem.IncludeState                   = x.IncludeState;
                    newItem.ExcludeState                   = x.ExcludeState;
                    newItem.Popularity                     = x.Popularity;
                    newItem.PageflexJobName                = x.PageflexJobName;
                    newItem.CalculatedMaxOrderQty          = x.CalculatedMaxOrderQty;
                    newItem.BusinessOwnerRoleID            = x.BusinessOwnerRoleID;
                    newItem.OrderQtyMaxFrequency           = x.OrderQtyMaxFrequency;
                    newItem.CreateDate                     = x.CreateDate;
                    newItem.CreateUser                     = x.CreateUser;
                    newItem.ModDate                        = x.ModDate;
                    newItem.ModUser                        = x.ModUser;
                    newItem.IsAppBuilder                   = x.IsAppBuilder;
                    newItem.AppBuilderSort                 = x.AppBuilderSort;
                    newItem.CanRemoveDuplicates            = x.CanRemoveDuplicates;
                    newItem.MultimediaURL                  = x.MultimediaURL;
                    return(newItem);
                }).FirstOrDefault();

                Assert.IsTrue(item.MultimediaURL == "Testing");
            }
            using (var context = _entities.GetDbContext(Databases.Standard))
            {
                var item = ((IEnumerable <dynamic>)context.InventoryDetails).Where(x => x.ServiceProductIds != null)
                           .Select(x =>
                {
                    dynamic newItem                        = new InventoryDetailsViewModel();
                    newItem.LongDescription                = x.LongDescription;
                    newItem.Alias                          = x.Alias;
                    newItem.Version                        = x.Version;
                    newItem.RevisionDate                   = x.RevisionDate;
                    newItem.RevisionReason                 = x.RevisionReason;
                    newItem.Predecessor                    = x.Predecessor;
                    newItem.InventoryTypeID                = x.InventoryTypeID;
                    newItem.DocumentType                   = x.DocumentType;
                    newItem.FormOwner                      = x.FormOwner;
                    newItem.FormCostCenter                 = x.FormCostCenter;
                    newItem.ProductCategory                = x.ProductCategory;
                    newItem.ProductNumber                  = x.ProductNumber;
                    newItem.Channel                        = x.Channel;
                    newItem.Viewability                    = x.Viewability;
                    newItem.CanBackorder                   = x.CanBackorder;
                    newItem.IsFulfillment                  = x.IsFulfillment;
                    newItem.IsMarketing                    = x.IsMarketing;
                    newItem.IsUserKitContainer             = x.IsUserKitContainer;
                    newItem.IsBulkOrder                    = x.IsBulkOrder;
                    newItem.SpecialMessage                 = x.SpecialMessage;
                    newItem.SpecialMessageActivationDate   = x.SpecialMessageActivationDate;
                    newItem.SpecialMessageDeactivationDate = x.SpecialMessageDeactivationDate;
                    newItem.InventoryPricingTypeID         = x.InventoryPricingTypeID;
                    newItem.IsPrintCostApproved            = x.IsPrintCostApproved;
                    newItem.NoCostItem                     = x.NoCostItem;
                    newItem.PricingType                    = x.PricingType;
                    newItem.PrintCost                      = x.PrintCost;
                    newItem.FulfillmentCost                = x.FulfillmentCost;
                    newItem.ChargebackCost                 = x.ChargebackCost;
                    newItem.OrderQtyMin                    = x.OrderQtyMin;
                    newItem.OrderQtyMax                    = x.OrderQtyMax;
                    newItem.OrderQtyMax                    = x.OrderQtyMax;
                    newItem.ReplaceDate                    = x.ReplaceDate;
                    newItem.ReplacePart                    = x.ReplacePart;
                    newItem.ReplaceReason                  = x.ReplaceReason;
                    newItem.EffectiveDate                  = x.EffectiveDate;
                    newItem.ObsoleteDate                   = x.ObsoleteDate;
                    newItem.IsObsoleted                    = x.IsObsoleted;
                    newItem.IsReplaced                     = x.IsReplaced;
                    newItem.IncludeState                   = x.IncludeState;
                    newItem.ExcludeState                   = x.ExcludeState;
                    newItem.Popularity                     = x.Popularity;
                    newItem.PageflexJobName                = x.PageflexJobName;
                    newItem.CalculatedMaxOrderQty          = x.CalculatedMaxOrderQty;
                    newItem.BusinessOwnerRoleID            = x.BusinessOwnerRoleID;
                    newItem.OrderQtyMaxFrequency           = x.OrderQtyMaxFrequency;
                    newItem.CreateDate                     = x.CreateDate;
                    newItem.CreateUser                     = x.CreateUser;
                    newItem.ModDate                        = x.ModDate;
                    newItem.ModUser                        = x.ModUser;
                    newItem.IsAppBuilder                   = x.IsAppBuilder;
                    newItem.AppBuilderSort                 = x.AppBuilderSort;
                    newItem.CanRemoveDuplicates            = x.CanRemoveDuplicates;
                    newItem.PersonalizeFillableFields      = x.PersonalizeFillableFields;
                    newItem.ServiceProductIds              = x.ServiceProductIds;
                    return(newItem);
                }).FirstOrDefault();

                Assert.IsTrue(item.ServiceProductIds == "Testing");
            }
        }