Пример #1
0
        private void btn_help_ok_Click(object sender, EventArgs e)
        {
            string type = login.loggedIN_utype;

            if (type == "Admin")
            {
                admin_dashboard admin = new admin_dashboard();
                admin.Show();
                this.Hide();
            }
            else if (type == "Üser")
            {
                Dashboard home = new Dashboard();
                home.Show();
                this.Close();
            }
            else
            {
                programmer.ProgrammerPanel pp = new programmer.ProgrammerPanel();
                pp.Show();
                this.Close();
            }
        }
Пример #2
0
        private void btn_changeDetails_Click(object sender, EventArgs e)
        {
            string userpassword = txt_pwd.Text.ToString();
            string userconpwd   = txt_cnfm.Text.Trim();


            //connecting to the database
            MySqlConnection conn = new MySqlConnection("server = localhost; user id = root; database = bugtracker");

            try
            {
                //checking whether text box is empty or not
                if (userpassword == "" || userconpwd == "")
                {
                    MessageBox.Show("U must enter password in the forms", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    //checking whether password matches or not
                    if (userpassword == userconpwd)
                    {
                        MySqlCommand sda = new MySqlCommand("update registration set password='******',confirm_Password='******' where id='" + this.user_id.Text + "'", conn);
                        //Open Connection
                        conn.Open();
                        int rows = sda.ExecuteNonQuery();

                        //if Inserted rows is greater is greater than 0
                        //Else set isSuccess to false, Save Failed


                        if (rows > 0)
                        {
                            MessageBox.Show("Password changed. Please click ok to continue");
                            //going to dashboard page
                            string type = login.loggedIN_utype;

                            if (type == "User")
                            {
                                Dashboard dash = new Dashboard();
                                dash.Show();
                                this.Close();
                            }
                            else
                            {
                                programmer.ProgrammerPanel pdash = new programmer.ProgrammerPanel();
                                pdash.Show();
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Password failed to changed. click ok to continue");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Password didnot matched !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            finally
            {
                //CLose Connection
                conn.Close();
            }
        }
Пример #3
0
        //login process
        private void btnlogin_Click(object sender, EventArgs e)
        {
            string user = txtUser.Text;     //username
            string pass = txtPassword.Text; //password
            // pass = EncryptDecrypt.Encrypt(pass);

            string uType = cmbUsertype.Text.Trim();

            //connecting to the database
            MySqlConnection conn = new MySqlConnection("server = localhost; user id = root; database = bugtracker");

            MySqlDataAdapter sda = new MySqlDataAdapter("Select count(*) from registration where username='******'and password='******' and usertype='" + cmbUsertype.Text + "'", conn);
            DataTable        dt  = new DataTable();

            sda.Fill(dt);//

            if (user == "" || pass == "" || uType == "")
            {
                MessageBox.Show("U must Fill all the forms", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (dt.Rows[0][0].ToString() == "1")
                {
                    loggedIn       = user;
                    loggedIN_utype = uType;
                    switch (uType)
                    {
                    case "Admin":
                    {
                        if (user == "admin")
                        {
                            //Display Admin Dashboard
                            this.Hide();
                            loggedIN_utype = uType;
                            admin_dashboard admin = new admin_dashboard();
                            MessageBox.Show("Login succesful. Welcome back " + txtUser.Text + " !!");
                            admin.Show();
                        }
                        else
                        {
                            MessageBox.Show("Admin Login was failed. Please enter correct username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        break;
                    }

                    //tester
                    case "User":
                    {
                        //Display User Dashboard
                        this.Hide();
                        user.Dashboard umenu = new user.Dashboard();
                        MessageBox.Show("Login was succesful. Welcome back " + txtUser.Text + " !!");
                        umenu.Show();
                        break;
                    }

                    //programmer
                    case "Debugger":
                    {
                        //Display User Dashboard
                        this.Hide();
                        programmer.ProgrammerPanel umenu = new programmer.ProgrammerPanel();
                        MessageBox.Show("Login was succesful. Welcome back " + txtUser.Text + " !!");
                        umenu.Show();
                        break;
                    }
                    }
                }
                else
                {
                    MessageBox.Show("incorrect username or password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }