private void btnBack_Click(object sender, EventArgs e)
        {
            Form adminForm = new adminForm();

            adminForm.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();
        }
Пример #3
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Are you sure you want to Delete", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (res == DialogResult.OK)
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "Delete from BookTable where Title='" + txtTitle.Text + "'";
                cmd.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Book Removed!");
                this.Close();
            }
            if (res == DialogResult.Cancel)
            {
                Form adminForm = new adminForm();
                adminForm.Show();
            }
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string Title, Author;
            int    AvailableCopy;
            double Price;

            Title         = txtTitle.Text;
            Author        = txtAuthor.Text;
            Price         = Convert.ToDouble(txtPrice.Text);
            AvailableCopy = Int32.Parse(txtAvailableCopy.Text);
            con.Open();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "Insert into BookTable values('" + Title + "','" + Author + "','" + Price + "','" + AvailableCopy + "')";
            cmd.ExecuteNonQuery();
            con.Close();
            MessageBox.Show("Book Added!");
            Form adminForm = new adminForm();

            adminForm.Show();
            this.Close();
        }
Пример #5
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            string UserName = txtUserName.Text;
            string Email    = txtEmail.Text;

            try
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "delete from UserTable where Name='" + UserName + "' and Email='" + Email + "'";
                cmd.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("User Deleted!");
                Form adminForm = new adminForm();
                adminForm.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format("Invalid User"), ex);
            }
        }
Пример #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form adminForm = new adminForm();

            adminForm.Show();
        }