private void bt_search_Click(object sender, EventArgs e) { if (txtBx_surname.Text.Length == 0 || txtBx_name.Text.Length == 0) { lb_warning.ForeColor = Color.Red; lb_warning.Text = "ВСЕ ПОЛЯ ДОЛЖНЫ БЫТЬ ЗАПОЛНЕНЫ!"; lb_warning.Visible = true; TimerCallback tmclb = new TimerCallback(BackVisible); System.Threading.Timer tmp = new System.Threading.Timer(tmclb, null, 1000, 0); return; } int idx = notes.SearchBySurnameAndName(txtBx_surname.Text, txtBx_name.Text); if (idx < 0) { lb_warning.ForeColor = Color.Red; lb_warning.Text = "ЗАПИСЬ НЕ НАЙДЕНА :("; lb_warning.Visible = true; TimerCallback tmclb = new TimerCallback(BackVisible); System.Threading.Timer tmp = new System.Threading.Timer(tmclb, null, 1000, 0); return; } DialogAdd dlg = new DialogAdd(notes, false, idx); notes.removeNote(idx); dlg.ShowDialog(); notes = dlg.GetNotes(); Close(); }
private void bt_ok_Click(object sender, EventArgs e) { if (txtBx_surname.Text.Equals("") || txtBx_name.Text.Equals("") || txtBx_phone.Text.Equals("")) { Text = "Заполните все поля с * !!!"; BackColor = Color.Red; TimerCallback clb = new TimerCallback(backText); System.Threading.Timer tmp = new System.Threading.Timer(clb, null, 500, 0); return; } //nwprsn = new NewPerson(txtBx_surname.Text, txtBx_name.Text, txtBx_phone.Text, txtBx_birthday.Text); if (notes.SearchBySurnameAndName(txtBx_surname.Text, txtBx_name.Text) < 0) { notes.Add(txtBx_surname.Text, txtBx_name.Text, txtBx_phone.Text, txtBx_birthday.Text); Close(); } else { lb_warning.Text = "ТАКАЯ ЗАПИСЬ УЖЕ ЕСТЬ!!!"; TimerCallback clb = new TimerCallback(backLabel); System.Threading.Timer tmp = new System.Threading.Timer(clb, null, 500, 0); } }