Exemplo n.º 1
0
        private void Up_BT_Click(object sender, EventArgs e)
        {
            string  UpdateRow = AccGridView.CurrentRow.Cells["Acc_ID"].Value.ToString();
            AdminCl admin     = new AdminCl(User_TB.Text, Pass_TB.Text, Role_Cb.Text, ID_TB.Text);

            admin.Update(UpdateRow);
            if (!IsEmt())
            {
                if (admin.Update(UpdateRow) != 0)
                {
                    MessageBox.Show("Success");
                    ClearData();
                    AccGridView.DataSource = admin.AccountTable();
                }
                else
                {
                    MessageBox.Show("failed");
                    User_TB.Focus();
                }
            }
            else
            {
                MessageBox.Show("fill all input box to update oni-chan");
            }
        }
Exemplo n.º 2
0
        private void AccGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            //Show Update button and hide add button
            Up_BT.Show();
            Add_BT.Hide();
            AdminCl admin = new AdminCl();

            //bring data to the textboxes
            string UpdateRow = AccGridView.CurrentRow.Cells["Acc_ID"].Value.ToString();

            Role_Cb.Text = admin.UpdateData(UpdateRow, "Role");
            User_TB.Text = admin.UpdateData(UpdateRow, "Username");
            Pass_TB.Text = admin.UpdateData(UpdateRow, "Password");
            ID_TB.Text   = admin.UpdateData(UpdateRow, "Acc_ID");
        }
Exemplo n.º 3
0
        private void Add_BT_Click(object sender, EventArgs e)
        {
            AdminCl admin = new AdminCl(User_TB.Text, Pass_TB.Text, Role_Cb.Text, ID_TB.Text);

            if (!IsEmt())
            {
                if (admin.Add() != 0)
                {
                    MessageBox.Show("Success");
                    ClearData();
                    AccGridView.DataSource = admin.AccountTable();
                }
                else
                {
                    MessageBox.Show("failed");
                    User_TB.Focus();
                }
            }
            else
            {
                MessageBox.Show("Fill all input box");
            }
        }