コード例 #1
0
ファイル: Program.cs プロジェクト: SniatynskyiT/SalaryTaxTest
        static void Main(string[] args)
        {
            double basicSalary;
            double currentSalary;

            Console.Write("Basic Salary: ");
            bool resultBasicSalary = Double.TryParse(Console.ReadLine(), out basicSalary);

            Console.Write("Current Salary: ");
            bool resultCurrentSalary = Double.TryParse(Console.ReadLine(), out currentSalary);

            Console.WriteLine("-------------------------------------------------");

            if (resultBasicSalary && resultCurrentSalary)
            {
                ITaxFactory taxFactory = new TaxFactory(basicSalary >= 0 ? basicSalary : 0, currentSalary >= 0 ? currentSalary : 0);
                ITax        tax        = taxFactory.CreateTax();
                Console.WriteLine(tax);
            }
            else
            {
                Console.WriteLine("Couldn't parse to Double");
            }

            Console.ReadKey();
        }
コード例 #2
0
        public void Setup()
        {
            mock = MockRepository.GenerateMock<IOrdersRepository>();
            stub = MockRepository.GenerateStub<ITax>();
            ordersRepositoryTestClass = new OrdersRepositoryTestClass();
            listOrders = new List<Order>();

            Order order = new Order();
            order.AddItem(LineItemFactory.GetLineItem("book", 12.49M,1,ItemType.Exempt));
            order.AddItem(LineItemFactory.GetLineItem("CD", 14.99M, 1,ItemType.Basic));
            order.AddItem(LineItemFactory.GetLineItem("chocolate bar", 0.85M, 1, ItemType.Exempt));
            listOrders.Add(order);

            order = new Order();
            order.AddItem(LineItemFactory.GetLineItem("imported chocolates", 10.0M, 1, ItemType.Import));
            order.AddItem(LineItemFactory.GetLineItem("imported perfume", 47.5M, 1, ItemType.Basic | ItemType.Import));
            listOrders.Add(order);

            order = new Order();
            order.AddItem(LineItemFactory.GetLineItem("imported perfume", 27.99M, 1, ItemType.Basic | ItemType.Import));
            order.AddItem(LineItemFactory.GetLineItem("perfume", 18.99M, 1, ItemType.Basic));
            order.AddItem(LineItemFactory.GetLineItem("pills", 19.75M, 1, ItemType.Exempt));
            order.AddItem(LineItemFactory.GetLineItem("imported chocolates", 1.25M,1, ItemType.Import));
            listOrders.Add(order);
        }
コード例 #3
0
 public ProductApp()
 {
     _context    = new ApplicationContext();
     _stockTrack = new StockTrackApp();
     _tax        = new TaxApp();
     _discount   = new AppDiscount();
     _stock      = new StockApp();
 }
コード例 #4
0
ファイル: Order.cs プロジェクト: markashleybell/StoreSpike
 public Order(IFactory factory, IEnumerable<ShippingMethod> shippingMethods)
 {
     _shippingMethods = shippingMethods;
     _lines = new List<OrderLine>();
     _discounts = new List<IDiscount>();
     _factory = factory;
     _tax = _factory.CreateTax();
 }
コード例 #5
0
ファイル: TaxExtensions.cs プロジェクト: rtpHarry/OShop
 public static void AddTax(this IList<TaxAmount> amounts, ITax tax, decimal taxBase)
 {
     var taxAmount = amounts.Where(ta => ta.Tax.Name == tax.Name && ta.Tax.Rate == tax.Rate).FirstOrDefault();
     if (taxAmount == null && taxBase != 0) {
         taxAmount = new TaxAmount(tax);
         amounts.Add(taxAmount);
     }
     taxAmount.TaxBase += taxBase;
 }
コード例 #6
0
        static void Main(string[] args)
        {
            ITax t = Factory.Create(1);

            t = Factory.Create(0);



            t.Calculate();
        }
コード例 #7
0
ファイル: TaxExtensions.cs プロジェクト: YSRE/SuperRocket
        public static void AddTax(this IList <TaxAmount> amounts, ITax tax, decimal taxBase)
        {
            var taxAmount = amounts.Where(ta => ta.Tax.Name == tax.Name && ta.Tax.Rate == tax.Rate).FirstOrDefault();

            if (taxAmount == null && taxBase != 0)
            {
                taxAmount = new TaxAmount(tax);
                amounts.Add(taxAmount);
            }
            taxAmount.TaxBase += taxBase;
        }
コード例 #8
0
        public EmployeeController(IEmployeeRepository employeeRepository, ITax taxEmployee)
        {
            repository       = employeeRepository;
            this.taxEmployee = taxEmployee;

            pageInfo = new PageInfo
            {
                CountEmployees     = repository.Employees.Count(),
                CountEmployeesPage = PageSize,
                CurrentPage        = 1
            };
            PageSize = 3;
        }
コード例 #9
0
        public EmployeeController(IEmployeeRepository employeeRepository, ITax taxEmployee)
        {
            repository = employeeRepository;
            this.taxEmployee = taxEmployee;

            pageInfo = new PageInfo
            {
                CountEmployees = repository.Employees.Count(),
                CountEmployeesPage = PageSize,
                CurrentPage = 1
            };
            PageSize = 3;
        }
コード例 #10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello To Design Patterns!");



            IExport export = new ExportToExcel();

            export.Save();

            export = new ExportToWord();
            export.Save();

            Console.WriteLine("Adapter : Before");
            ThirdPartyLibraryExportPDF thirdPartyLibraryExportPDF = new ThirdPartyLibraryExportPDF();

            thirdPartyLibraryExportPDF.Export();

            Console.WriteLine("Adapter : After");
            export = new PDFExportAdaptor();
            export.Save();

            Console.WriteLine("Factory : Before");
            //ITax tax = new Tax1();
            ITax tax = new NewTax();//No decoupling because each time there is a change

            //we need to change it here in the client side. Solution: centralise the New Keyword/Create

            tax.Calculate();

            Console.WriteLine("Factory : After");
            ITax tx = SimpleFactory.Create(1);

            tx.Calculate();

            Console.WriteLine("Iterator : Before");
            Report report = new Report();

            report.GetCountries();
            Console.WriteLine("Iterator : After");
            IEnumerable <Country> coun = report.GetCountries();

            Console.ReadLine();
        }
コード例 #11
0
        public decimal CalculateTotal(Customer customer)
        {
            decimal total = 0.0m;

            foreach (var item in orderItems)
            {
                total += item.Cost * item.Quantity;
            }

            //var a = orderItems.Sum((item) =>
            //{
            //    return item.Cost * item.Quantity;
            //});

            ITax tax = _taxFactory.GetTax();

            total += tax.CalculateTaxes(customer, total);

            return(total);
        }
コード例 #12
0
ファイル: OrderContract.cs プロジェクト: encinecarlos/StoreV1
 public abstract void SetTax(ITax tax);
コード例 #13
0
 public SalesItemTaxDecorator(ISalesItem salesItem, ITax salesTax)
 {
     this._decoratedSalesItem = salesItem;
     this._salesTax           = salesTax;
 }
コード例 #14
0
 public SalesItemTaxDecorator(ISalesItem salesItem, ITax salesTax)
 {
     this._decoratedSalesItem = salesItem;
     this._salesTax = salesTax;
 }
コード例 #15
0
ファイル: Report.cs プロジェクト: alermar69/Test_Task
 public Report (IEnumerable<Employee> employees, ITax taxSalary)
 {
     Employees = employees;
     TaxSalary = taxSalary;
 }
コード例 #16
0
 public LineItemTaxDecorator(ILineItem lineItem, ITax lineTax)
 {
     this._decoratedLineItem = lineItem;
     this._lineTax = lineTax;
 }
コード例 #17
0
 /// <summary>
 /// for test
 /// </summary>
 public DeleteTaxBand(int taxBandID, ITax mockTaxDal) : this(taxBandID)
 {
     _TaxDal = mockTaxDal;
 }
コード例 #18
0
ファイル: TaxAmount.cs プロジェクト: rtpHarry/OShop
 public TaxAmount(ITax tax)
 {
     Tax = tax;
 }
コード例 #19
0
 public Report(IEnumerable <Employee> employees, ITax taxSalary)
 {
     Employees = employees;
     TaxSalary = taxSalary;
 }
コード例 #20
0
        //private readonly ICatalogSearchService _catalogSearchService;

        public CalculateCartTaxesObserver(ITax taxSettings)
        {
            _taxSettings = taxSettings;
            //_catalogSearchService = catalogService;
        }
コード例 #21
0
 public Product(IPriceCurve curve, ITax tax)
 {
     Curve = curve;
     Tax   = tax;
 }
コード例 #22
0
 /// <summary>
 /// for test
 /// </summary>
 public CreateTaxBand(decimal bandMin, decimal taxRate, ITax mockTaxDal) : this(bandMin, taxRate)
 {
     _TaxDal = mockTaxDal;
 }
コード例 #23
0
ファイル: ITax.cs プロジェクト: xyashapyx/.Net-Vorontsov-P.
 public MyBids(ITax used)
 {
     this.Tax = used;
 }
コード例 #24
0
ファイル: ShoppingCart.cs プロジェクト: rtpHarry/OShop
 public void AddTax(ITax tax, decimal taxBase)
 {
     _taxes.AddTax(tax, taxBase);
 }
コード例 #25
0
 public GoldWallet(float ammount, ITax gst)
 {
     Balance   = ammount;
     GSTonGold = gst;
 }
コード例 #26
0
 public TaxableProduct(ITax tax)
 {
     _tax = tax;
 }
コード例 #27
0
ファイル: GetTax.cs プロジェクト: zzz1985xxxwl/bjl_hrmis
 /// <summary>
 /// for test
 /// </summary>
 public GetTax(ITax mockTaxDal)
 {
     _TaxDal = mockTaxDal;
 }
コード例 #28
0
ファイル: Tax.cs プロジェクト: rtpHarry/OShop
 public Tax(ITax iTax)
 {
     Name = iTax.Name;
     Rate = iTax.Rate;
 }
コード例 #29
0
 public ListController()
 {
     this.ControllerName = "List";
     this.taxBO          = this.taxBO ?? new TaxBO();
     this.unitBO         = this.unitBO ?? new UnitBO();
 }
コード例 #30
0
 public TaxAmount(ITax tax)
 {
     Tax = tax;
 }
コード例 #31
0
 public Product(IPriceCurve curve, ITax tax, IPriceDeduction deduction)
 {
     Curve     = curve;
     Tax       = tax;
     Deduction = deduction;
 }
コード例 #32
0
 public Milk(decimal taxableAmount, ITax tax) : base(tax)
 {
     Name          = nameof(Milk);
     TaxableAmount = taxableAmount;
 }
コード例 #33
0
ファイル: Calculator.cs プロジェクト: Pankhudi17/TaxCalci
 public Calculator()
 {
     this._tax = tax;
 }
コード例 #34
0
 public CalculateOrderTaxesObserver(ITax taxSettings)
 {
     _taxSettings = taxSettings;
 }
コード例 #35
0
ファイル: ShoppingCart.cs プロジェクト: YSRE/SuperRocket
 public void AddTax(ITax tax, decimal taxBase)
 {
     _taxes.AddTax(tax, taxBase);
 }
コード例 #36
0
        //private readonly TaxSvc _taxService;

        public AvaTaxController(ITax taxSettings)//, TaxSvc taxService)
        {
            _taxSettings = taxSettings;
            //_taxService = taxService;
        }
コード例 #37
0
 public override void SetTax(ITax tax)
 {
     Tax = tax;
 }
コード例 #38
0
 public OrderCarlosVancouver()
 {
     Tax = new VancouverTax();
 }
コード例 #39
0
        //private readonly TaxSvc _taxService;

        public AvaTaxController(ITax taxSettings)//, TaxSvc taxService)
        {
            _taxSettings = taxSettings;
            //_taxService = taxService;
        }
コード例 #40
0
 public void CalculatesTax(Budget budget, ITax tax)
 {
     Console.WriteLine(tax.Calculate(budget));
 }
コード例 #41
0
 public void Process(Invoice invoice, ITax tax)
 {
     tax.Calculate(invoice);
     Console.WriteLine($"Invoice to '{invoice.Name}' generated with sucess, value with tax: {invoice.Value}");
 }
コード例 #42
0
 /// <summary>
 /// for test
 /// </summary>
 public SaveTaxCutoffPoint(decimal taxCutoffPoint, decimal taxForeignCutoffPoint, ITax mockTaxDal)
     : this(taxCutoffPoint, taxForeignCutoffPoint)
 {
     _TaxDal = mockTaxDal;
 }
コード例 #43
0
 public OrderLine(IFactory factory)
 {
     _factory = factory;
     _tax = _factory.CreateTax();
     _modifiers = new List<Modifier>();
 }