private void button2_Click(object sender, EventArgs e) { Client client = ClientDA.Search(Convert.ToInt32(textBoxSearch.Text)); if (client != null) { textBoxClientId.Text = (client.clientId).ToString(); textBoxName.Text = client.name; maskedTextBoxPhone.Text = client.phoneNumber; textBoxFax.Text = client.faxNumber; textBoxAddress.Text = client.address; textBoxCity.Text = client.city; textBoxPostalCode.Text = client.postalCode; textBoxBankNumber.Text = client.bankNumber.ToString(); textBoxBranch.Text = client.branchNumber.ToString(); textBoxAccountType.Text = client.bankAccount; } else { MessageBox.Show("Client not Found!"); textBoxSearch.Clear(); textBoxSearch.Focus(); } }
private void buttonSearch_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textboxSearch.Text)) { MessageBox.Show("Please enter Client ID", "Search not Possible"); } else { Client client = ClientDA.Search(Convert.ToInt32(textboxSearch.Text)); if (client != null) { textboxClientId.Text = client.ClientID.ToString(); texbBoxClientName.Text = client.Name; textboxStreet.Text = client.Street; textboxCity.Text = client.City; textboxPostalCode.Text = client.PostalCode; maskedtextboxPhoneNumber.Text = client.PhoneNumber; textboxFaxNumber.Text = client.FaxNumber; textboxCreditLimit.Text = client.CreditLimit.ToString(); textboxSearch.Clear(); } else { MessageBox.Show("Client Not Found", "Failed"); textboxSearch.Clear(); } } }
private void buttonSaveOrder_Click_1(object sender, EventArgs e) { List <Orders> listO = OrderDA.ListOrder(); if (IsValidOrderData()) { Inventory product = InventoryDA.Search(Convert.ToInt32(textBoxISBN.Text)); Client client = ClientDA.Search(Convert.ToInt32(comboBoxClientID.Text)); string isbn = textBoxISBN.Text; int quantityproduct = Convert.ToInt32(textBoxOQty.Text); int id = (Convert.ToInt32(comboBoxClientID.Text)); if (product == null) { MessageBox.Show("Wrong Information product, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (product.ProductQuantity < Convert.ToInt32(textBoxOQty.Text)) { MessageBox.Show("We do not have the quantity required on Inventory", "Missing Product"); textBoxOQty.Clear(); return; } else { if (client.ClientID == (Convert.ToInt32(comboBoxClientID.Text))) { textBoxClientName.Text = client.InstitutionName; } Int32 quantityselected = Convert.ToInt32(textBoxOQty.Text); Double priceselected = Convert.ToDouble(textBoxProductPrice.Text); Double finalamout = quantityselected * priceselected; textBoxFinalAmount.Text = finalamout.ToString(); Orders aOrder = new Orders(); aOrder.OrderNumber = Convert.ToInt32(textBoxOnumber.Text); aOrder.ISBNProduct = Convert.ToInt32(textBoxISBN.Text); aOrder.ProductTitle = textBoxOProductTitle.Text; aOrder.ProductDescription = textBoxProductDescription.Text; aOrder.ClientID = (Convert.ToInt32(comboBoxClientID.Text)); aOrder.ClientName = textBoxClientName.Text; aOrder.OrderDate = dateTimePickerOdate.Text; aOrder.ShippingDate = dateTimePickerSDate.Text; aOrder.OrderQuantity = Convert.ToInt32(textBoxOQty.Text); aOrder.ProductPrice = Convert.ToDouble(textBoxProductPrice.Text); aOrder.FinalAmount = Convert.ToDouble(textBoxFinalAmount.Text); OrderDA.Save(aOrder); listO.Add(aOrder); ClearAll(); } } }
private void buttonSearch_Click(object sender, EventArgs e) { { int choice = comboBoxSearchClient.SelectedIndex; switch (choice) { case -1: // The user didn't select any search option MessageBox.Show("Please select the search option"); break; case 0: //The user selected the search by Customer ID if (textBoxInfoClient.Text == "") { MessageBox.Show("You have to enter Client ID, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (Validation.IsInteger(textBoxInfoClient)) { Client client = ClientDA.Search(Convert.ToInt32(textBoxInfoClient.Text)); if (client != null) { textBoxClientID.Text = (client.ClientID).ToString(); textBoxInstitutionName.Text = client.InstitutionName; textBoxInstitutionAddress.Text = client.InstitutionAddress; textBoxInstitutionCity.Text = client.InstitutionCity; textBoxZipCode.Text = client.InstitutionZipCode; textBoxEmailClient.Text = client.InstitutionEmail; maskedTextBoxPhoneClient.Text = client.InstitutionPhoneNumber; textBoxInfoClient.Clear(); textBoxClientID.Enabled = false; } else { MessageBox.Show("Client ID not found, try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxInfoClient.Clear(); textBoxInfoClient.Focus(); } } } break; default: break; } } }