Exemplo n.º 1
0
 public List<ProductPopUpItem> GetProduct(Outlet outlet, OrderType orderType, List<ProductPopUpItem> existing)
 {
     vm.SetUpPOS(outlet, orderType,existing);
     this.Owner = Application.Current.MainWindow;
     this.ShowDialog();
     return vm.GetProductsLineItem();
 }
Exemplo n.º 2
0
 public List<ProductPopUpItem> GetProductBySupplier(Outlet outlet, OrderType orderType, Supplier supplier)
 {
     vm.SetUpWithSupplier(outlet, orderType, supplier);
     this.Owner = Application.Current.MainWindow;
     this.ShowDialog();
     return vm.GetProductsLineItem();
 }
Exemplo n.º 3
0
 public List<ProductPopUpItem> EditProduct(Outlet outlet, Guid productId, decimal quantity, OrderType orderType)
 {
     vm.SetUp(outlet, orderType);
     vm.LoadForEdit(productId,quantity);
     this.Owner = Application.Current.MainWindow;
     this.ShowDialog();
     return vm.GetProductsLineItem();
 }
Exemplo n.º 4
0
 public List<ProductPopUpItem> GetReturnables(Outlet outlet, Dictionary<Guid,int> returnables, OrderType orderType)
 {
     vm.SetUp(outlet,orderType);
     vm.SetReturnables(outlet, returnables);
     this.Owner = Application.Current.MainWindow;
      ShowDialog();
      return vm.GetProductsLineItem();
 }
Exemplo n.º 5
0
 protected OrderSaleContextBuilder(Outlet outlet, CostCentre costCentre, User user, Sale sale, Bank bank, BankBranch bankBranch)
 {
     Outlet = outlet;
     CostCentre = costCentre;
     User = user;
     Sale = sale;
     Bank = bank;
     BankBranch = bankBranch;
 }
 public void Save(CostCentreViewModel costCenter)
 {
     CostCentre cc = new Outlet(costCenter.Id)
     {
         CostCentreType = costCenter.CostCentreType,
         
     };
     _costCenterRepository.Save(cc);
 }
Exemplo n.º 7
0
 public Order(Guid guid, Outlet outlet) : base(guid)
 {
     LineItems = new List<ProductLineItem>();
     ReturnableLineItems = new List<ReturnableLineItem>();
     Payments = new List<Payment>();
     Outlet = outlet;
     ShipToAddress = string.Empty;
     _DateCreated = DateTime.Now;
     InvoiceId = Guid.NewGuid();
 }
Exemplo n.º 8
0
        private void InsertOrder(string reference, ProcessingStatus processingStatus = ProcessingStatus.Deliverable)
        {
            var outlet = new Outlet(Guid.NewGuid()) {Name = "The Outlet"};

            Database.InsertWithChildren(new Order(Guid.NewGuid(), outlet)
            {
                OrderReference = reference,
                ProcessingStatus = processingStatus,
                OutletMasterId = outlet.Id
            });
        }
 protected OrderSaleEnvelopeContext(long sequenceNumber, Outlet outlet, User user, CostCentre costCentre, Order order)
 {
     Outlet = outlet;
     User = user;
     CostCentre = costCentre;
     Order = order;
     var dateTime = DateTime.Now;
     //Remove milliseconds
     Now = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second);
     ReferenceGenerator = new ReferenceGenerator(sequenceNumber, user, outlet, Now);
     VisitId = Guid.NewGuid();
 }
Exemplo n.º 10
0
        private void SelectCostCentre()
        {
            CostCentre = null;
             using (var container = NestedContainer)
             {
                 var selected = Using<IItemsLookUp>(container).SelectUnderbankingCostCentre(Salesman.Id);

                 CostCentre = selected;
                 if(selected==null)
                 {
                     CostCentre = new Outlet(Guid.Empty){Name = "--Select CostCentre---"};
                 }
             }

            
        }
 private void ShowOutletPopup()
 {
     SelectedOutlet = null;
     using (var container = NestedContainer)
     {
         if (SelectedSalesman != null)
         {
             var selected = Using<IItemsLookUp>(container).SelectOutletBySalesman(SelectedSalesman.Id);
         
             SelectedOutlet = selected as Outlet;
         if (selected == null)
         {
             SelectedOutlet = new Outlet(Guid.Empty) { Name = "ALL" };
         }
         }
     }
 }
Exemplo n.º 12
0
 private void AssertCompetitor(Outlet competitor, Outlet savedCompetitor)
 {
     Assert.AreEqual(competitor.Name,savedCompetitor.Name);
     Assert.AreEqual(competitor.OutletCategory.Code,savedCompetitor.OutletCategory.Code);
     Assert.AreEqual(competitor.OutletType.Code,savedCompetitor.OutletType.Code);
     Assert.AreEqual(competitor.Route.Code,savedCompetitor.Route.Code);
     Assert.AreEqual(competitor.VatClass.VatClass,savedCompetitor.VatClass.VatClass);
     Assert.AreEqual(competitor.OutletProductPricingTier.Code,savedCompetitor.OutletProductPricingTier.Code);
     Assert.AreEqual(competitor.CostCentreCode,savedCompetitor.CostCentreCode);
     Assert.AreEqual(competitor.ContactPerson,savedCompetitor.ContactPerson);
     Assert.AreEqual(competitor._Status,EntityStatus.Active);
 }
Exemplo n.º 13
0
 private Outlet GetOutletEntity(MasterBaseDTO masterBase)
 {
     OutletDTO dto = masterBase as OutletDTO;
     Outlet entity = new Outlet(dto.MasterId);
     entity.CostCentreCode = dto.CostCentreCode;
     entity.CostCentreType = CostCentreType.Outlet;
     entity.Latitude = dto.Latitude;
     entity.Longitude = dto.Longitude;
     entity.Name = dto.Name;
     if (dto.OutletCategoryMasterId != Guid.Empty)
         entity.OutletCategory = _outletCategoryRepository.GetById(dto.OutletCategoryMasterId);
     if (dto.OutletTypeMasterId != Guid.Empty)
         entity.OutletType = _outletTypeRepository.GetById(dto.OutletTypeMasterId);
     if (dto.OutletTypeMasterId != Guid.Empty)
     entity.ParentCostCentre = new CostCentreRef {Id = dto.ParentCostCentreId};
     if (dto.VatClassMasterId != Guid.Empty)
         entity.VatClass = _vatClassRepository.GetById(dto.VatClassMasterId);
     if (dto.DiscountGroupMasterId != Guid.Empty)
         entity.DiscountGroup = _discountGroupRepository.GetById(dto.DiscountGroupMasterId);
     if (dto.OutletProductPricingTierMasterId != Guid.Empty)
         entity.OutletProductPricingTier =_productPricingTierRepository.GetById(dto.OutletProductPricingTierMasterId);
     if (dto.RouteMasterId != Guid.Empty)
         entity.Route = _routeRepository.GetById(dto.RouteMasterId);
     return entity;
 }
Exemplo n.º 14
0
 public OutletDTO Map(Outlet outlet)
 {
     if (outlet == null) return null;
     var dto = Mapper.Map<Outlet, OutletDTO>(outlet);
     dto.ShippingAddresses = outlet.ShipToAddresses.Select(n => Map(n)).ToList();
     return dto;
 }
Exemplo n.º 15
0
 public SaleAndContextBuilder(Outlet outlet, CostCentre costCentre, User user, Sale sale, Bank bank, BankBranch bankBranch)
     : base(outlet, costCentre, user, sale, bank, bankBranch)
 {
 }
Exemplo n.º 16
0
        protected Outlet Map(OutletImport outletImport, List<string> mappingvalidationList)
        {
            var outletCode = outletImport.Code;
            var exists = Queryable.FirstOrDefault(_context.tblCostCentre, p => p.Cost_Centre_Code.ToLower().Trim() == outletImport.Code.ToLower().Trim() && p.CostCentreType == (int)CostCentreType.Outlet);
            Guid id = exists != null ? exists.Id : Guid.NewGuid();

            var routeId = Queryable.Where(_context.tblRoutes, p => p.Code == outletImport.RouteCode).Select(p=>p.RouteID).FirstOrDefault();
            var vatClassId =Queryable.Where(_context.tblVATClass, p => p.Name == outletImport.VATClassCode).Select(p => p.id).FirstOrDefault();
            
            var route = _routeRepository.GetById(routeId);
            if(route==null){mappingvalidationList.Add(string.Format((string) "Invalid Route Code {0}", (object) outletImport.RouteCode));}

            var outletTypeId = Queryable.Where(_context.tblOutletType, p => p.Code == outletImport.OutletType).Select(p=>p.id).FirstOrDefault();
            var outletType = _outletTypeRepository.GetById(outletTypeId);
            if(outletType==null){mappingvalidationList.Add(string.Format((string) "Invalid Outlet Type Code {0}",(object) outletImport.OutletType));}

            var outletCategoryId = Queryable.Where(_context.tblOutletCategory, p => p.Code == outletImport.OutletCategory).Select(p => p.id).FirstOrDefault();
            var outletCategory = _outletCategoryRepository.GetById(outletCategoryId);
            if (outletCategory == null) { mappingvalidationList.Add(string.Format((string) "Invalid Outlet Category Code {0}", (object) outletImport.OutletCategory)); }

           
            var outletProductPricingTier = _productPricingTierRepository.GetByCode(outletImport.PricingTierCode);
            if(outletProductPricingTier==null){mappingvalidationList.Add(string.Format((string) "Invalid Outlet Product Pricing Tier Code {0}", (object) outletImport.PricingTierCode));}

            var specialProductPricingTier = _productPricingTierRepository.GetByCode(outletImport.SpecialPricingTierCode);
            var VATClass = _vatClassRepository.GetById(vatClassId);
            var parentCostCentre = _costCentreRepository.GetByCode(outletImport.DistributorCode,CostCentreType.Distributor);
            var discountGroup = _discountGroupRepository.GetByCode(outletImport.DiscountGroupCode);

            if (parentCostCentre == null) { mappingvalidationList.Add(string.Format((string) "Invalid Distributor Code {0}", (object) outletImport.DistributorCode)); }

            var outlet = new Outlet(id);
            outlet.Name = outletImport.Name;
            outlet.CostCentreCode = outletCode;//outletImport.Code;
            outlet.Route = route;
            outlet.OutletCategory = outletCategory;
            outlet.OutletType = outletType;
            outlet.OutletProductPricingTier = outletProductPricingTier;
            outlet.SpecialPricingTier = specialProductPricingTier;
            outlet.VatClass = VATClass;
            outlet.ParentCostCentre = parentCostCentre != null ? new CostCentreRef {Id = parentCostCentre.Id} : null;
            outlet.CostCentreType=CostCentreType.Outlet;
            outlet.DiscountGroup = discountGroup;
            outlet._Status=EntityStatus.Active;
            return outlet;

        }
Exemplo n.º 17
0
        public void SetReturnables(Outlet outlet,Dictionary<Guid,int> returnables)
        {
            ProductLookup.Clear();
            ProductLookup.Add(new SaleProduct(Guid.Empty) { Description = "---Select Returnable-----" });
            using (var c = NestedContainer)
            {
               
                   
                foreach (var returnableId in returnables.Select(p=>p.Key))
                {
                    Product p = Using<IProductRepository>(c).GetById(returnableId);
                    ProductLookup.Add(p);

                    returns.Add(p, returnables.FirstOrDefault(q => q.Key == returnableId).Value);
                }
            }
            if (!IsEdit)
                SelectedProduct = ProductLookup.FirstOrDefault();
        }
 public void ClearViewModel()
 {
     AddingNew = false;
     IsEditing = false;
     target = null;
     TargetId = Guid.Empty;
     Target = 0m;
     SelectedOutlet = new Outlet(Guid.Empty) { Name = "---Select Outlet---" };
 }
 private void RouteChanged()
 {
     using (StructureMap.IContainer container = NestedContainer)
     {
         if (FireRouteChangedCmd)
         {
             RouteOutlets.Clear();
             var outlet = new Outlet(Guid.Empty)
                              {
                                  Name = GetLocalText("sl.pos.selectoutlet"),
                                  /*"--Please Select An Outlet"--"*/
                                  CostCentreCode = ""
                              };
             RouteOutlets.Add(outlet);
             SelectedOutlet = outlet;
             if (SelectedRoute != null)
             {
                 var outlets =
                     Using<IOutletRepository>(container).GetAll().OfType<Outlet>()
                         .Where(n => n._Status == EntityStatus.Active);
                 var filteredOutlets =
                     outlets.Where(n => n.Route != null).Where(n => n.Route.Id == SelectedRoute.Id)
                            .OrderBy(n => n.Name).ToList();
                 filteredOutlets.ForEach(n => RouteOutlets.Add(n));
             }
         }
     }
 }
        public void CanHandleCreateMainOrderCommand()
        {
            //Given 
            var parentGuid = Guid.NewGuid();

            orderRepository.Setup(o => o.FindById(parentGuid))
                .Returns(default(Sale));

            var outlet = new Outlet(new Guid("025815c3-f7fb-4448-af4a-f30d77d743d8"));

            outletRepository.Setup(o => o.GetById(outlet.Id, false))
                .Returns(outlet);

            var createOrderCommand = CreateCreateMainOrderCommand(parentGuid);
            
            //When 
            commandHandler.Init(parentGuid);
            commandHandler.Handle(createOrderCommand);
            commandHandler.Save();

            //Then
            orderRepository.Verify(r => r.Save(It.Is<Sale>(
                o => o.Id == parentGuid
                && o.ShipToAddress == "The Ship To Address"
                && o.Note == "The Note"
                && o.OrderReference == "O_John_O002_20150501_140032_00001"
                && o.Outlet == outlet
                ), null), Times.Once());
        }
Exemplo n.º 21
0
        public decimal GetVATRate(Product product, Outlet outlet)
        {
            if (_freeOfChargeDiscountRepository.IsProductFreeOfCharge(product.Id))
            {
                return 0m;
            }
            if (product is ReturnableProduct)
                return 0;

            if (product is ConsolidatedProduct)
                return ((ConsolidatedProduct)product).ProductVATRate(outlet.OutletProductPricingTier, outlet);

            if (outlet.VatClass != null) //cn: Outlet VAT class takes precedence 
            {
                if (outlet.VatClass.CurrentEffectiveDate <= DateTime.Now)
                    return outlet.VatClass.CurrentRate;
            }

            if (product.VATClass != null)
                return product.VATClass.CurrentRate;
            return 0m;
        }
Exemplo n.º 22
0
        public void LoadById(Guid id)
        {
            if (id == Guid.Empty)
            {
                InitializeBlank();
            }
            else
            {
                 using (StructureMap.IContainer c = NestedContainer)
            {

                outlet = Using<ICostCentreRepository>(c).GetById(id) as Outlet;
                if (outlet == null)
                {
                    InitializeBlank();
                }
                else
                {
                        PageTitle = GetLocalText("sl.outlet.edit.editing.title"); // "Edit Outlet";
                        Id = outlet.Id;
                        Name = outlet.Name;
                        OutletCode = outlet.CostCentreCode;
                        Latitude = outlet.Latitude;
                        Longitude = outlet.Longitude;
                        IsApproved = outlet._Status ==EntityStatus.Active;
                        CanApprove = !IsApproved;

                        //load all items to combos
                        DistributorRoutes.Clear();
                        var route = new Route(Guid.Empty)
                            {
                                Name = GetLocalText("sl.outlet.edit.route.default")
                                /* "--Please Select A Route --"*/
                            };
                        DistributorRoutes.Add(route);
                        Using<IRouteRepository>(c).GetAll()
                                     .ToList()
                                     .OrderBy(n => n.Name)
                                     .ToList()
                                     .ForEach(n => DistributorRoutes.Add(n));

                        try
                        {
                            SelectedRoute = DistributorRoutes.FirstOrDefault(n => n.Id == outlet.Route.Id);
                        }
                        catch
                        {
//route deactivated!
                            SelectedRoute = route;
                        }

                        DistributorOutletCategories.Clear();
                        Using<IOutletCategoryRepository>(c).GetAll()
                                              .OrderBy(n => n.Name)
                                              .ToList()
                                              .ForEach(n => DistributorOutletCategories.Add(n));
                        SelectedOutletCategory =
                            DistributorOutletCategories.FirstOrDefault(n => n.Id == outlet.OutletCategory.Id);

                        DistributorOutletType.Clear();
                        Using<IOutletTypeRepository>(c).GetAll()
                                          .OrderBy(n => n.Name)
                                          .ToList()
                                          .ForEach(n => DistributorOutletType.Add(n));
                        SelectedOutletType = DistributorOutletType.FirstOrDefault(n => n.Id == outlet.OutletType.Id);

                        DistributorProductPricingTier.Clear();
                        Using<IProductPricingTierRepository>(c).GetAll()
                                                  .OrderBy(n => n.Name)
                                                  .ToList()
                                                  .ForEach(n => DistributorProductPricingTier.Add(n));
                        var ppt = new ProductPricingTier(Guid.Empty)
                            {
                                Name = GetLocalText("sl.outlet.edit.tier.default")
                                /* "--Please Select Product Pricing Tier--"*/
                            };
                        DistributorProductPricingTier.Add(ppt);
                        try
                        {
                            SelectedProductPricingTier =
                                DistributorProductPricingTier.FirstOrDefault(
                                    n => n.Id == outlet.OutletProductPricingTier.Id);
                        }
                        catch
                        {
                            SelectedProductPricingTier = ppt;
                        }

                        VATClasses.Clear();
                        var vatClass = new VATClass(Guid.Empty)
                            {
                                VatClass = GetLocalText("sl.outlet.edit.vatclass.default") /*"--NONE--"*/
                            };
                        VATClasses.Add(vatClass);
                        Using<IVATClassRepository>(c).GetAll().OrderBy(n => n.VatClass).ToList().ForEach(n => VATClasses.Add(n));
                        try
                        {
                            SelectedVATRate = VATClasses.First(n => n.Id == outlet.VatClass.Id);
                        }
                        catch
                        {
                            SelectedVATRate = vatClass;
                        }

                        DiscountGroups.Clear();
                        var discountGroup = new DiscountGroup(Guid.Empty)
                            {
                                Name = GetLocalText("sl.outlet.edit.discgp") /*"--NONE--"*/
                            };
                        SelectedDiscountGroup = discountGroup;
                        DiscountGroups.Add(discountGroup);
                        Using<IDiscountGroupRepository>(c).GetAll().OrderBy(n => n.Name).ToList().ForEach(n => DiscountGroups.Add(n));
                        try
                        {
                            SelectedDiscountGroup = DiscountGroups.First(n => n.Id == outlet.DiscountGroup.Id);
                        }
                        catch
                        {
                            SelectedDiscountGroup = discountGroup;
                        }
                       
                       LoadShipToAddress();

                }
                }
            }
        }
Exemplo n.º 23
0
 public Sale(Guid id, Outlet outlet) : base(id, outlet)
 {
 }
Exemplo n.º 24
0
 private void ClearViewModel()
 {
     UnderBankAmount = 0;
     CostCentre = new Outlet(Guid.Empty) { Name = "--Select CostCentre---" };
     Description = "";
 }
        public void LoadOutlets()
        {
            RouteOutlets.Clear();
            var outlet = new Outlet(Guid.Empty) { Name = GetLocalText("sl.target.defaultoutlet") /*"--Please Select Outlet--"*/};
            RouteOutlets.Add(outlet);
            SelectedOutlet = outlet;

            if (SelectedRoute.Id != Guid.Empty)
            {
                using (StructureMap.IContainer c = NestedContainer)
                {
                    Using<ICostCentreRepository>(c)
                        .GetAll()
                        .OfType<Outlet>()
                        .Where(n => n._Status == EntityStatus.Active)
                        .Where(n => n.Route != null && n.Route.Id == SelectedRoute.Id)
                        .OrderBy(n => n.Name)
                        .ToList()
                        .ForEach(RouteOutlets.Add);
                }
            }
        }
Exemplo n.º 26
0
 public bool CheckHasOutStandingPayments(Outlet outlet)
 {
     return OutletOrdersOutstandingPayments(outlet.Id).Count > 0;
 }
Exemplo n.º 27
0
 protected ValidationResultInfo Validate(Outlet outlet)
 {
     var result= _outletRepository.Validate(outlet);
     return result;
 }
Exemplo n.º 28
0
 public OutletDTO Map(Outlet outlet)
 {
     if (outlet == null) return null;
     return Mapper.Map<Outlet, OutletDTO>(outlet);
 }
Exemplo n.º 29
0
 void LoadOutlets()
 {
     using (StructureMap.IContainer c = NestedContainer)
     {
         Outlets.Clear();
         var outlets = Using<ICostCentreRepository>(c).GetAll().OfType<Outlet>().Where(n => n._Status == EntityStatus.Active);
         outlets = outlets.OrderBy(n => n.Name).ToList();
         var outlet = new Outlet(Guid.Empty) {CostCentreCode = " ", Name = "--Select Outlet--"};
         SelectedOutlet = outlet;
         Outlets.Add(outlet);
         outlets.ToList().ForEach(n => Outlets.Add(n));
     }
 }
Exemplo n.º 30
0
 public List<ProductPopUpItem> GetProductBySupplier(Outlet outlet, OrderType orderType, Supplier supplier)
 {
     throw new NotImplementedException();
 }