// Creates new building and adds it to the building repository // Sets and return selected building to use in the MainViewModel public Building AddBuilding(string name) { SelectedBuilding = new Building(name); _buildingRepository.AddBuilding(SelectedBuilding); SelectedCustomer.AddBuilding(SelectedBuilding); return(SelectedBuilding); }
private void buttonOK_Click(object sender, EventArgs e) { if (validateInputs()) { SelectedBankAccount = comboBoxAccounts.SelectedItem as BankAccount; ToAccount = comboBoxToAccounts.SelectedItem as BankAccount; BankAccountCollection involvedAccounts = new BankAccountCollection(); involvedAccounts.Add(SelectedBankAccount); involvedAccounts.Add(ToAccount); transaction.Accounts = involvedAccounts; transaction.Amount = getAmountEntered(); try { transaction.DoTransaction(); SelectedCustomer.AddTransaction(transaction); this.DialogResult = DialogResult.OK; } catch (Exception ex) { errorProviderMain.SetError(textBoxAmount, ex.Message); } } }
//public ICommand DeleteCustomerCommand //{ // get { return new RelayCommand(DeleteCustomer); } //} private async void SaveCustomer() { if (SelectedCustomer == null || !SelectedCustomer.IsValid()) { Error = "Klant niet gewijzigd, hou rekening met de meldingen."; return; } else { Error = ""; } string input = JsonConvert.SerializeObject(SelectedCustomer); using (HttpClient client = new HttpClient()) { client.SetBearerToken(ApplicationVM.token.AccessToken); HttpResponseMessage response = await client.PutAsync("http://localhost:55853/api/customer", new StringContent(input, Encoding.UTF8, "application/json")); if (!response.IsSuccessStatusCode) { Console.WriteLine("error"); } } }
protected void lnkAlbum_Click(object sender, EventArgs e) { LinkButton lnkAlbum = (LinkButton)sender; Int16 customerAlbumId = Convert.ToInt16(lnkAlbum.CommandArgument); SelectedCustomerAlbum = SelectedCustomer.GetCustomerAlbumById(customerAlbumId); Response.Redirect("CustomerAlbum.aspx"); }
private void DeactivateCustomer() { if (SelectedCustomer != null) { SelectedCustomer.Deactivate(); _deactivatedCustomers.Add(SelectedCustomer); _activatedCustomers.Remove(SelectedCustomer); } }
public async Task DeleteSelectedCustomerAsync() { if (SelectedCustomer != null) { SelectedCustomer.Delete(); await unitOfWork.CommitChangesAsync(); await ReloadAsync(); } }
public IActionResult NoSuchAsCustomer(string customerNumber, string bank) { var selectedCustomer = new SelectedCustomer(); selectedCustomer.Bank = Int32.Parse(bank); selectedCustomer.CustomerNumber = customerNumber; return(View(selectedCustomer)); }
public ActionResult ChosenDropDown(Customers cus) { SelectedCustomer sc = new SelectedCustomer(); string con = string.Join(",", cus.CustomersArray.ToArray()); sc.AllCustomers = con; db.SelectedCustomers.Add(sc); db.SaveChanges(); return(RedirectToAction("ChosenDropDown")); }
private async Task OnUpdateCustomerCommandExecuteAsync() { var typeFactory = this.GetTypeFactory(); var viewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <CustomerUpdateWindowViewModel>(SelectedCustomer); if (await _uiVisualizerService.ShowDialogAsync(viewModel) ?? false) { SelectedCustomer.Save(); } }
protected void btnDeleteCustomer_Click(object sender, EventArgs e) { if (SelectedCustomer.IsInDatabase) { SelectedCustomer.Delete(); SelectedCustomer = null; } Response.Redirect("Customers.aspx"); }
private async Task DeleteSelectedItemAsync() { if (SelectedCustomer.IsNew) { _customers.Remove(SelectedCustomer); } else { await SelectedCustomer.DeleteAsync(); } }
private bool CanExecuteAddClient() { if (SelectedCustomer == null) { return(false); } else { return(SelectedCustomer.IsValid()); } }
/// <summary> /// Изменение Клиента /// </summary> /// <param name="obj">Не нужно</param> private void EditCustomer(object obj) { IsEditing = !IsEditing; if (!IsEditing) { SelectedCustomer.CancelEdit(); } else { SelectedCustomer.BeginEdit(); } }
private bool IsCustomerInDB(SelectedCustomer selectedCustomer) { var ret = false; string[] pathParams = { @"ExternalData", "clients.csv" }; var fileFullPath = Path.Combine(_environment.WebRootPath, Path.Combine(pathParams)); var externalData = ExternalDBHelper.LoadExternalData(fileFullPath); IEnumerable <ClientAccount> results = externalData.Where(x => x.BankId == selectedCustomer.Bank.ToString() && x.ClientId == selectedCustomer.CustomerNumber.PadLeft(8, '0')); ret = results.Count() != 0; return(ret); }
public async Task <IActionResult> CheckCustomer(SelectedCustomer selectedCustomer) { if (!IsCustomerInDB(selectedCustomer)) { return(RedirectToAction("NoSuchAsCustomer", new { customerNumber = selectedCustomer.CustomerNumber, bank = selectedCustomer.Bank })); } var client = new HttpClient(); var token = await APIHelper.GetTokenAsync(_APISettingsConfig, client, selectedCustomer.CustomerNumber.PadLeft(8, '0'), selectedCustomer.Bank.ToString()); _sessionTempDataServices.SetToken(token); _sessionTempDataServices.SetCurrentCustomer(selectedCustomer); return(RedirectToAction("ShowAccounts", "Home")); }
public SelectedCustomer GetCurrentCustomer() { var customer = new SelectedCustomer(); if (_tempData.Peek("SelectedBank") != null) { customer.Bank = Convert.ToInt32(_tempData.Peek("SelectedBank")); } if (_tempData.Peek("SelectedCustomerNumber") != null) { customer.CustomerNumber = _tempData.Peek("SelectedCustomerNumber").ToString(); } return(customer); }
/// <summary> /// Сохранение клиента /// </summary> /// <param name="obj">Не нужно</param> private void SaveCustomer(object obj) { SelectedCustomer.EndEdit(); IsEditing = false; if (!Customers.Contains(SelectedCustomer)) { if (CurrentRepo == RepositoryType.Customers) { App.customerDataService.NewCustomer(SelectedCustomer); } else if (CurrentRepo == RepositoryType.Employees) { App.mechanicDataService.NewEmployee(SelectedCustomer); } Customers.Add(SelectedCustomer); } }
public void AddTest(string customer, string building, string aggregate) { var c = new Customer(name: customer); SelectedCustomer = c; _customerRepository.AddCustomer(c); var b = new Building(name: building); SelectedBuilding = b; SelectedCustomer.AddBuilding(b); _buildingRepository.AddBuilding(b); var ag1 = new VentilationAggregate(orderNumber: aggregate); //var ag2 = new VentilationAggregate("666"); SelectedBuilding.AddVentilationAggregate(ag1); //selectedBuilding.AddVentilationAggregate(ag2); _ventilationAggregateRepository.AddVentilationAggregate(ag1); //ventilationAggregateRepository.AddVentilationAggregate(ag2); }
private void UpdateFoundCustomers() { IEnumerable <Customer> result = new List <Customer>(); using (var worker = new BackgroundWorker()) { worker.DoWork += delegate { bool searchPn = string.IsNullOrEmpty(PhoneNumberSearchText); bool searchCn = string.IsNullOrEmpty(CustomerNameSearchText); bool searchAd = string.IsNullOrEmpty(AddressSearchText); result = Dao.Query <Customer>( x => (searchPn || x.PhoneNumber.Contains(PhoneNumberSearchText)) && (searchCn || x.Name.ToLower().Contains(CustomerNameSearchText.ToLower())) && (searchAd || x.Address.ToLower().Contains(AddressSearchText.ToLower()))); }; worker.RunWorkerCompleted += delegate { AppServices.MainDispatcher.BeginInvoke(DispatcherPriority.Normal, new Action( delegate { FoundCustomers.Clear(); FoundCustomers.AddRange(result.Select(x => new CustomerViewModel(x))); if (SelectedCustomer != null && PhoneNumberSearchText == SelectedCustomer.PhoneNumber) { SelectedView = 1; SelectedCustomer.UpdateDetailedInfo(); } RaisePropertyChanged("SelectedCustomer"); CommandManager.InvalidateRequerySuggested(); })); }; worker.RunWorkerAsync(); } }
public void Disconnect() { CanDisconnect = false; var customerToSave = SelectedCustomer.StandardClone(); parentWindow.RunAsynchronousOperation(delegate { try { customerToSave.ConnectedAccount = null; customerToSave = ServiceManager.SaveCustomer(customerToSave); CustomersReposidory.Instance.Update(customerToSave); SelectedCustomer = customerToSave; parentWindow.SynchronizationContext.Send(state => EditMode = false, null); } finally { CanDisconnect = true; } }); }
/* * this is reactive ui listener on Reactive list * there are listing for any change on isCheck prop * **/ private void SetReactiveListListen() { Customers.ItemChanged.Where(x => x.PropertyName == "IsChecked") .Select(x => x.Sender) .Subscribe(x => { var tempList = SelectedCustomer.ToList(); if (x.IsChecked == false) { tempList.Remove(x); } else { tempList.Add(x); } SelectedCustomer = new ReactiveList <Customer>(tempList); tempList = null; }); Schemes.ItemChanged.Where(x => x.PropertyName == "IsChecked") .Select(x => x.Sender) .Subscribe(x => { var tempList = SelectedSchemes.ToList(); if (x.IsChecked == false) { tempList.Remove(x); } else { tempList.Add(x); } SelectedSchemes = new ReactiveList <Scheme>(tempList); tempList = null; }); }
public void RefreshSelectedCustomer() { ClearSearchValues(); if (AppServices.MainDataContext.SelectedTicket != null && AppServices.MainDataContext.SelectedTicket.CustomerId > 0) { var customer = Dao.SingleWithCache <Customer>(x => x.Id == AppServices.MainDataContext.SelectedTicket.CustomerId); if (customer != null) { FoundCustomers.Add(new CustomerViewModel(customer)); } if (SelectedCustomer != null) { SelectedView = 1; SelectedCustomer.UpdateDetailedInfo(); } } RaisePropertyChanged("SelectedCustomer"); RaisePropertyChanged("IsClearVisible"); RaisePropertyChanged("IsResetCustomerVisible"); RaisePropertyChanged("IsMakePaymentVisible"); ActiveView = 0; SelectedCustomerTransactions.Clear(); }
private void OnDeleteCustomerCommandExecute() { SelectedCustomer.Remove(); Customers.Remove(SelectedCustomer); SelectedCustomer = null; }
public void DeleteDepartment(Department department) { SelectedCustomer.DeleteDepartment(department); }
public void DeleteCustomer() { SelectedCustomer.DeleteCustomer(); }
public void AddContact() { SelectedCustomer.AddContact(new Contact()); }
public void RemoveContact(Contact deleteme) { SelectedCustomer.RemoveContact(deleteme); }
/// <summary> /// Cancels the changes in progress. /// </summary> private void OnCancelEdits() { IsInEdit = false; SelectedCustomer.Restore(); }
public void SetCurrentCustomer(SelectedCustomer customer) { _tempData["SelectedBank"] = customer.Bank; _tempData["SelectedCustomerNumber"] = customer.CustomerNumber; }