Example #1
0
        private void ShowInOut(InOrOut inOrOut)
        {
            if (listViewItem.SelectedItems.Count >= 1)
            {
                ItemService            itemService            = new ItemService(_context);
                DRService              drService              = new DRService(_context);
                HistoryService         historyService         = new HistoryService(_context);
                ReturnedHistoryService returnedHistoryService = new ReturnedHistoryService(_context);

                InOutService inOutService = new InOutService(itemService, historyService
                                                             , drService, returnedHistoryService);

                long itemId       = Convert.ToInt64(listViewItem.SelectedItems[0].SubItems[0].Text);
                Item selectedItem = _items.FirstOrDefault(i => i.Id == itemId);

                InOutWithOutDRForm f = new InOutWithOutDRForm(itemService, inOutService,
                                                              inOrOut, selectedItem, _name);

                f.ShowDialog();
                if (f.HaveChangedQuantity)
                {
                    SearchItem();
                }
            }
            else
            {
                MessageBox.Show("Please select Item from the list", "",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        public void Success_ReadAndConvertFiles(
            string pCommandLine,
            TestConsole pConsoleCommandLine,
            InOutService pInOutService,
            [Frozen] IVendorService pVendorService)
        {
            // Setup data
            BaseResultModel <Vendor> fModel = new BaseResultModel <Vendor>(new Vendor(), null);

            // Setup services
            pVendorService
            .CreateOrUpdate(Arg.Any <Vendor>())
            .Returns(fModel);

            var pCommand = new SyncVendorsCommand(pVendorService, pInOutService, null);

            // Test
            pCommand.Invoke(pCommandLine, pConsoleCommandLine);

            // Validate
            pConsoleCommandLine.Error.ToString().Should().BeNullOrEmpty();

            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.Id.Equals(Ids[0])));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.Id.Equals(Ids[1])));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.Id.Equals(Ids[2])));
        }
Example #3
0
 public InOutWithOutDRForm(ItemService itemService, InOutService inOutService,
                           InOrOut inOrOut, Item selectedItem, string name)
 {
     _itemService  = itemService;
     _inOutService = inOutService;
     _inOrOut      = inOrOut;
     _item         = selectedItem;
     _name         = name;
     InitializeComponent();
 }
Example #4
0
 public ReturnedItemForm(ReturnedHistory history, ReturnedHistoryService returnedHistoryService,
                         InOutService inOutService, DRService drService, string name)
 {
     _history = history;
     _returnedHistoryService = returnedHistoryService;
     _inOutService           = inOutService;
     _drService = drService;
     _name      = name;
     InitializeComponent();
     _goodItems  = new List <ReturnedItem>();
     _scrapItems = new List <ScrapItem>();
 }
Example #5
0
        private void cmdCreateReturn_Click(object sender, EventArgs e)
        {
            ItemService            itemService            = new ItemService(_context);
            HistoryService         historyService         = new HistoryService(_context);
            ReturnedHistoryService returnedHistoryService = new ReturnedHistoryService(_context);
            DRService drService = new DRService(_context);

            InOutService inOutService = new InOutService(itemService, historyService,
                                                         drService, returnedHistoryService);

            ReturnedItemForm f = new ReturnedItemForm(null, returnedHistoryService
                                                      , inOutService, drService, _name);

            f.ShowDialog();
        }
Example #6
0
        public InWithDRForm(ItemService itemService, SupplierService supplierService,
                            CustomerService customerService, DRService drService, InOutService inOutService,
                            DRParam param, string name)
        {
            _itemService     = itemService;
            _supplierService = supplierService;
            _customerService = customerService;
            _drService       = drService;
            _inOutService    = inOutService;
            _param           = param;
            _name            = name;

            _items   = _itemService.AllActiveItems();
            _drItems = new List <DRItem>();

            InitializeComponent();
        }
Example #7
0
        public void Success_ArgumentBinding(
            string pCommandLineTemplate,
            TestConsole pConsoleCommandLine,
            InOutService pInOutService,
            [Frozen] IVendorService pVendorService,
            [Frozen] string pIdCompany)
        {
            // Setup data
            var fCommandLine = string.Format(pCommandLineTemplate,
                                             pIdCompany);

            // Setup services
            var pCommand = new ListVendorsCommand(pVendorService, pInOutService, null);

            // Test
            pCommand.Invoke(fCommandLine, pConsoleCommandLine);

            // Validate
            pConsoleCommandLine.Error.ToString().Should().BeNullOrEmpty();
            pVendorService.Received(1);
            pVendorService.Received().List(
                Arg.Is <string>(x => x.Equals(pIdCompany)));
        }
        public void Success_ArgumentBinding(
            string pCommandLineTemplate,
            TestConsole pConsoleCommandLine,
            InOutService pInOutService,
            [Frozen] IVendorService pVendorService,
            [Frozen] Vendor pVendor)
        {
            // Setup data
            var fCommandLine = string.Format(pCommandLineTemplate,
                                             pVendor.IdCompany,
                                             pVendor.AdministrationCode,
                                             pVendor.CountryCode,
                                             pVendor.CurrencyCode,
                                             String.Join(" ", pVendor.Iban),
                                             pVendor.DefaultLedgerCode,
                                             pVendor.DefaultPaymentTermCode,
                                             pVendor.DefaultVatCode);

            // Setup services
            var pCommand = new CreateVendorCommand(pVendorService, pInOutService, null);

            // Test
            pCommand.Invoke(fCommandLine, pConsoleCommandLine);

            // Validate
            pConsoleCommandLine.Error.ToString().Should().BeNullOrEmpty();
            pVendorService.Received(1);
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.IdCompany.Equals(pVendor.IdCompany)));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.AdministrationCode.Equals(pVendor.AdministrationCode)));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.CountryCode.Equals(pVendor.CountryCode)));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.CurrencyCode.Equals(pVendor.CurrencyCode)));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.Iban.SequenceEqual(pVendor.Iban)));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.DefaultLedgerCode.Equals(pVendor.DefaultLedgerCode)));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.DefaultPaymentTermCode.Equals(pVendor.DefaultPaymentTermCode)));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.DefaultVatCode.Equals(pVendor.DefaultVatCode)));
            pVendorService.Received().CreateOrUpdate(Arg.Is <Vendor>(x => x.Name.Equals(pVendor.AdministrationCode)));
        }
Example #9
0
        private void cmdEditReturn_Click(object sender, EventArgs e)
        {
            if (listViewReturn.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select History from the list", "",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            long                   returnId               = Convert.ToInt64(listViewReturn.SelectedItems[0].SubItems[0].Text);
            ItemService            itemService            = new ItemService(_context);
            HistoryService         historyService         = new HistoryService(_context);
            ReturnedHistoryService returnedHistoryService = new ReturnedHistoryService(_context);
            DRService              drService              = new DRService(_context);

            InOutService inOutService = new InOutService(itemService, historyService,
                                                         drService, returnedHistoryService);

            ReturnedHistory  h = returnedHistoryService.GetHistory(returnId);
            ReturnedItemForm f = new ReturnedItemForm(h, returnedHistoryService,
                                                      inOutService, drService, _name);

            f.ShowDialog();
        }
Example #10
0
        private void loadSDRForm(ReceiptType type, Operation operation,
                                 SupplierOrCustomer sc, DR selectedSDR)
        {
            ItemService            itemService            = new ItemService(_context);
            HistoryService         historyService         = new HistoryService(_context);
            SupplierService        supplierService        = new SupplierService(_context);
            CustomerService        customerService        = new CustomerService(_context);
            DRService              drService              = new DRService(_context);
            ReturnedHistoryService returnedHistoryService = new ReturnedHistoryService(_context);
            InOutService           inOutService           = new InOutService(itemService, historyService,
                                                                             drService, returnedHistoryService);

            DRParam p = new DRParam();

            p.ReceiptType = type;
            p.Operation   = operation;
            p.SC          = sc;
            p.SelectedDR  = selectedSDR;

            InWithDRForm f = new InWithDRForm(itemService, supplierService, customerService,
                                              drService, inOutService, p, _name);

            f.ShowDialog();
        }
        public void Success_ConsolOutput(
            EFormatType pFormat,
            TestConsole pConsoleCommandLine,
            InOutService pInOutService,
            [Frozen] IVendorService pVendorService,
            [Frozen] Vendor pVendor)
        {
            // Setup data
            pVendorService
            .CreateOrUpdate(Arg.Any <Vendor>())
            .Returns(new BaseResultModel <Vendor>(pVendor, null));

            var fCommandLine = $"-c IdCompany -a AdministrationCode --country CountryCode --currency CurrencyCode --iban Iban -f {pFormat}";

            // Setup services
            var pCommand = new CreateVendorCommand(pVendorService, pInOutService, null);

            // Test
            pCommand.Invoke(fCommandLine, pConsoleCommandLine);

            // Validate
            pConsoleCommandLine.Error.ToString().Should().BeNullOrEmpty();
            pVendorService.Received(1);
        }
Example #12
0
        public void Success_ConsolOutput(
            EFormatType pFormat,
            TestConsole pConsoleCommandLine,
            InOutService pInOutService,
            [Frozen] IVendorService pVendorService,
            [Frozen] IList <Vendor> pVendors)
        {
            // Setup data
            pVendorService
            .List(Arg.Any <string>())
            .Returns(pVendors);

            var fCommandLine = $"-c IdCompany -f {pFormat}";

            // Setup services
            var pCommand = new ListVendorsCommand(pVendorService, pInOutService, null);

            // Test
            pCommand.Invoke(fCommandLine, pConsoleCommandLine);

            // Validate
            pConsoleCommandLine.Error.ToString().Should().BeNullOrEmpty();
            pVendorService.Received(1);
        }
        public ActionResult SubIndex()
        {
            var service = new InOutService();

            return(View(service.CreateFakeData(50)));
        }
 public void TearDown()
 {
     _IOS = null;
 }