private void LabelupdatingTimer_Tick(object sender, EventArgs e) { label7.Text = "Redirecting in (" + i + ")"; i = i - 1; if (i < 0) { LabelupdatingTimer.Stop(); MessageBox.Show("Thank you for your booking, Have a nice day."); this.Hide(); Checkininfo Checkininfo = new Checkininfo(); Checkininfo.textBox1.Text = sixDigitNumber; Checkininfo.textBox2.Text = textBox5.Text; Checkininfo.textBox3.Text = RoomID.ToString(); Checkininfo.textBox4.Text = textBox7.Text; Checkininfo.textBox5.Text = textBox6.Text; Checkininfo.Show(); } }
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { string first_string = listBox1.SelectedItem.ToString(); string second_string = string.Empty; string third_string = listBox1.SelectedItem.ToString(); string four_string = string.Empty; DialogResult dialogResult = MessageBox.Show("Are you sure you want to book this room?", "Booking this Room", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { SqlConnection sqlcon = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=" + "C:\\Users\\" + Environment.UserName + "\\Documents\\hoteldatabase.mdf" + ";Integrated Security=True;Connect Timeout=30"); sqlcon.Open(); SqlCommand cmd = new SqlCommand("Select * from Rooms where Hotel = '" + comboBox1.Text.Trim() + "' and RoomNumber = '" + Roomnum + "'"); cmd.CommandType = System.Data.CommandType.Text; cmd.Connection = sqlcon; SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); ClientsInfo ClientsInfo = new ClientsInfo(); Checkininfo Checkininfo = new Checkininfo(); ClientsInfo.RoomID = Int32.Parse(reader[0].ToString()); sqlcon.Close(); ClientsInfo.textBox5.Text = monthCalendar2.SelectionStart.ToString("d/M/yyyy"); ClientsInfo.textBox6.Text = comboBox1.Text; ClientsInfo.textBox7.Text = monthCalendar1.SelectionStart.ToString("d/M/yyyy"); this.Hide(); ClientsInfo.Show(); } else if (dialogResult == DialogResult.No) { } }