Exemplo n.º 1
0
        private bool DeductBalanceForCancellingGRN(Guid UnloadingId, SqlTransaction tran)
        {
            bool isSaved = false;
            // get stacks unloaded.
            List <StackUnloadedBLL> list = null;
            StackUnloadedBLL        o    = new StackUnloadedBLL();

            o.UnloadingId = UnLoadingId;
            list          = o.GetStackInformationByUnloadingId();
            if (list != null)
            {
                if (list.Count > 0)
                {
                    foreach (StackUnloadedBLL i in list)
                    {
                        InventoryServices.GetInventoryService().LoadFromStack(i.StackId, i.NumberOfbags, 0, tran);
                    }
                }
            }
            else
            {
                isSaved = false;
            }
            return(isSaved);
        }
Exemplo n.º 2
0
        private InventoryServices CreateInventoryService()
        {
            var userID  = Guid.Parse(User.Identity.GetUserId());
            var service = new InventoryServices();

            return(service);
        }
Exemplo n.º 3
0
        public async Task CanAddProductToDB()
        {
            // Arrange
            DbContextOptions <ProductDbContext> options = new DbContextOptionsBuilder <ProductDbContext>()
                                                          .UseInMemoryDatabase("CanAddPostToDB")
                                                          .Options;

            // open the connection to the database
            using (ProductDbContext context = new ProductDbContext(options))
            {
                InventoryServices inventoryServices = new InventoryServices(context);

                Product product = new Product()
                {
                    Name        = "This is our Test Name",
                    Description = "Let's see if this works! YAYY!"
                };

                var result = await inventoryServices.CreateProduct(product);

                // Check if the post exists through the context directly
                var data = context.Product.Find(product.ID);
                Assert.Equal(result, data);

                // change our service to have a return and check the data that came back
                Assert.Equal("This is our Test Name", product.Name);
            }
        }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     inventoryServiceLookup = InventoryServices.StaticLookupSource;
     SearchConditionSelector1.LookupSource = inventoryServiceLookup;
     if (!IsPostBack)
     {
         SearchConditionSelector1.DataFilter = InventoryServices.GetPhysicalCountCatalogFilter("CompleteFilterSet");
     }
     SetCatalogData();
 }
 public ProductDetails1(Customer customer, lacrosseContext context, ICustomerRepo customerRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo)
 {
     this.customer          = customer;
     this.context           = context;
     this.customerRepo      = customerRepo;
     this.inventoryRepo     = inventoryRepo;
     this.productRepo       = productRepo;
     this.customerServices  = new CustomerServices(customerRepo);
     this.inventoryServices = new InventoryServices(inventoryRepo);
     this.productServices   = new ProductServices(productRepo);
 }
Exemplo n.º 6
0
 public ReplenishInventory(Manager manager, lacrosseContext context, ILocationRepo locationRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo)
 {
     this.manager           = manager;
     this.context           = context;
     this.locationRepo      = locationRepo;
     this.inventoryRepo     = inventoryRepo;
     this.productRepo       = productRepo;
     this.locationServices  = new LocationServices(locationRepo);
     this.inventoryServices = new InventoryServices(inventoryRepo);
     this.productServices   = new ProductServices(productRepo);
 }
Exemplo n.º 7
0
 private void UpdateInventory(Guid StackId, int noBags, float Weight, SqlTransaction tran)
 {
     if (noBags > 0)
     {
         InventoryServices.GetInventoryService().UnloadToStack(StackId, noBags, Weight, tran);
     }
     else
     {
         InventoryServices.GetInventoryService().LoadFromStack(StackId, noBags, Weight, tran);
     }
 }
Exemplo n.º 8
0
        public static void CompleteLoading(Guid truckId)
        {
            //check if page being processed outside a workflow context
            PageDataTransfer transferedData = new PageDataTransfer(HttpContext.Current.Request.Path);

            IGINProcess    ginProcess  = GetGINProcess(true);
            SqlTransaction transaction = null;

            try
            {
                AuditTrailWrapper auditTrail = new AuditTrailWrapper(AuditTrailWrapper.TruckLoading, "GIN Process");
                //GINInfo originalGIN = new GINInfo();
                //originalGIN.Copy(ginProcess.GINProcessInformation.Trucks[0].GIN);
                transaction = ginProcess.CompleteLoading(truckId);
                GINTruckInfo theTruck = ginProcess.GINProcessInformation.Trucks.Find(trk => trk.TruckId == truckId);
                foreach (var loadedStack in theTruck.Load.Stacks)
                {
                    InventoryServices.GetInventoryService().LoadFromStack(loadedStack.StackId, loadedStack.Bags, 0, transaction);
                    auditTrail.AddChange(
                        new TruckLoadInfo(),
                        new TruckLoadInfo(loadedStack.TruckId, theTruck.Load.DateLoaded, theTruck.Load.BagType, string.Empty),
                        AuditTrailWrapper.NewRecord);
                    if (!auditTrail.Save())
                    {
                        throw new Exception("Unable to log audit trail");
                    }
                }
                //auditTrail.AddChange(originalGIN, ginProcess.GINProcessInformation.Trucks[0].GIN);
                //if (!auditTrail.Save())
                //    throw new Exception("Failed to save audit trail!");
                CompleteWorkflowTask(ginProcess.GINProcessInformation.Trucks[0].TransactionId);
                //CompleteWorkflowTask(ginProcess.GINProcessInformation.Trucks[0].TransactionId);
                transaction.Commit();
            }
            catch (Exception ex)
            {
                try
                {
                    if (transaction != null)
                    {
                        transaction.Rollback();
                    }
                }
                catch (Exception ex2)
                {
                    throw ex2;
                }
                throw ex;
            }
        }
 public OrderHistoryMenu(Customer customer, lacrosseContext context, ICustomerRepo customerRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, IOrderRepo orderRepo, ILocationRepo locationRepo)
 {
     this.customer         = customer;
     this.customerRepo     = customerRepo;
     this.productRepo      = productRepo;
     this.orderRepo        = orderRepo;
     this.inventoryRepo    = inventoryRepo;
     this.locationRepo     = locationRepo;
     this.customerServices = new CustomerServices(customerRepo);
     this.locationService  = new LocationServices(locationRepo);
     this.productServices  = new ProductServices(productRepo);
     this.orderService     = new OrderServices(orderRepo);
     this.inventoryService = new InventoryServices(inventoryRepo);
 }
Exemplo n.º 10
0
 public ProductDetails2(Customer customer, Sticks stick, lacrosseContext context, ICustomerRepo customerRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, ICartRepo cartRepo, ICartItemsRepo cartItemsRepo)
 {
     this.customer          = customer;
     this.stick             = stick;
     this.customerRepo      = customerRepo;
     this.productRepo       = productRepo;
     this.cartRepo          = cartRepo;
     this.cartItemsRepo     = cartItemsRepo;
     this.inventoryRepo     = inventoryRepo;
     this.customerServices  = new CustomerServices(customerRepo);
     this.inventoryServices = new InventoryServices(inventoryRepo);
     this.productServices   = new ProductServices(productRepo);
     this.cartServices      = new CartServices(cartRepo);
     this.cartItemServices  = new CartItemServices(cartItemsRepo);
 }
        public ActionResult VideoGameDetails(int id)
        {
            var svc      = CreateVideoGameService();
            var model    = svc.VideoGameDetails(id);
            var qService = new QuestServices();
            var iService = new InventoryServices();
            var bService = new BossServices();
            var aService = new AchievementServices();

            ViewBag.Quests       = qService.GetQuests(id);
            ViewBag.Inventories  = iService.GetItems(id);
            ViewBag.Bosses       = bService.GetBosses(id);
            ViewBag.Achievements = aService.GetAchievements(id);
            return(View(model));
        }
Exemplo n.º 12
0
 public static PhysicalCountInfo GetPhysicalCountInformation(bool isPostBack)
 {
     if (!isPostBack)
     {
         PageDataTransfer   transferedData           = new PageDataTransfer(HttpContext.Current.Request.Path);
         Guid               physicalCountId          = (Guid)transferedData.GetTransferedData("PhysicalCountId");
         IInventoryServices invertoryServices        = InventoryServices.GetInventoryService();
         PhysicalCountInfo  physicalCountInformation = invertoryServices.OpenPhysicalCount(physicalCountId);
         HttpContext.Current.Session["Physical-Count-Information"] = physicalCountInformation;
         return(physicalCountInformation);
     }
     else
     {
         return((PhysicalCountInfo)HttpContext.Current.Session["Physical-Count-Information"]);
     }
 }
Exemplo n.º 13
0
        public void MustAddObject()
        {
            //Arrange
            var inventoryServices   = new InventoryServices();
            var inventoryController = new InventoryController(inventoryServices);
            var inventoryItem       = new InventoryItems()
            {
                Id = 2, ItemName = "Test", Price = 100
            };

            //Act
            var actionResult = inventoryController.AddInvetoryItems(inventoryItem);
            var result       = actionResult.Result as CreatedResult;

            //Assert
            Assert.AreEqual(actionResult.Result, result);
        }
Exemplo n.º 14
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            PhysicalCountInfo pc = new PhysicalCountInfo()
            {
                Id                = Guid.NewGuid(),
                WarehouseId       = new Guid(SystemLookup.LookupSource.GetLookup("CurrentWarehouse")["Id"]),
                IsBeginingCount   = false,
                PhysicalCountDate = DateTime.Now
            };

            InventoryServices.GetInventoryService().CreatePhysicalCount(pc);
            PageDataTransfer physicalCountTransfer = new PageDataTransfer(Request.ApplicationPath + "/TakePhysicalCount.aspx");

            physicalCountTransfer.RemoveAllData();
            physicalCountTransfer.TransferData["PhysicalCountId"] = pc.Id;
            physicalCountTransfer.TransferData["ReturnPage"]      = HttpContext.Current.Request.Path;
            physicalCountTransfer.Navigate();
        }
Exemplo n.º 15
0
 public CheckoutMenu(Customer customer, lacrosseContext context, ICustomerRepo customerRepo, ILocationRepo locationRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, ICartRepo cartRepo, ICartItemsRepo cartItemsRepo, IOrderRepo orderRepo, ILineItemRepo lineItemRepo)
 {
     this.customer          = customer;
     this.customerRepo      = customerRepo;
     this.inventoryRepo     = inventoryRepo;
     this.locationRepo      = locationRepo;
     this.productRepo       = productRepo;
     this.orderRepo         = orderRepo;
     this.cartRepo          = cartRepo;
     this.cartItemsRepo     = cartItemsRepo;
     this.lineItemRepo      = lineItemRepo;
     this.customerServices  = new CustomerServices(customerRepo);
     this.locationServices  = new LocationServices(locationRepo);
     this.inventoryServices = new InventoryServices(inventoryRepo);
     this.productServices   = new ProductServices(productRepo);
     this.cartServices      = new CartServices(cartRepo);
     this.cartItemServices  = new CartItemServices(cartItemsRepo);
     this.orderServices     = new OrderServices(orderRepo);
     this.lineItemServices  = new lineItemServices(lineItemRepo);
 }
Exemplo n.º 16
0
        private void SetCatalogData()
        {
            List <IDataIdentifier> ids = null;

            try
            {
                IDataFilter filter = SearchConditionSelector1.DataFilter;
                foreach (DataFilterParameter parameter in filter.Parameters)
                {
                    if (parameter.Name == "WarehouseId")
                    {
                        filter.SetCondition(
                            new DataFilterCondition(
                                parameter, FilterConditionType.Comparison,
                                string.Empty, inventoryServiceLookup.GetLookup("CurrentWarehouse")["Id"]));
                    }
                    else
                    {
                        filter.SetCondition(SearchConditionSelector1[parameter.Name]);
                    }
                }
                ids = InventoryServices.SearchPhysicalCount(filter);
            }
            catch
            {
                ids = new List <IDataIdentifier>();
            }
            string buffer = string.Empty;

            foreach (IDataIdentifier identifier in ids)
            {
                buffer += identifier.Preview.DocumentElement.InnerXml;
            }
            string PhysicalCountSet = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <Catalog>" + buffer + "</Catalog>";

            xdsPhysicalCountSource.Data = PhysicalCountSet;
            xdsPhysicalCountSource.DataBind();
            gvPhysicalCount.DataBind();
        }
Exemplo n.º 17
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            errorDisplayer = new ErrorMessageDisplayer(lblMessage);
            errorDisplayer.ClearErrorMessage();

            transferedData              = new PageDataTransfer(Request.Path);
            PhysicalCountEditor.Driver  = GINViewConfigurationReader.GetViewConfiguration("TakePhysicalCount", "PhysicalCount");
            InspectorDataEditor.Driver  = GINViewConfigurationReader.GetViewConfiguration("TakePhysicalCount", "Inspector");
            StackCountDataEditor.Driver = GINViewConfigurationReader.GetViewConfiguration("TakePhysicalCount", "StackCount");
            InspectorGridViewer.Driver  = GINViewConfigurationReader.GetViewConfiguration("TakePhysicalCount", "InspectorGrid");
            PhysicalCountEditor.IsNew   = false;

            InspectorDataEditor.Ok     += new EventHandler(InspectorDataEditor_Ok);
            InspectorDataEditor.Cancel += new EventHandler(InspectorDataEditor_Cancel);

            StackCountDataEditor.Ok     += new EventHandler(StackCountDataEditor_Ok);
            StackCountDataEditor.Cancel += new EventHandler(StackCountDataEditor_Cancel);
            try
            {
                inventoryService         = InventoryServices.GetInventoryService();
                physicalCountInformation = InventoryServiceWrapper.GetPhysicalCountInformation(IsPostBack);

                PhysicalCountEditor.Lookup  = inventoryService.LookupSource;
                InspectorDataEditor.Lookup  = inventoryService.LookupSource;
                StackCountDataEditor.Lookup = inventoryService.LookupSource;
                InspectorGridViewer.Lookup  = inventoryService.LookupSource;

                PhysicalCountEditor.Setup();
                InspectorDataEditor.Setup();
                StackCountDataEditor.Setup();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public InventoryController(InventoryServices fixedService, InventoryLiteDbService service, DataService context)
 {
     _fixedService = fixedService;
     _service      = service;
     _context      = context;
 }
Exemplo n.º 19
0
 public InventoryController(InventoryServices service)
 {
     this._inventoryServices = service;
 }
Exemplo n.º 20
0
 public InventoryController(InventoryServices inventoryServices)
 {
     _inventoryServices = inventoryServices;
 }
Exemplo n.º 21
0
 public InventoryController(InventoryServices services)
 {
     _services = services;
 }