/// <summary> /// pulls the current prices of the room (maybe fix it) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button7_Click(object sender, EventArgs e) { prices = new List <int>(); comboBox4.Items.Clear(); star = comboBox1.Text; city = comboBox2.Text; name = comboBox3.Text; type = comboBox5.Text; int min = Convert.ToInt32(textBox8.Text); int max = Convert.ToInt32(textBox6.Text); int price = 0; foreach (Hotel hotel in app.hotels) { if (hotel.City.Equals(city) && hotel.Star.ToString().Equals(star) && hotel.Name.ToString().Equals(name)) { foreach (Room room in hotel.Rooms) { if (!comboBox4.Items.Contains(room.no) && room.GetType().Name.Equals(type)) { if (room.getPay(dateTimePicker1.Value.Date, dateTimePicker2.Value.Date, ref price, app.StartAppTime)) { if (price >= min && price <= max) { comboBox4.Items.Add(room.no); prices.Add(price); } } price = 0; } } break; } } if (comboBox4.Items.Count != 0) { comboBox4.Text = comboBox4.Items[0].ToString(); //Process for use button6.Visible = true; comboBox4.Visible = true; label23.Visible = true; label26.Visible = true; label27.Visible = true; label30.Visible = true; label31.Visible = true; } else { AutoClosingMessageBox.Show("No room available", "Notification", 1000); //Process for reuse comboBox4.Visible = false; label23.Visible = false; button6.Visible = false; label26.Visible = false; label27.Visible = false; label30.Visible = false; label31.Visible = false; label31.Text = ""; } }
/// <summary> /// login and open the required panel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { string password; if (richPassword1.Visible) { password = richPassword1.Text; } else { password = richTextBox2.Text; } if (button1.Text.Equals("SIGN UP")) { User temp; try { temp = new User(); temp.ID = richTextBox1.Text; temp.Password = password; temp.Name = richTextBox3.Text; temp.Surname = richTextBox4.Text; temp.Age = richTextBox5.Text; } catch (ProjeException E) { E.notification = "LoginScreen ->> button1_Click(sıgn up event) Invalid user information"; Logger.writeExceptionLog(E.ToString()); AutoClosingMessageBox.Show("Invalid Argument!!!\nPlease Try Again", "Notification", 2000); richTextBox1.Text = ""; richPassword1.Text = ""; richTextBox3.Text = ""; richTextBox4.Text = ""; richTextBox5.Text = ""; temp = null; } if (temp != null) { if (!app.addUser(temp)) { AutoClosingMessageBox.Show("This username has already been taken", "Notification", 2300); richTextBox1.Text = ""; richPassword1.Text = ""; richTextBox3.Text = ""; richTextBox4.Text = ""; richTextBox5.Text = ""; } else { AutoClosingMessageBox.Show("You have successfully registered", "Notification", 1000); app.activeUserLocation = app.users.Count - 1; this.Hide(); new UserGUI().Show(); } } } else { //user login if (app.login(richTextBox1.Text, password)) { AutoClosingMessageBox.Show("The login process is successful", "Notification", 1500); this.Hide(); new UserGUI().Show(); } else if (app.admin.ID.Equals(richTextBox1.Text) && app.admin.Password.Equals(password)) //admin login { AutoClosingMessageBox.Show("The login process is successful", "Notification", 1500); this.Hide(); new AdminGUI().Show(); } else { AutoClosingMessageBox.Show("The login process fail", "Notification", 2000); } } }