private void inregistrare_apartamente_next_Click(object sender, EventArgs e) { try { int canGoNext = 1, myInt = 0, myInt2 = 0, myInt3 = 0, myInt1 = 0; if (panel_date_apartament.Visible == false) { nr_ap_detinute = (int)numarApartamenteSelect.Value; panel_date_apartament.Show(); label_numar_apartamente.Hide(); numarApartamenteSelect.Hide(); label_eroare_numar_camere.Hide(); label_eroare_suprafata.Hide(); label_eroare_suprafata_utila.Hide(); label_eroare_numar_apartament.Hide(); label_numar_apartament_curent.Text = nr_ap_cur.ToString(); } else if (nr_ap_cur != nr_ap_detinute) { if (textBox_numar_apartament.Text.Length == 0 || int.TryParse(textBox_numar_apartament.Text, out myInt1) != true) { label_eroare_numar_apartament.Show(); canGoNext = 0; } else { label_eroare_numar_apartament.Hide(); } if (text_box_suprafata.Text.Length == 0 || int.TryParse(text_box_suprafata.Text, out myInt) != true) { label_eroare_suprafata.Show(); canGoNext = 0; } else { label_eroare_suprafata.Hide(); } if (text_box_suprafata_utila.Text.Length == 0 || int.TryParse(text_box_suprafata_utila.Text, out myInt2) != true || myInt2 > myInt) { label_eroare_suprafata_utila.Show(); canGoNext = 0; } else { label_eroare_suprafata_utila.Hide(); } if (text_box_numar_camere.Text.Length == 0 || int.TryParse(text_box_numar_camere.Text, out myInt3) != true) { label_eroare_numar_camere.Show(); canGoNext = 0; } else { label_eroare_numar_camere.Hide(); } if (canGoNext != 0) { ap_detinute[nr_ap_cur - 1] = new Apartamente(); ap_detinute[nr_ap_cur - 1].Suprafata_mP_ = myInt; ap_detinute[nr_ap_cur - 1].Suprafata_utila_mP_ = myInt2; ap_detinute[nr_ap_cur - 1].Numar_Camere = myInt3; ap_detinute[nr_ap_cur - 1].Numar = myInt1; nr_ap_cur++; label_numar_apartament_curent.Text = nr_ap_cur.ToString(); text_box_suprafata.Text = ""; text_box_suprafata_utila.Text = ""; text_box_numar_camere.Text = ""; textBox_numar_apartament.Text = ""; } } else if (nr_ap_cur == nr_ap_detinute) { label_numar_apartament_curent.Text = nr_ap_cur.ToString(); if (textBox_numar_apartament.Text.Length == 0 || int.TryParse(textBox_numar_apartament.Text, out myInt1) != true) { label_eroare_numar_apartament.Show(); canGoNext = 0; } else { label_eroare_numar_apartament.Hide(); } if (text_box_suprafata.Text.Length == 0 || int.TryParse(text_box_suprafata.Text, out myInt) != true) { label_eroare_suprafata.Show(); canGoNext = 0; } else { label_eroare_suprafata.Hide(); } if (text_box_suprafata_utila.Text.Length == 0 || int.TryParse(text_box_suprafata_utila.Text, out myInt2) != true || myInt2 > myInt) { label_eroare_suprafata_utila.Show(); canGoNext = 0; } else { label_eroare_suprafata_utila.Hide(); } if (text_box_numar_camere.Text.Length == 0 || int.TryParse(text_box_numar_camere.Text, out myInt3) != true) { label_eroare_numar_camere.Show(); canGoNext = 0; } else { label_eroare_numar_camere.Hide(); } if (canGoNext != 0) { ap_detinute[nr_ap_cur - 1] = new Apartamente(); ap_detinute[nr_ap_cur - 1].Suprafata_mP_ = myInt; ap_detinute[nr_ap_cur - 1].Suprafata_utila_mP_ = myInt2; ap_detinute[nr_ap_cur - 1].Numar_Camere = myInt3; ap_detinute[nr_ap_cur - 1].Numar = myInt1; panel_inregistrare_apartamente.Hide(); label_ap_cur_inreg_locatari.Text = ap_detinute.ToList()[0].Numar.ToString(); label_eroare_nume_locatar.Hide(); label_eroare_prenume_locatar.Hide(); label_eroare_CNP.Hide(); label_eroare_data_mutare.Hide(); panel_inregistrare_locatari.Show(); nr_ap_cur = 1; } } } catch (Exception ex) { File.AppendAllText("errors.txt", "Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace + "" + Environment.NewLine + "Date :" + DateTime.Now.ToString()); string New = Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine; File.AppendAllText("errors.txt", New); MessageBox.Show("Contacteaza dezvoltatorul!"); } }
private void inregistrare_apartamente_next_Click(object sender, EventArgs e) { int canGoNext = 1, myInt = 0, myInt2 = 0, myInt3 = 0, myInt1 = 0; if (panel_date_apartament.Visible == false) { nr_ap_detinute = (int)numarApartamenteSelect.Value; panel_date_apartament.Show(); label_numar_apartamente.Hide(); numarApartamenteSelect.Hide(); label_eroare_numar_camere.Hide(); label_eroare_suprafata.Hide(); label_eroare_suprafata_utila.Hide(); label_eroare_numar_apartament.Hide(); label_numar_apartament_curent.Text = nr_ap_cur.ToString(); } else if (nr_ap_cur != nr_ap_detinute) { if (textBox_numar_apartament.Text.Length == 0 || int.TryParse(textBox_numar_apartament.Text, out myInt1) != true) { label_eroare_numar_apartament.Show(); canGoNext = 0; } else { label_eroare_numar_apartament.Hide(); } if (text_box_suprafata.Text.Length == 0 || int.TryParse(text_box_suprafata.Text, out myInt) != true) { label_eroare_suprafata.Show(); canGoNext = 0; } else { label_eroare_suprafata.Hide(); } if (text_box_suprafata_utila.Text.Length == 0 || int.TryParse(text_box_suprafata_utila.Text, out myInt2) != true || myInt2 > myInt) { label_eroare_suprafata_utila.Show(); canGoNext = 0; } else { label_eroare_suprafata_utila.Hide(); } if (text_box_numar_camere.Text.Length == 0 || int.TryParse(text_box_numar_camere.Text, out myInt3) != true) { label_eroare_numar_camere.Show(); canGoNext = 0; } else { label_eroare_numar_camere.Hide(); } if (canGoNext != 0) { ap_detinute[nr_ap_cur - 1] = new Apartamente(); ap_detinute[nr_ap_cur - 1].Suprafata_mP_ = myInt; ap_detinute[nr_ap_cur - 1].Suprafata_utila_mP_ = myInt2; ap_detinute[nr_ap_cur - 1].Numar_Camere = myInt3; ap_detinute[nr_ap_cur - 1].Numar = myInt1; nr_ap_cur++; label_numar_apartament_curent.Text = nr_ap_cur.ToString(); text_box_suprafata.Text = ""; text_box_suprafata_utila.Text = ""; text_box_numar_camere.Text = ""; textBox_numar_apartament.Text = ""; } } else if (nr_ap_cur == nr_ap_detinute) { label_numar_apartament_curent.Text = nr_ap_cur.ToString(); if (textBox_numar_apartament.Text.Length == 0 || int.TryParse(textBox_numar_apartament.Text, out myInt1) != true) { label_eroare_numar_apartament.Show(); canGoNext = 0; } else { label_eroare_numar_apartament.Hide(); } if (text_box_suprafata.Text.Length == 0 || int.TryParse(text_box_suprafata.Text, out myInt) != true) { label_eroare_suprafata.Show(); canGoNext = 0; } else { label_eroare_suprafata.Hide(); } if (text_box_suprafata_utila.Text.Length == 0 || int.TryParse(text_box_suprafata_utila.Text, out myInt2) != true || myInt2 > myInt) { label_eroare_suprafata_utila.Show(); canGoNext = 0; } else { label_eroare_suprafata_utila.Hide(); } if (text_box_numar_camere.Text.Length == 0 || int.TryParse(text_box_numar_camere.Text, out myInt3) != true) { label_eroare_numar_camere.Show(); canGoNext = 0; } else { label_eroare_numar_camere.Hide(); } if (canGoNext != 0) { ap_detinute[nr_ap_cur - 1] = new Apartamente(); ap_detinute[nr_ap_cur - 1].Suprafata_mP_ = myInt; ap_detinute[nr_ap_cur - 1].Suprafata_utila_mP_ = myInt2; ap_detinute[nr_ap_cur - 1].Numar_Camere = myInt3; ap_detinute[nr_ap_cur - 1].Numar = myInt1; panel_inregistrare_apartamente.Hide(); label_ap_cur_inreg_locatari.Text = ap_detinute.ToList()[0].Numar.ToString(); label_eroare_nume_locatar.Hide(); label_eroare_prenume_locatar.Hide(); label_eroare_CNP.Hide(); label_eroare_data_mutare.Hide(); panel_inregistrare_locatari.Show(); nr_ap_cur = 1; } } }