private void UpdateHeaderFromDetail() { if (SelectedOrderItemIndex != -1 && Order.OrderItems.Count > 0) { OrderItemWrapper order_item = Order.OrderItems[SelectedOrderItemIndex]; //OrderItem order_item = OrderItems[SelectedOrderItemIndex]; if (order_item != null) { AddressWrapper current_bill_address = order_item.OrderItemBillToAddress as AddressWrapper; if (current_bill_address != null && current_bill_address.AddressKey != 0 && current_bill_address.AddressLine1 != null) { DefaultBillingAddress = current_bill_address; } AddressWrapper current_ship_address = order_item.OrderItemShipToAddress as AddressWrapper; if (current_ship_address != null && current_ship_address.AddressKey != 0 && current_ship_address.AddressLine1 != null) { DefaultShippingAddress = current_ship_address; } RepresentativeWrapper current_sales_rep = order_item.SalesRep as RepresentativeWrapper; if (current_sales_rep != null && current_sales_rep.EntityPersonKey != 0) { Order.SalesRep.EntityPersonKey = current_sales_rep.EntityPersonKey; } RepresentativeWrapper current_account_rep = order_item.AccountRep as RepresentativeWrapper; if (current_account_rep != null && current_account_rep.EntityPersonKey != 0) { Order.AccountRep.EntityPersonKey = current_account_rep.EntityPersonKey; } } } }
private void InitializeFields() { StorageManager.user = UserAccountsWrapper.getById(3); user = StorageManager.user; UserFirstName.Text = user.FirstName; UserLastName.Text = user.LastName; UserPassword.Text = user.Password; UserEmail.Text = user.Email; UserPhone.Text = user.Phone; StorageManager.add = AddressWrapper.getById(user.AddressID); add = StorageManager.add; AddressCountry.Text = add.Country; AddressState.Text = add.State; AddressCity.Text = add.City; AddressSector.Text = add.Sector; AddressStreet.Text = add.Street; AddressNumber.Text = add.StreetNo; AddressBuilding.Text = add.Building; AddressStaircase.Text = add.Staircase; AddressApartment.Text = add.Apartment; AddressFloor.Text = add.Floor; }
public async void ValidateAddress(AddressWrapper which_address) { IAddressService addr_service = service_factory.CreateClient <IAddressService>(); using (addr_service) { try { Task <AddressPostal> task = addr_service.GetAddressInfoByPostalAsync(which_address.AddressPostalCode); await task; AddressPostal postal_info = task.Result; if (postal_info != null) { which_address.AddressCity = postal_info.CityName; which_address.AddressState = postal_info.StateCode; which_address.AddressCounty = postal_info.CountyName; which_address.AddressCountry = postal_info.CountryName; } else { event_aggregator.GetEvent <AccountUpdatedEvent>().Publish("Postal code not found"); } } catch (Exception ex) { event_aggregator.GetEvent <AccountUpdatedEvent>().Publish(ex.Message); return; } } }
protected void Modify_Data(object sender, EventArgs e) { UserAccountsWrapper userWrapper = new UserAccountsWrapper(); AddressWrapper addWrapper = new AddressWrapper(); user.FirstName = UserFirstName.Text; user.LastName = UserLastName.Text; user.Password = UserPassword.Text; user.Email = UserEmail.Text; user.Phone = UserPhone.Text; add.Country = AddressCountry.Text; add.State = AddressState.Text; add.City = AddressCity.Text; add.Sector = AddressSector.Text; add.Street = AddressStreet.Text; add.StreetNo = AddressNumber.Text; add.Building = AddressBuilding.Text; add.Staircase = AddressStaircase.Text; add.Apartment = AddressApartment.Text; add.Floor = AddressFloor.Text; userWrapper.update(user); addWrapper.update(add); }
public void WrapperPropertiesReferenceAddressModelProperties() { var addressWrapper = new AddressWrapper(_address); Assert.Equal("Tottenham", addressWrapper.address.Line2); Assert.Equal(_address.Line1, addressWrapper.address.Line1); }
private void MapAccount(Client.Entities.Account _account) { if (_account != null) { _account_code_holder = _account.AccountCode; Account = new AccountWrapper(_account); AddressWrapper ship_addy = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Shipping).FirstOrDefault(); if (ship_addy != null) { DefaultShippingAddress = ship_addy; // new AddressWrapper(ship_addy); } else { DefaultShippingAddress = new AddressWrapper(new Address() { AddressType = QIQOAddressType.Shipping }); } AddressWrapper bill_addy = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Billing).FirstOrDefault(); if (bill_addy != null) { DefaultBillingAddress = bill_addy; // new AddressWrapper(bill_addy); } else { DefaultBillingAddress = new AddressWrapper(new Address() { AddressType = QIQOAddressType.Billing }); } AddressWrapper mail_addy = Account.Addresses.Where(type => type.AddressType == QIQOAddressType.Mailing).FirstOrDefault(); if (mail_addy != null) { DefaultMailingAddress = mail_addy; // new AddressWrapper(mail_addy); } else { DefaultMailingAddress = new AddressWrapper(new Address() { AddressType = QIQOAddressType.Mailing }); } } }
public bool Add(FieldRefWrapper fldRefW, AddressWrapper addrW) { int[] iarr = new int[2]; iarr[0] = ProgramDoms.domF.IndexOf(fldRefW); if (iarr[0] == -1) { return(false); } iarr[1] = ProgramDoms.domX.IndexOf(addrW); if (iarr[1] == -1) { return(false); } return(base.Add(iarr)); }
public bool Add(VariableWrapper varW, AddressWrapper addrW) { int[] iarr = new int[2]; iarr[0] = ProgramDoms.domV.IndexOf(varW); if (iarr[0] == -1) { return(false); } iarr[1] = ProgramDoms.domX.IndexOf(addrW); if (iarr[1] == -1) { return(false); } return(base.Add(iarr)); }
private void GetAccount(string accountCode) { //throw new NotImplementedException(); ExecuteFaultHandledOperation(() => { var accountService = _serviceFactory.CreateClient <IAccountService>(); var comp = CurrentCompany as Company; using (accountService) { var account = accountService.GetAccountByCode(accountCode, comp.CompanyCode); if (account != null) { if (account.Employees != null) { AccountContacts = new ObservableCollection <AccountPerson>(account.Employees.Where(item => item.CompanyRoleType == QIQOPersonType.AccountContact).ToList()); } // Get the accounts main contact key var contact = account.Employees.Where(item => item.CompanyRoleType == QIQOPersonType.AccountContact).FirstOrDefault(); int cnt_key = contact != null ? contact.EntityPersonKey : 1; Invoice.Account.AccountKey = account.AccountKey; Invoice.Account.AccountName = account.AccountName; Invoice.Account.AccountCode = account.AccountCode; Invoice.Account.AccountDBA = account.AccountDBA; Invoice.Account.AccountDesc = account.AccountDesc; Invoice.AccountKey = account.AccountKey; Invoice.Account.AccountType = account.AccountType; Invoice.AccountContactKey = cnt_key; // account.Employees[0].EntityPersonKey; Invoice.InvoiceAccountContact.PersonFullNameFML = contact != null ? contact.PersonFullNameFML : "N/A"; //Invoice.AccountRepKey = AccountRepList[0].EntityPersonKey; //Invoice.SalesRepKey = SalesRepList[0].EntityPersonKey; DefaultBillingAddress = new AddressWrapper(account.Addresses.Where(item => item.AddressType == QIQOAddressType.Billing).FirstOrDefault()); DefaultShippingAddress = new AddressWrapper(account.Addresses.Where(item => item.AddressType == QIQOAddressType.Shipping).FirstOrDefault()); FeeScheduleList = new ObservableCollection <FeeSchedule>(account.FeeSchedules); _currentAccount = account; RaisePropertyChanged(nameof(Invoice)); GridIsEnabled = true; } else { DisplayErrorMessage($"Account with code '{accountCode}' not found"); } } }); _eventAggregator.GetEvent <NavigationEvent>().Publish(ViewNames.InvoiceHomeView); }
private void WrapEmployee(Employee emp) { if (emp.EntityPersonKey == 0) { GetNewEmployeeAttributes(emp); } CurrentEmployee = new EmployeeWrapper(emp); CurrentEmployee.PropertyChanged += Context_PropertyChanged; if (emp.Addresses.Count > 0) { DefaultAddress = new AddressWrapper(emp.Addresses[0]); } else { DefaultAddress = new AddressWrapper(new Address()); } }
private void InitializeFields() { StorageManager.user = UserAccountsWrapper.getById(((UserAccount)Session["loggedUser"]).UserID); user = StorageManager.user; UserFirstName.Text = user.FirstName; UserLastName.Text = user.LastName; UserPassword.Text = user.Password; UserEmail.Text = user.Email; UserPhone.Text = user.Phone; StorageManager.add = AddressWrapper.getById(user.AddressID); add = StorageManager.add; AddressCountry.Text = add.Country; AddressState.Text = add.State; AddressCity.Text = add.City; }
protected void Modify_Data(object sender, EventArgs e) { UserAccountsWrapper userWrapper = new UserAccountsWrapper(); AddressWrapper addWrapper = new AddressWrapper(); user.FirstName = UserFirstName.Text; user.LastName = UserLastName.Text; user.Password = UserPassword.Text; user.Email = UserEmail.Text; user.Phone = UserPhone.Text; add.Country = AddressCountry.Text; add.State = AddressState.Text; add.City = AddressCity.Text; userWrapper.update(user); addWrapper.update(add); }
private void InitNewOrder() { Order new_order = new Order() //*** GET this initializatoin stuff into the objects themselves!! (complete) { OrderEntryDate = DateTime.Now, OrderStatusDate = DateTime.Now, DeliverByDate = DateTime.Now.AddDays(7), // think about a defaul lead time for each account SalesRep = SalesRepList[0], AccountRep = AccountRepList[0] }; new_order.OrderItems.Add(InitNewOrderItem(1)); SelectedOrderItemIndex = 0; Order = new OrderWrapper(new_order); DefaultBillingAddress = new AddressWrapper(new Address()); DefaultShippingAddress = new AddressWrapper(new Address()); Order.PropertyChanged += Context_PropertyChanged; Order.AcceptChanges(); GridIsEnabled = false; }
private void InitNewInvoice() { Invoice new_order = new Invoice() //*** GET this initializatoin stuff into the objects themselves!! (complete) { InvoiceEntryDate = DateTime.Now, InvoiceStatusDate = DateTime.Now, OrderEntryDate = DateTime.Now, //DeliverByDate = DateTime.Now.AddDays(7), // think about a due date instead SalesRep = SalesRepList[0], AccountRep = AccountRepList[0] }; new_order.InvoiceItems.Add(InitNewInvoiceItem(1)); SelectedInvoiceItemIndex = 0; Invoice = new InvoiceWrapper(new_order); DefaultBillingAddress = new AddressWrapper(new Address()); DefaultShippingAddress = new AddressWrapper(new Address()); Invoice.PropertyChanged += Context_PropertyChanged; Invoice.AcceptChanges(); _workingInvoiceService.OpenInvoice(Invoice); GridIsEnabled = false; }
public static void Save(IValueSink sink, AddressWrapper value) { Value<NetworkAddress>.Save(sink, value.Item); }
public void PxassedAddressIsNotNull() { ViewModel.AddressWrapper addressWrapper; ArgumentNullException ex = Assert.Throws <ArgumentNullException>(() => addressWrapper = new AddressWrapper(null)); var exceptionMessage = ex.ParamName; Assert.Equal("Address must not be null", exceptionMessage); }
public void WrapperContainsAddressModel() { var addressWrapper = new AddressWrapper(_address); Assert.Equal(_address, addressWrapper.address); }
private void GenerateInvoiceFromOrderItems(List <Order> orders) { // We don't have everything about the order that we need, so we have to go and get them var ordersToInvoice = new List <Order>(orders.Count); var orderService = _serviceFactory.CreateClient <IOrderService>(); var invoiceService = _serviceFactory.CreateClient <IInvoiceService>(); foreach (var order in orders) { ordersToInvoice.Add(orderService.GetOrder(order.OrderKey)); } // Now that we have the full order(s), we can create an invoice from the data in them var newInvoice = new Invoice() { AccountKey = ordersToInvoice[0].AccountKey, OrderEntryDate = ordersToInvoice[0].OrderEntryDate, OrderShipDate = ordersToInvoice[0].OrderShipDate, AccountContactKey = ordersToInvoice[0].AccountContactKey, FromEntityKey = ordersToInvoice[0].OrderKey, InvoiceEntryDate = DateTime.Now, InvoiceStatus = QIQOInvoiceStatus.New, InvoiceStatusDate = DateTime.Now, AccountRepKey = ordersToInvoice[0].AccountRepKey, SalesRepKey = ordersToInvoice[0].SalesRepKey //SalesRep = orders_to_invoice[0].SalesRep }; newInvoice.Account.AccountCode = ordersToInvoice[0].Account.AccountCode; newInvoice.Account.AccountName = ordersToInvoice[0].Account.AccountName; newInvoice.SalesRep.PersonFullNameFML = ordersToInvoice[0].SalesRep.PersonFullNameFML; newInvoice.SalesRep.EntityPersonKey = ordersToInvoice[0].SalesRep.EntityPersonKey; newInvoice.AccountRep.PersonFullNameFML = ordersToInvoice[0].AccountRep.PersonFullNameFML; newInvoice.AccountRep.EntityPersonKey = ordersToInvoice[0].AccountRep.EntityPersonKey; DefaultBillingAddress = new AddressWrapper(ordersToInvoice[0].Account.Addresses.Where(addr => addr.AddressType == QIQOAddressType.Billing).FirstOrDefault()); DefaultShippingAddress = new AddressWrapper(ordersToInvoice[0].Account.Addresses.Where(addr => addr.AddressType == QIQOAddressType.Shipping).FirstOrDefault()); foreach (var ord in ordersToInvoice) { var items_to_invoice = ord.OrderItems.Where(item => (item.OrderItemStatus != QIQOOrderItemStatus.Canceled && item.OrderItemStatus != QIQOOrderItemStatus.Complete)).ToList(); foreach (var item in ord.OrderItems) { var inv_item = invoiceService.GetInvoiceItemByOrderItemKey(item.OrderItemKey); if (inv_item == null) { var newInvoiceItem = new InvoiceItem() { AccountRep = item.AccountRep, SalesRep = item.SalesRep, FromEntityKey = item.OrderItemKey, InvoiceItemLineSum = item.OrderItemLineSum, InvoiceItemProduct = item.OrderItemProduct, InvoiceItemQuantity = item.OrderItemQuantity, InvoiceItemSeq = item.OrderItemSeq, InvoiceItemStatus = QIQOInvoiceItemStatus.New, ItemPricePer = item.ItemPricePer, ProductDesc = item.ProductDesc, ProductKey = item.ProductKey, ProductName = item.ProductName, OrderItemShipDate = item.OrderItemShipDate }; newInvoiceItem.SalesRep.EntityPersonKey = item.SalesRep.EntityPersonKey; //new_invoice_item.OrderItemBillToAddress.AddressKey = item.OrderItemBillToAddress.AddressKey; //new_invoice_item.OrderItemShipToAddress.AddressKey = item.OrderItemShipToAddress.AddressKey; newInvoiceItem.InvoiceItemProduct.ProductKey = item.OrderItemProduct.ProductKey; newInvoiceItem.InvoiceItemProduct.ProductCode = item.OrderItemProduct.ProductCode; newInvoiceItem.InvoiceItemProduct.ProductDesc = item.OrderItemProduct.ProductDesc; newInvoiceItem.InvoiceItemProduct.ProductName = item.OrderItemProduct.ProductName; newInvoiceItem.InvoiceItemProduct.ProductType = item.OrderItemProduct.ProductType; //order_item.InvoiceItemBillToAddress = DefaultBillingAddress; //FillFromDefaultAddress(new_invoice_item, QIQOAddressType.Billing); newInvoiceItem.OrderItemBillToAddress.AddressKey = DefaultBillingAddress.AddressKey; newInvoiceItem.OrderItemBillToAddress.AddressType = QIQOAddressType.Billing; newInvoiceItem.OrderItemBillToAddress.AddressLine1 = DefaultBillingAddress.AddressLine1; newInvoiceItem.OrderItemBillToAddress.AddressLine2 = DefaultBillingAddress.AddressLine2; newInvoiceItem.OrderItemBillToAddress.AddressCity = DefaultBillingAddress.AddressCity; newInvoiceItem.OrderItemBillToAddress.AddressState = DefaultBillingAddress.AddressState; newInvoiceItem.OrderItemBillToAddress.AddressPostalCode = DefaultBillingAddress.AddressPostalCode; //order_item.InvoiceItemShipToAddress = DefaultShippingAddress; //FillFromDefaultAddress(new_invoice_item, QIQOAddressType.Shipping); newInvoiceItem.OrderItemShipToAddress.AddressKey = DefaultShippingAddress.AddressKey; newInvoiceItem.OrderItemShipToAddress.AddressType = QIQOAddressType.Shipping; newInvoiceItem.OrderItemShipToAddress.AddressLine1 = DefaultShippingAddress.AddressLine1; newInvoiceItem.OrderItemShipToAddress.AddressLine2 = DefaultShippingAddress.AddressLine2; newInvoiceItem.OrderItemShipToAddress.AddressCity = DefaultShippingAddress.AddressCity; newInvoiceItem.OrderItemShipToAddress.AddressState = DefaultShippingAddress.AddressState; newInvoiceItem.OrderItemShipToAddress.AddressPostalCode = DefaultShippingAddress.AddressPostalCode; newInvoiceItem.AccountRep.EntityPersonKey = _accountReps[0].EntityPersonKey; newInvoiceItem.SalesRep.EntityPersonKey = _salesReps[0].EntityPersonKey; //new_invoice_item.InvoiceItemSeq = SelectedInvoiceItemIndex + 1; newInvoice.InvoiceItems.Add(newInvoiceItem); } } } Invoice = new InvoiceWrapper(newInvoice); GetAccount(newInvoice.Account.AccountCode); UpdateItemTotals(); InvalidateCommands(); }
public static void Save(IValueSink sink, AddressWrapper value) { Value <NetworkAddress> .Save(sink, value.Item); }