コード例 #1
0
 public void New()
 {
     SelectedObject = new SalesOutlet()
     {
         SalesOutletId = new Guid()
     };
 }
コード例 #2
0
        public bool CanSave()
        {
            if (SelectedObject == null)
            {
                return(IsNewRecord = false);
            }
            SalesOutlet item = unitOfWork.SalesOutletRepository.GetByID(SelectedObject.SalesOutletId).Result;

            return(IsNewRecord = item == null);
        }
コード例 #3
0
 public SalesOutletViewModel()
 {
     CompanyData = new ObservableCollection <Company>(unitOfWork.CompanyRepository.Get());
     if (CompanyData.Count != 0)
     {
         SelectedObject = new SalesOutlet()
         {
             SalesOutletId = new Guid(), CompanyId = CompanyData.FirstOrDefault().ID
         }
     }
     ;
     GridCollection = new ObservableCollection <object>(unitOfWork.SalesOutletRepository.Get());
 }
コード例 #4
0
 public async Task Update()
 {
     try
     {
         unitOfWork.SalesOutletRepository.Update(SelectedObject);
         await unitOfWork.SaveAsync();
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message);
     }
     finally
     {
         SelectedObject = new SalesOutlet()
         {
         };
         GridCollection = new ObservableCollection <object>(unitOfWork.SalesOutletRepository.Get());
     }
 }
コード例 #5
0
        public async Task Delete()
        {
            try
            {
                await unitOfWork.SalesOutletRepository.DeleteAsync(SelectedObject.SalesOutletId);

                await unitOfWork.SaveAsync();

                GridCollection.Remove(SelectedObject);
                MessageBoxService.Show("Category record Deleted");
            }
            catch (Exception ex)
            {
                MessageBoxService.Show(ex.InnerException.Message);
            }
            finally
            {
                SelectedObject = new SalesOutlet()
                {
                };
            }
        }
コード例 #6
0
        public void SetUp()
        {
            var outlet1 = new SalesOutlet {
                AccountId = 1, OutletNumber = 1, Name = "so1"
            };
            var outlet2 = new SalesOutlet {
                AccountId = 2, OutletNumber = 2, Name = "so2"
            };

            this.SalesOutletService.SearchSalesOutlets("so").Returns(
                new SuccessResult <IEnumerable <SalesOutlet> >(new List <SalesOutlet> {
                outlet1, outlet2
            }));

            this.Response = this.Browser.Get(
                "/inventory/sales-outlets",
                with =>
            {
                with.Header("Accept", "application/json");
                with.Query("searchTerm", "so");
            }).Result;
        }
        public void SetUp()
        {
            var account = new SalesAccount
            {
                OrgId          = 1,
                ContactId      = 1,
                ContactDetails = new Contact {
                    EmailAddress = "*****@*****.**", AddressId = 1
                }
            };
            var orders = new List <SalesOrder>
            {
                new SalesOrder
                {
                    SalesOutlet = new SalesOutlet
                    {
                        AccountId    = 1,
                        OutletNumber = 1,
                        OrderContact = new Contact
                        {
                            EmailAddress = null,
                            AddressId    = 1
                        }
                    }
                },
            };
            var outlet = new SalesOutlet {
                OutletAddressId = 1
            };
            var outlets = new List <SalesOutlet> {
                outlet
            };
            var consignment = new Consignment
            {
                SalesAccount = account,
                Items        = new List <ConsignmentItem> {
                    new ConsignmentItem {
                        OrderNumber = 1
                    }
                },
                Address = new Address {
                    Country = new Country {
                        CountryCode = "GB"
                    }
                }
            };

            this.shipfileData = new ConsignmentShipfile
            {
                Id          = 1,
                Consignment = consignment
            };

            this.toSend = new List <ConsignmentShipfile>
            {
                new ConsignmentShipfile {
                    Id = 1
                }
            };

            this.ShipfileRepository.FindById(1).Returns(this.shipfileData);

            this.OutletRepository.FilterBy(Arg.Any <Expression <Func <SalesOutlet, bool> > >())
            .Returns(outlets.AsQueryable());
            this.OutletRepository.FindBy(Arg.Any <Expression <Func <SalesOutlet, bool> > >()).Returns(outlet);
            this.SalesOrderRepository.FilterBy(Arg.Any <Expression <Func <SalesOrder, bool> > >()).Returns(orders.AsQueryable());
            this.ConsignmentRepository.FindById(1).Returns(consignment);
            this.DataService.GetPdfModelData(Arg.Any <int>(), Arg.Any <int>()).Returns(
                new ConsignmentShipfilePdfModel
            {
                PackingList       = new PackingListItem[] { },
                DespatchNotes     = new DespatchNote[] { new DespatchNote() },
                DateDispatched    = "12/05/2008 09:34:58",
                ConsignmentNumber = "1"
            });
            this.result = this.Sut.SendEmails(this.toSend);
        }
コード例 #8
0
        public async Task ChangeQty(Item item, float Qty, SalesOutlet salesOutlet, string reference)
        {
            await context.ItemInventories.AddAsync(new ItemInventory { ItemId = item.ItemId, Quantity = Qty, QuantityInStock = GetItemsInStock(item.ItemId) + Qty, Reference = reference, CostCenterId = salesOutlet.SalesOutletId, OtherDetails = reference });

            await context.SaveChangesAsync();
        }