private void SearchButton2_Click(object sender, EventArgs e) { if (CustomerID_TextBox.Text.ToString() == "") { string message1 = "Please fill ID"; string title1 = "Error"; MessageBox.Show(message1, title1); return; } int id = int.Parse(CustomerID_TextBox.Text.ToString()); DateTime dt = dateTimePicker.Value.Date; foreach (Lending l in Program.Lendings) { if (id == l.getCustomer().getCustomerID() && dt == l.getStartDate().Date) { Lend_Form lf = new Lend_Form(l, role); lf.Show(); this.Hide(); return; } } string message2 = "Lending not found"; string title2 = "Error"; MessageBox.Show(message2, title2); }
private void SearchButton1_Click(object sender, EventArgs e) { if (LendingID_TextBox.Text.ToString() == "") { string message1 = "Please fill ID"; string title1 = "Error"; MessageBox.Show(message1, title1); return; } int ID = int.Parse(LendingID_TextBox.Text.ToString()); foreach (Lending l in Program.Lendings) { if (ID == l.getLendingID()) { Lend_Form lf = new Lend_Form(l, role); lf.Show(); this.Hide(); return; } } string message2 = "Lending not found"; string title2 = "Error"; MessageBox.Show(message2, title2); }