Esempio n. 1
0
        public void LogInUser(string us, string pas)
        {
            l.CheckUserProfile(us, pas);
            if (l.log_in_case == true)
            {
                Home_Window frm_main = new Home_Window();
                frm_main.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Account not Detected, Please try again.", "Error", MessageBoxButtons.OK
                                , MessageBoxIcon.Error);
                Application.Exit();
            }

            /*
             * else
             * MessageBox.Show("User account not detected" + "rowcount= " + l.rowcount, "Invalid Account", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
             * /* l.db_cn.Close();
             * lgin_username_textbox.Text = "";
             * lgin_password_textbox.Text = "";
             * lgin_username_textbox.Focus();
             *
             * Application.Exit();
             */
        }
Esempio n. 2
0
        private void Log_In(string username_txt, string password_txt)
        {
            lgin_cn.Open();
            CheckProfile.Connection  = lgin_cn;
            CheckProfile.CommandText = "select * from ProfileDBSt where FirstN= '" + username_txt + "' AND LRN= '" + password_txt + "'";
            reader = CheckProfile.ExecuteReader();
            int lgin = 0;

            while (reader.Read())
            {
                lgin = lgin + 1;
            }
            if (lgin == 1)
            {
                //MainBrowser_Navig_form frm1 = new MainBrowser_Navig_form(); PLEASE INSERT NEW FORM
                Home_Window frm_main = new Home_Window();
                frm_main.Show();


                lgin_cn.Close();



                //frm1.Show();
                this.Hide();
            }


            if (lgin > 1)
            {
                lgin_cn.Open();

                reader = CheckProfile.ExecuteReader();

                MessageBox.Show("Duplicate Account, Invalid.");
                lgin_cn.Close();
                reader = CheckProfile.ExecuteReader();
            }

            if (lgin < 1)
            {
                lgin_cn.Close();

                lgin_cn.Open();


                MessageBox.Show("User not Detected", "Error!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);
                lgin_cn.Close();

                lgin_cn.Close();
            }
        }