예제 #1
0
        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();
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != String.Empty && textBox2.Text != String.Empty && textBox3.Text != String.Empty && textBox4.Text != String.Empty && textBox3.Text.Contains("@"))
            {
                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();



                NewRes NewRes = new NewRes();

                Random r       = new Random();
                int    randNum = r.Next(1000000);
                sixDigitNumber = randNum.ToString("D6");          //creating a random 6 digit number



                SqlCommand cmd = new SqlCommand("SELECT SCOPE_IDENTITY() INSERT INTO [dbo].[Clients] ([FirstName],[LastName],[Email],[PhoneNumber],[Canceled], [RoomId],[CheckIN],[CheckOUT],[ReservationId]) VALUES ('" + textBox1.Text.Trim() + "', '" + textBox2.Text.Trim() + "', '" + textBox3.Text.Trim() + "', '" + textBox4.Text.Trim() + "', '" + "0" + "', '" + RoomID.ToString() + "', '" + Checkin + "', '" + Checkout + "', '" + sixDigitNumber + "');");


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.Connection  = sqlcon;

                SqlDataReader reader = cmd.ExecuteReader();

                reader.Read();



                sqlcon.Close();


                label6.Visible = true;
                label7.Visible = true;



                LabelupdatingTimer.Start();
            }
            else
            {
                MessageBox.Show("Make sure that you have fill all of the blanks below");
            }
        }