private void btnsecreatry_Click(object sender, EventArgs e)
        {
            Secretary s = new Secretary();

            s.Location    = this.Location;
            s.ifpresident = 1;
            s.ShowDialog();
        }
Example #2
0
        public void AllUser()
        {
            string qq = "SELECT count(*) FROM dbms_mass.user;";

            cmd = new MySqlCommand(qq, db.OpenConnection());
            MySqlDataReader r = cmd.ExecuteReader();

            if (r.HasRows)
            {
                while (r.Read())
                {
                    if (Convert.ToInt32(r[0].ToString()) == 0)
                    {
                        cmd             = new MySqlCommand("CreateUser", db.OpenConnection());
                        cmd.CommandType = CommandType.StoredProcedure;
                        try
                        {
                            cmd.Parameters.Add(new MySqlParameter("?user_name", "admin"));
                            cmd.Parameters.Add(new MySqlParameter("?user_password", "admin"));
                            cmd.Parameters.Add(new MySqlParameter("?user_position", "Admin"));
                            cmd.ExecuteNonQuery();
                            db.CloseConnection();
                        }
                        catch { }
                    }
                }
            }


            string q = "SELECT * FROM dbms_mass.user WHERE user_name ='" + txtname.Text.Replace("'", "''") + "'AND user_password ='******'", "''") + "';";

            cmd = new MySqlCommand(q, db.OpenConnection());

            MySqlDataReader rd = cmd.ExecuteReader();

            if (rd.HasRows)
            {
                while (rd.Read())
                {
                    Settings.id = rd[0].ToString();
                    position    = rd[3].ToString();
                    if (position == "Coordinator" || position == "Co-Coordinator" || position == "Admin")
                    {
                        President_form pf = new President_form();
                        pf.Show();
                    }
                    else if (position == "Secretary")
                    {
                        Secretary ss = new Secretary();
                        ss.Show();
                    }
                    else if (position == "Treasurer")
                    {
                        Printing_Masterlist pm = new Printing_Masterlist();
                        pm.tabcontrolprint.SelectedTab = pm.tbtreasurer;
                        pm.ifpresident     = 0;
                        pm.pnlhiding.Size  = pm.tabcontrolprint.Size;
                        pm.pnlhiding1.Size = pm.tabcontrolprint.Size;
                        pm.Show();
                    }
                    else if (position == "Commitee")
                    {
                        Committee cm = new Committee();
                        cm.ifpresident = 0;
                        cm.Show();
                        //comittee form
                    }
                    txtname.Text = "";
                    txtpass.Text = "";
                    this.Visible = false;
                }
            }
            else
            {
                lblnotification.Visible = true;
            }
            rd.Close();
            db.CloseConnection();
        }