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(); }
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(); }
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(); }
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(); }
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); }
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(); }
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(); }
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" }; } } } }
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); }
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; }
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; }
public SaleAndContextBuilder(Outlet outlet, CostCentre costCentre, User user, Sale sale, Bank bank, BankBranch bankBranch) : base(outlet, costCentre, user, sale, bank, bankBranch) { }
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; }
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()); }
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; }
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(); } } } }
public Sale(Guid id, Outlet outlet) : base(id, outlet) { }
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); } } }
public bool CheckHasOutStandingPayments(Outlet outlet) { return OutletOrdersOutstandingPayments(outlet.Id).Count > 0; }
protected ValidationResultInfo Validate(Outlet outlet) { var result= _outletRepository.Validate(outlet); return result; }
public OutletDTO Map(Outlet outlet) { if (outlet == null) return null; return Mapper.Map<Outlet, OutletDTO>(outlet); }
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)); } }
public List<ProductPopUpItem> GetProductBySupplier(Outlet outlet, OrderType orderType, Supplier supplier) { throw new NotImplementedException(); }