private void Search_Info(object sender, RoutedEventArgs e) { CanvasGrid.Visibility = Visibility.Collapsed; CanvasGrid.Visibility = Visibility.Collapsed; var textSearch = SearchText.Text; var result = true; if (textSearch == null) { SearchInfoCustomer.Visibility = Visibility.Collapsed; MessageShowUi.ShowNoneSearch(); result = false; SearchText.Text = ""; } if (result) { var controller = Controller.controller; long telefon = 0; long.TryParse(textSearch, out telefon); if (controller.SearchCustomer(telefon)) { GetCustomerInfo(); SearchText.Text = ""; } else { SearchInfoCustomer.Visibility = Visibility.Collapsed; MessageShowUi.ShowNoneCustomer(); } } }
/// <summary> /// Обработчик создания нового визита. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void New_SaveVisit(object sender, RoutedEventArgs e) { var controlCustomer = Controller.controller; var result = true; var searchResult = false; long search = 0; long.TryParse(Telefon.Text, out search); double visitSale = 0; double.TryParse(VisitSale.Text, out visitSale); int drink = 0; int.TryParse(NumberOfDrunk.Text, out drink); if (search != 0) { searchResult = controlCustomer.SearchCustomer(search); } else { result = false; } if (visitSale == 0) { MessageShowUi.ShowSaleVisit(); result = false; } if (result) { if (searchResult == true) { var customer = controlCustomer.GetCustomer(); var visit = controlCustomer.NewVisit(customer, visitSale, drink); var customerChange = controlCustomer.GetCustomer(); if (visit == true) { MessageShowUi.ShowSave(); Telefon.Text = ""; VisitSale.Text = ""; NumberOfDrunk.Text = ""; } Close(); } else { MessageShowUi.ShowNoneCustomer(); } } }