Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            BLL.User_BLL user_BLL = new BLL.User_BLL();
            if (command == 1)
            {
                string username   = txtUsername.Text.Trim();
                string name       = txtName.Text.Trim();
                string password   = txtPassword.Text.Trim();
                string quota      = txtQuota.Text.Trim();
                string tablespace = cbtablespace.SelectedItem.ToString().Trim();
                string status     = cbStatus.SelectedItem.ToString().Trim();
                string profile    = cbProfile.SelectedItem.ToString().Trim();

                user_BLL.insert(username, password, name, profile, tablespace, quota, status);
            }
            else
            {
                string username   = txtUsername.Text.Trim();
                string name       = txtName.Text.Trim();
                string password   = txtPassword.Text.Trim();
                string quota      = txtQuota.Text.Trim();
                string tablespace = cbtablespace.SelectedItem.ToString().Trim();
                string status     = cbStatus.SelectedItem.ToString().Trim();
                string profile    = cbProfile.SelectedItem.ToString().Trim();
                user_BLL.update(username, password, name, profile, tablespace, quota, status);
            }
            init();
        }
Пример #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you want to delete user?", "Confirmation",
                                                  MessageBoxButtons.OKCancel);

            if (result == DialogResult.OK)
            {
                BLL.User_BLL user_BLL = new BLL.User_BLL();
                user_BLL.delete(txtUsername.Text);
                init();
            }
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            BLL.User_BLL user_BLL = new BLL.User_BLL();
            int          check    = user_BLL.Login(txtUsername.Text, txtPassword.Text);

            if (check == 1)
            {
                MessageBox.Show("Dang Nhap Thanh Cong!");
            }
            else
            {
                MessageBox.Show("Kiem tra lai thong tin dang nhap!");
            }
        }
Пример #4
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            currentRow        = e.RowIndex;
            btnUpdate.Enabled = true;
            btnDelete.Enabled = true;
            txtUsername.Text  = dataGridView1.Rows[currentRow].Cells[1].Value.ToString();
            txtName.Text      = dataGridView1.Rows[currentRow].Cells[3].Value.ToString();
            txtPassword.Text  = "";
            BLL.User_BLL user_BLL = new BLL.User_BLL();
            if (user_BLL.checkStatus(txtUsername.Text) == 1)
            {
                cbStatus.SelectedIndex = 0;
            }
            else
            {
                cbStatus.SelectedIndex = 1;
            }
            DataRow dataRow = user_BLL.getOne(txtUsername.Text).Rows[0];
            // tablespace
            // profile
            //quota
            string tablespace = dataRow.ItemArray[0].ToString();
            string profile    = dataRow.ItemArray[1].ToString();
            string quota      = (int.Parse(dataRow.ItemArray[2].ToString()) / 1024 / 1024).ToString();

            foreach (var item in cbtablespace.Items)
            {
                if (item.ToString().ToUpper() == tablespace.ToUpper())
                {
                    cbtablespace.SelectedItem = item;
                    break;
                }
            }
            foreach (var item in cbProfile.Items)
            {
                if (item.ToString().ToUpper() == profile.ToUpper())
                {
                    cbProfile.SelectedItem = item;
                    break;
                }
            }
            txtQuota.Text = quota;
        }
Пример #5
0
 private void init()
 {
     BLL.User_BLL user_BLL = new BLL.User_BLL();
     dataGridView1.DataSource = user_BLL.getAll();
     BLL.Profile_BLL profile_BLL = new BLL.Profile_BLL();
     BLL.TBS_BLL     tBS_BLL     = new BLL.TBS_BLL();
     cbProfile.Items.Clear();
     foreach (DataRow row in profile_BLL.getAll().Rows)
     {
         cbProfile.Items.Add(row.ItemArray[1]);
     }
     cbProfile.SelectedIndex = 0;
     cbtablespace.Items.Clear();
     foreach (DataRow row in tBS_BLL.getAll().Rows)
     {
         cbtablespace.Items.Add(row.ItemArray[1]);
     }
     cbtablespace.SelectedIndex = 0;
     event_end();
     dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
 }
Пример #6
0
 private void Quyen_User_Load(object sender, EventArgs e)
 {
     BLL.User_BLL user_BLL = new BLL.User_BLL();
     dataGridView1.DataSource          = user_BLL.getQuyenUser();
     dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
 }
Пример #7
0
 private void User_Detail_Load(object sender, EventArgs e)
 {
     BLL.User_BLL user_BLL = new BLL.User_BLL();
     dataGridView1.DataSource          = user_BLL.getDetailUser(username);
     dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
 }