예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            BookStoreDBEntities ent = new BookStoreDBEntities();
            var query = from c in ent.Customers
                        where c.Username.Equals(txtUsername.Text) &&
                        c.Password.Equals(txtPassword.Text)
                        select c;

            try
            {
                if (query.ToList().Count == 0)
                {
                    MessageBox.Show("Username or password is incorrect!");
                }
                else
                {
                    if (getAccountStatus() == "Verified")
                    {
                        MessageBox.Show("Login Successful");
                        this.Hide();
                        Customer_MainMenu custMain = new Customer_MainMenu(getuserID());
                        custMain.Show();
                    }
                    else
                    {
                        MessageBox.Show("Account has not been verified");
                    }
                }
            }
            catch
            {
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtCode.Text != code)
            {
                MessageBox.Show("Invalid Verification Code");
                txtCode.Text = "";
                this.Dispose();
                Login_Form login = new Login_Form();
                login.Show();
            }
            else
            {
                MessageBox.Show("Account has been verified");
                BookStoreDBEntities ent = new BookStoreDBEntities();
                var query = (from c in ent.Customers
                             where c.Email.Equals(txtEmail.Text)
                             select c
                             ).First();

                query.Status = "Verified";
                ent.SaveChanges();
                this.Dispose();
                Login_Form login = new Login_Form();
                login.Show();
            }
        }
예제 #3
0
 private void fillPublisherBox()
 {
     using (BookStoreDBEntities c = new BookStoreDBEntities())
     {
         boxPublisher.DataSource    = c.Publishers.ToList();
         boxPublisher.ValueMember   = "Publisher_ID";
         boxPublisher.DisplayMember = "Publisher_Name";
         boxPublisher.SelectedIndex = -1;
     }
 }
예제 #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            BookStoreDBEntities ent = new BookStoreDBEntities();
            var query = from c in ent.Customers
                        where c.Email.Equals(txtEmail.Text)
                        select c;

            if (query.ToList().Count() == 0)
            {
                MessageBox.Show("Email not found!");
            }
            else
            {
                emailSender(code);
                panel2.Hide();
                panel1.Show();

                txtCode.Text = "";
            }
        }
예제 #5
0
        private void btnSignInStaff_Click(object sender, EventArgs e)
        {
            BookStoreDBEntities ent = new BookStoreDBEntities();
            var query = from c in ent.Staffs
                        where c.Username.Equals(txtUsername.Text) &&
                        c.Password.Equals(txtPassword.Text)
                        select c;

            if (query.ToList().Count == 0)
            {
                MessageBox.Show("Username or password is incorrect!");
            }
            else
            {
                MessageBox.Show("Login Successful");
                this.Hide();
                Admin_MainMenu admMenu = new Admin_MainMenu(returnPosition(), txtUsername.Text);
                admMenu.Show();
            }
        }