Exemple #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();
            }
        }
        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();
            }
        }