public void AddContact(CustomerBaseRepresentation firm, CustomerBaseRepresentation agent) { using (ISQLConnection dataSource = DataSource) { dataSource.AddContact(RepresentationConverter.convertCustomer(firm), RepresentationConverter.convertCustomer(agent)); } }
public void UpdateCustomer(CustomerBaseRepresentation customer) { using (ISQLConnection dataSource = DataSource) { dataSource.UpdateCustomer(RepresentationConverter.convertCustomer(customer)); } }
public static Customers convertCustomer(CustomerBaseRepresentation customer) { // TODO: Implement concurency checking (rowVersion) var convertedCustomer = new Customers() { customerID = customer.id, comment = customer.comment, customerAddress = customer.customerAddress, customerName = customer.customerName, customerPhone = customer.customerPhone, defaultDiscount = customer.defaultDiscount * 100, IDNumber = customer.IDNumber, isDeleted = customer.isDeleted, isFirm = customer.isFirm, problems = customer.problems, rentCounter = customer.rentCounter, serviceCounter = customer.serviceCounter }; if (customer.GetType() == typeof(PersonRepresentation)) { convertedCustomer.birthDate = ((PersonRepresentation)customer).birthDate; convertedCustomer.mothersName = ((PersonRepresentation)customer).mothersName; convertedCustomer.workPlace = ((PersonRepresentation)customer).workplace; } if (customer.city != null) { convertedCustomer.cityID = customer.city.id; } return(convertedCustomer); }
public long AddCustomer(CustomerBaseRepresentation customer) { using (ISQLConnection dataSource = DataSource) { return(dataSource.AddCustomer(RepresentationConverter.convertCustomer(customer))); } }
public ObservableCollection <CustomerBaseRepresentation> GetContacts(CustomerBaseRepresentation firm) { using (ISQLConnection dataSource = DataSource) { List <Customers> contactList = dataSource.GetContacts(RepresentationConverter.convertCustomer(firm)); List <CustomerBaseRepresentation> contactListRep = contactList.Select(c => RepresentationConverter.convertCustomer(c)).ToList(); return(new ObservableCollection <CustomerBaseRepresentation>(contactListRep)); } }
public NewService_SubTab() { CustomerSelector UCCustomerSelector; InitializeComponent(); UCCustomerSelector = new CustomerSelector(OperationTypeEnum.Service); grdNewWSCustomer.Children.Add(UCCustomerSelector); var UCNewService = new NewService(); grdNewService.Children.Add(UCNewService); UCCustomerSelector.customerPicker_VM.CustomerSelected += (s, a) => { CustomerBaseRepresentation customer = (CustomerBaseRepresentation)s; UCNewService.newService_VM.newService.customer = customer; UCNewService.newService_VM.newService.discount = customer.defaultDiscount; UCCustomerSelector.expCustomer.IsExpanded = false; }; }
private void addContact(CustomerBaseRepresentation c) { DataProxy.Instance.AddContact(selectedCustomer, c); refreshContacts(); }
public static void Send(CustomerBaseRepresentation selectedContactPerson) { Messenger.Default.Send(selectedContactPerson, MessageTypes.contactSelected); }
public static void Send(CustomerBaseRepresentation selectedCustomer) { Messenger.Default.Send(selectedCustomer, MessageTypes.customerToRent); }
public NewRent_SubTab() { CustomerSelector UCCustomerSelector; ToolSelector UCToolSelector; InitializeComponent(); UCCustomerSelector = new CustomerSelector(OperationTypeEnum.Rental); grdCustomer.Children.Add(UCCustomerSelector); UCToolSelector = new ToolSelector(); grdToolSelect.Children.Add(UCToolSelector); var UCNewRent = new NewRent(); grdNewRent.Children.Add(UCNewRent); UCCustomerSelector.customerPicker_VM.CustomerSelected += (s, a) => { CustomerBaseRepresentation customer = (CustomerBaseRepresentation)s; UCNewRent.newRent_VM.newRental.customer = customer; UCNewRent.newRent_VM.newRental.discount = customer.defaultDiscount; UCCustomerSelector.expCustomer.IsExpanded = false; }; UCCustomerSelector.viewModel.contactSelected += (s, a) => { UCNewRent.newRent_VM.newRental.contact = (PersonRepresentation)s; }; UCToolSelector.toolPicker_VM.ToolSelected += (s, a) => { ToolRepresentation tool = s as ToolRepresentation; tool.ValidationRules = new ToolValidationRules(); UCNewRent.newRent_VM.newRental.tool = tool; }; UCNewRent.newRent_VM.RentGroupChanged += (s, a) => { RentalGroup_Representation rentalGroup = s as RentalGroup_Representation; if (rentalGroup.rentals.Count() != 0) { ((CustomerSelector_ViewModel)UCCustomerSelector.DataContext).isReadonly = true; } else { ((CustomerSelector_ViewModel)UCCustomerSelector.DataContext).isReadonly = false; } ((ToolSelector_ViewModel)UCToolSelector.DataContext).selectedTool = null; }; UCNewRent.newRent_VM.RentalGroupFinalizationRequested += (s, a) => { NewRentGroupWindow rg = new NewRentGroupWindow((RentalGroup_Representation)s); NewRentGroup_ViewModel newRentGroup_VM = rg.DataContext as NewRentGroup_ViewModel; newRentGroup_VM.rentGroupAccepted += (so, ar) => { UCNewRent.newRent_VM.newRentalGroup = new RentalGroup_Representation(); UCCustomerSelector.viewModel.selectedCustomer = null; UCToolSelector.viewModel.selectedTool = null; rg.Close(); }; newRentGroup_VM.rentGroupCancelled += (so, ar) => { rg.Close(); }; rg.Show(); }; }