Example #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            Form userForm = new userForm();

            userForm.Show();
            this.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string name  = "faisal";
            string pass  = "******";
            string email = userNameTxt.Text;
            string Pass  = PasswordTxt.Text;


            con.Open();
            SqlCommand comm  = new SqlCommand("SELECT count(*) FROM UserTable where Email='" + email + "' and Password='******'", con);
            Int32      count = (Int32)comm.ExecuteScalar();

            if (email == name && Pass == pass)
            {
                //MessageBox.Show("valid user!");
                Form adminForm = new adminForm();
                adminForm.Show();
                // this.Hide();
            }
            else if (count > 0)
            {
                //MessageBox.Show("valid user!");
                Form userForm = new userForm();
                userForm.Show();
                // this.Hide();
                //this.Close();
            }
            else
            {
                MessageBox.Show("Invalid User!");
            }
            con.Close();
        }
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Are you sure you want to Order?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (res == DialogResult.OK)
            {
                string Title, Email, Address;
                int    mobileNumber, Quantity, Id;
                Title        = txtTitle.Text;
                Email        = txtTitle.Text;
                Address      = txtAddress.Text;
                Id           = Int32.Parse(txtId.Text);
                mobileNumber = Int32.Parse(txtMobileNumber.Text);
                Quantity     = Int32.Parse(txtQuantity.Text);
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = cmd.CommandText = "Insert into OrderTable(Id,Title,Email,MobileNumber,UserAddress,Quantity) values('" + Id + "','" + Title + "','" + Email + "','" + mobileNumber + "','" + Address + "','" + Quantity + "')";
                cmd.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Your Order Has Been Confirmed!");
            }
            if (res == DialogResult.Cancel)
            {
                Form userForm = new userForm();
                userForm.Show();
            }
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int Quantity = Int32.Parse(txtQuntity.Text);

            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "Insert into RequestTable values('" + txtTitle.Text + "','" + txtAuthor.Text + "','" + Quantity + "')";
            cmd.ExecuteNonQuery();
            con.Close();
            MessageBox.Show("Request Confirmed!");
            Form userForm = new userForm();

            userForm.Show();
            this.Close();
        }