Ejemplo n.º 1
0
        private void login()
        {
            int             count  = 0;
            String          sql    = "select * from ADMIN where USERNAME_ADMIN='" + Username.Text + "' and PASSWORD_ADMIN='" + Password.Text + "';";
            MySqlCommand    cmd    = new MySqlCommand(sql, conn);
            MySqlDataReader reader = cmd.ExecuteReader();

            this.admin = Username.Text;
            while (reader.Read())
            {
                count          += 1;
                this.idAdmin    = reader["ID_ADMIN"].ToString();
                this.idAdminInt = Convert.ToInt32(this.idAdmin);
            }
            //reader.Close();
            if (count == 1)
            {
                //menuju
                ((Form)this.TopLevelControl).Hide();
                adminChildDataView sg = new adminChildDataView();
                adminParent        f2 = new adminParent(sg, this.idAdmin);
                f2.Show();
            }
            else if (Username.Text == "Username" || Password.Text == "Password" || Username.Text == "")
            {
                MessageBox.Show("Fill Username and Password");
            }
            else
            {
                MessageBox.Show("Incorrect Username or Password");
            }
            reader.Close();
        }
Ejemplo n.º 2
0
        public adminParent(Form f, string idAdmin)
        {
            InitializeComponent();
            this.idAdmin = idAdmin;

            panel2.Controls.Clear();
            adminChildDataView child = new adminChildDataView(this.idAdmin);

            this.IsMdiContainer = true;
            child.TopLevel      = true;
            child.MdiParent     = this;
            panel2.Controls.Add(child);
            child.Show();
        }