コード例 #1
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         UserRepo c = new UserRepo();
         if (txtId.Text == "a" && txtPass.Text == "a")
         {
             AdminHome a = new AdminHome();
             a.Show();
             this.Hide();
         }
         else
         {
             int x = c.checkLogin(int.Parse(txtId.Text), txtPass.Text);
             if (x != 0)
             {
                 Search s = new Search(x);
                 s.Show();
                 this.Hide();
             }
             if (x == 0)
             {
                 MessageBox.Show("INVALID ID OR PASSWORD");
             }
             else
             {
             }
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show("INVALID ID OR PASSWORD");
     }
 }
コード例 #2
0
        private void HandlerBtnLogin(object sender, EventArgs e)
        {
            String user     = this.inputNombre.Text;
            String password = this.InputPassword.Text;

            if (user == "user")
            {
                UserHome userView = new UserHome(user);
                userView.Show();
                this.Hide();
            }
            else if (user == "admin")
            {
                AdminHome adminView = new AdminHome(user);
                adminView.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Usuarios validos: user, admin", "Ingreso al sistema");
            }
            //MessageBox.Show($"{user} - {password}", "Ingreso al sistema");

            Console.WriteLine("User: "******"Password: " + password);
            Application.Exit();
        }
コード例 #3
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            LoginService loginService = new LoginService();
            int          result       = loginService.LoginValidation(UserNameTextBox.Text, PasswordTextBox.Text);

            if (result == 1)
            {
                LoginDataAcces loginDataAccess = new LoginDataAcces();
                AdminHome      adminHome       = new AdminHome();
                this.Hide();
                adminHome.Show();
            }
            else if (result == 2)
            {
                LoginDataAcces   loginDataAccess  = new LoginDataAcces();
                ViewOrganisation viewOrganisation = new ViewOrganisation();
                this.Hide();
                viewOrganisation.Show();
                Food    food    = new Food(UserNameTextBox.Text);
                Payment payment = new Payment(UserNameTextBox.Text);
            }
            else if (result == 3)
            {
                LoginDataAcces   loginDataAccess  = new LoginDataAcces();
                OrganisationHome organisationHome = new OrganisationHome(UserNameTextBox.Text);
                this.Hide();
                organisationHome.Show();
            }
            else
            {
                MessageBox.Show("Invalid Username or Password");
            }
        }
コード例 #4
0
        private void AdminTile_Click(object sender, EventArgs e)
        {
            AdminHome frmAdmin = new AdminHome();

            frmAdmin.MdiParent   = _pForm;
            frmAdmin.WindowState = FormWindowState.Maximized;
            frmAdmin.Show();
            this.Hide();
            _pForm.Controls["panel2"].Visible = true;
        }
コード例 #5
0
ファイル: Home.cs プロジェクト: naveendhasarathan/eBatch
        private void usersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AdminHome frmAdmin = new AdminHome();
            frmAdmin.MdiParent = this;
            frmAdmin.WindowState = FormWindowState.Maximized;
            frmAdmin.Show();

            //User u.Show();ser = new User();
            //user.MdiParent = this;
            //user.WindowState = FormWindowState.Maximized;
            //user.Show();
        }
コード例 #6
0
        private void mnuApplication_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ToolStripItem clickedItem = e.ClickedItem;
            string        itemName    = clickedItem.Text;

            switch (itemName)
            {
            case "ADMIN":
                break;

            case "Users":
                AdminHome Home = new AdminHome();
                Home.MdiParent   = this;
                Home.WindowState = FormWindowState.Maximized;
                Home.Show();
                break;

            //case "Suppliers":
            //    FrmSupplier frmSupplier = new FrmSupplier();
            //    frmSupplier.MdiParent = this;
            //    frmSupplier.WindowState = FormWindowState.Maximized;
            //    frmSupplier.Show();
            //    break;
            //case "Data Entry":
            //    FrmDataEntry frmDataEntry = new FrmDataEntry();
            //    frmDataEntry.MdiParent = this;
            //    frmDataEntry.WindowState = FormWindowState.Maximized;
            //    frmDataEntry.Show();
            //    break;
            //case "Invoice Details":
            //    FrmDataEntry frmDataEntry = new FrmDataEntry();
            //    frmDataEntry.MdiParent = this;
            //    frmDataEntry.WindowState = FormWindowState.Maximized;
            //    frmDataEntry.Show();
            //    break;
            //case "File List":
            //    FrmFilelist FrmFilelist = new FrmFilelist();
            //    FrmFilelist.MdiParent = this;
            //    FrmFilelist.WindowState = FormWindowState.Maximized;
            //    FrmFilelist.Show();
            //    break;
            case "Exit":
                Application.Exit();
                break;

            default:
                break;
            }
        }
コード例 #7
0
 private void btnloginmain_Click(object sender, EventArgs e)
 {
     try
     {
         var user = new Users
         {
             UserName = hmetxtloguname.Text.ToString(),
             Password = hmetxtlogpass.Text.ToString()
         };
         DataTable dt = new DataTable();
         dt = _instanceRepository.LoginUser(user);
         if (dt.Rows.Count > 0)
         {
             UserInfo.UserName = dt.Rows[0]["user_name"].ToString();
             UserInfo.UserId   = Convert.ToInt32(dt.Rows[0]["user_id"].ToString());
             UserInfo.UserRole = Convert.ToInt32(dt.Rows[0]["user_role"].ToString());
             if (Convert.ToInt32(dt.Rows[0]["user_role"].ToString()) == 1)
             {
                 AdminHome ah = new AdminHome();
                 this.Hide();
                 ah.Show();
             }
             else
             {
                 Sales sl = new Sales();
                 sl.WindowState = FormWindowState.Maximized;
                 sl.Show();
                 this.Hide();
             }
         }
         else
         {
             messageShow.singlemsgtext("Invalid username or password");
         }
     }
     catch (Exception _exception)
     {
         CmC.InsertException(_exception);
         messageShow.singlemsgtext(CmC.ExceptionErrorMessage);
     }
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: vizhanix/mybugtrack
        /// <summary>
        /// This is the method when the login button is clicked the data that user has entered
        /// will be stored in a variable and is passed in an sql query to fetch the data from the database
        /// whether the two, provided and the retrived values match or not. if match login will take user to the
        /// homepage as per the user role or there will be an error message thrown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>


        //method for the button click
        private void btn_login_Click(object sender, EventArgs e)
        {
            string email        = txtbox_email.Text;
            string password     = txtbox_pass.Text;
            string comboboxtext = comboBox1.Text;

            /*
             * connection string to connect to the database
             * whenever required to fetch values from the database
             */

            string          connectString = "Data Source=localhost;Database = bugtrackapp ;User Id= root;Password=;SslMode=none";
            MySqlConnection myconn        = new MySqlConnection(connectString);
            MySqlCommand    command       = myconn.CreateCommand();

            command.CommandText = "select id,name,role,password from tbl_users where email ='" + email + "' and password = '******'";
            try
            {
                myconn.Open(); //opening of the connection
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message); //error message when there is some error
            }

            //MySqldataReader class in order to read the values
            //from the fetched query above

            MySqlDataReader reader = command.ExecuteReader();

            string roletype = "";
            string name     = "";

            // string pass = "";

            while (reader.Read())
            {
                name     = reader["name"].ToString();
                roletype = reader["role"].ToString();
                //  pass = reader.GetString("password");
            }


            //validatioin if condition if the name field is empty
            if (name == "")
            {
                MessageBox.Show("Please chech your login credentials");
            }

            /*if contition to check whether the user role selected, and the stored data in the
             * database matches or not */
            if (comboboxtext == "admin" && roletype == "admin")
            {
                MessageBox.Show("Logged in as : " + comboboxtext);
                AdminHome f = new AdminHome(name);
                this.Hide();
                f.Show();
            }

            /*if contition to check whether the user role selected, and the stored data in the
             * database matches or not */
            else if (comboboxtext == "tester" && roletype == "tester")
            {
                MessageBox.Show("Logged in as : " + comboboxtext);
                TesterHome f = new TesterHome(name);
                this.Hide();
                f.Show();
            }

            /*if contition to check whether the user role selected, and the stored data in the
             * database matches or not */
            else if (comboboxtext == "developer" && roletype == "developer")
            {
                MessageBox.Show("Logged in as : " + comboboxtext);
                ProgHomePage f = new ProgHomePage(name);
                this.Hide();
                f.Show();
            }
            else
            {
                MessageBox.Show("No Records Found!!");
            }
        }