private void btnAdd_Click(object sender, RoutedEventArgs e) { try { if (CheckScreen()) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "Please Fill out all the information"; return; } serviceType = new ServiceType(); bool correctInfo = AddData(serviceType); if (correctInfo == true) { _owner.RefreshDataGrid(); _owner.ChangeStatus("Service Type Successfully Added."); serviceType = null; this.Close(); } else { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "Please Fill out a correct Rate"; txtCost.Text = string.Empty; txtCost.Focus(); return; } } catch (Exception ex) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = ex.Message; } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { if (CheckScreen()) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "Please Fill out all the Information"; return; } user = new User(); int result = AddData(user); if (result == 1) { _owner.RefreshDataGrid(); _owner.ChangeStatus("User Succesfully Added"); this.Close(); user = null; } else { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "The Passwords do not match"; } } catch (Exception ex) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = ex.Message; } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { try { HttpClient client = InitializeClient(); HttpResponseMessage response = new HttpResponseMessage(); string result = ""; if ("Customer" == valueToDelete.ToString() || "Employee" == valueToDelete.ToString()) { response = client.DeleteAsync(valueToDelete.ToString() + "/" + dataToDelete).Result; result = response.Content.ReadAsStringAsync().Result; if (result == "1") { response = client.DeleteAsync("User/" + userIdToDelete).Result; result = response.Content.ReadAsStringAsync().Result; if (result == "1") { _owner.RefreshDataGrid(); _owner.ChangeStatus("Deleted " + valueToDelete + " and User Successfully."); this.Close(); } } } else { response = client.DeleteAsync(valueToDelete.ToString() + "/" + dataToDelete).Result; result = response.Content.ReadAsStringAsync().Result; if (result == "1") { _owner.RefreshDataGrid(); _owner.ChangeStatus("Deleted " + valueToDelete + " Successfully."); this.Close(); } } } catch (Exception ex) { _owner.ChangeStatus(ex.Message); this.Close(); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { if (PropSize(txtPropSize)) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "That Customer has not had a Consultation yet."; LoadScreen(); txtAddress.Text = string.Empty; txtPropSize.Text = string.Empty; txtRate.Text = string.Empty; return; } if (CheckScreen()) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "Please Fill out all the Information."; LoadScreen(); txtAddress.Text = string.Empty; txtPropSize.Text = string.Empty; txtRate.Text = string.Empty; return; } invoice = new Invoice(); int result = AddData(invoice); if (result == 1) { _owner.RefreshDataGrid(); _owner.ChangeStatus("Invoice Successfully Added."); invoice = null; this.Close(); } else { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "Invoice Failed to Add"; } } catch (Exception ex) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = ex.Message; } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { switch (screenMode) { case ScreenMode.Customer: if (CheckScreen()) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "Please Fill out all the Information"; break; } customer = new Customer(); AddData(customer); _owner.RefreshDataGrid(); _owner.ChangeStatus("Customer Succesfully Added"); this.Close(); customer = null; break; case ScreenMode.Employee: if (CheckScreen()) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "Please Fill out all the Information"; break; } employee = new Employee(); AddData(employee); _owner.RefreshDataGrid(); _owner.ChangeStatus("Employee Succesfully Added"); this.Close(); employee = null; break; } } catch (Exception ex) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = ex.Message; } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { try { if (CheckScreen()) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = "Please Fill out all the Information."; return; } appointment = new Appointment(); AddData(appointment); _owner.RefreshDataGrid(); _owner.ChangeStatus("Appointment Successfully Added"); appointment = null; this.Close(); } catch (Exception ex) { lblStatus.Foreground = new SolidColorBrush(Colors.Red); lblStatus.Content = ex.Message; } }