Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            NewRes newres = new NewRes();

            this.Hide();
            newres.Show();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            NewRes NewRes1 = new NewRes();

            this.Hide();
            NewRes1.Show();
        }
Beispiel #3
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");
            }
        }