Пример #1
0
 public CustomerDiscount CreateCustomerDiscount(CostCentreRef outletId, ProductRef productId, decimal discountRate,DateTime effectiveDate)
 {
     if (effectiveDate > DateTime.Now)
         throw new ArgumentException("Invalid effective date, must be in the past");
     if (productId.ProductId == Guid.Empty)
         throw new ArgumentException("Invalid product");
     if (outletId.Id == Guid.Empty)
         throw new ArgumentException("Invalid outlet");
     CustomerDiscount cDiscount = new CustomerDiscount(Guid.NewGuid())
     {
         Outlet = new CostCentreRef {Id=outletId.Id  },
          Product= new ProductRef {ProductId=productId.ProductId},
        
     };
     cDiscount.CustomerDiscountItems.Add(new CustomerDiscount.CustomerDiscountItem(Guid.NewGuid())
     {
          EffectiveDate=effectiveDate,
          DiscountRate=discountRate
     });
     return cDiscount;
 }
Пример #2
0
 public DistributorSalesman Map(DistributorSalesmanDTO dto)
 {
     if (dto == null) return null;
     var distributorSalesman = Mapper.Map<DistributorSalesmanDTO, DistributorSalesman>(dto);
     var parentCostCentre = new CostCentreRef { Id = dto.ParentCostCentreId };
     parentCostCentre.Id = dto.ParentCostCentreId;
     distributorSalesman.ParentCostCentre = parentCostCentre;
     return distributorSalesman;
 }
Пример #3
0
 public static CostCentreRef Map(this tblCostCentre cCtr)
 {
     CostCentreRef cCentre = new CostCentreRef()
     {
         Id=cCtr.Id
     };
     return cCentre;
 }
Пример #4
0
        protected Guid AddStore(string code, string name, CostCentreRef parent, string vatId)
        {
            Store store = new Store(Guid.NewGuid())
                        {
                            CostCentreCode = code,
                            Name = name,
                            _Status = EntityStatus.Active,
                            CostCentreType = CostCentreType.Store,
                            ParentCostCentre = parent,
                            VatRegistrationNo = vatId, 
                        };

           return  _costCentreRepository.Save(store);
        }
Пример #5
0
 protected Guid AddCommoditySupplier(string acc,Guid bbn, Guid bn, CommoditySupplierType stype,string code, CostCentreType ctype, string name, CostCentreRef parent, string pin)
 {
     CommoditySupplier cs = new CommoditySupplier(Guid.NewGuid())
                                {
                                    AccountName = acc,
                                    AccountNo = acc,
                                    BankBranchId = bbn,
                                    BankId = bn,
                                    CommoditySupplierType = stype,
                                    CostCentreCode = code,
                                    CostCentreType = ctype,
                                    JoinDate = DateTime.Now,
                                    Name = name,
                                    ParentCostCentre = parent,
                                    PinNo = pin,
                                    _Status = EntityStatus.Active,
                                };
     return _commoditySupplierRepository.Save(cs);
 }
Пример #6
0
 protected Guid AddHub(string code, string name, Guid regionId, string varNo, CostCentreRef parentCC)
 {
     Hub hub = new Hub(Guid.NewGuid())
                   {
                       CostCentreCode = code,
                       CostCentreType = CostCentreType.Hub,
                       Name = name,
                       Region = _regionRepository.GetById(regionId),
                       VatRegistrationNo = varNo,
                       _Status = EntityStatus.Active,
                       ParentCostCentre = parentCC
                   };
     return _costCentreRepository.Save(hub);
 }