Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtFullname.Text == "")
            {
                MessageBox.Show("Vui lòng nhập họ tên tài khoản!", "Thông báo");
                return;
            }

            if (txtName.Text == "")
            {
                MessageBox.Show("Vui lòng nhập tên người dùng tài khoản!", "Thông báo");
                return;
            }

            if (txtPass.Text == "")
            {
                MessageBox.Show("Vui lòng nhập mật khẩu!", "Thông báo");
                return;
            }

            DTO_Account info = new DTO_Account();

            info.Fullname = txtFullname.Text;
            info.Username = txtName.Text;
            info.Password = txtPass.Text;
            info.Position = Convert.ToInt32(cboPosition.SelectedItem.ToString());

            if (this.action == "add")
            {
                bus.addItem(info);
            }
            if (this.action == "edit")
            {
                info.Id = Convert.ToInt32(txtId.Text);
                bus.editItem(info);
            }

            foreach (DataGridViewRow row in dataGridView.SelectedRows)
            {
                this.index = row.Index;
            }

            GUI_Account_Load(sender, e);
            endableAll(true);
            groupBox.Enabled         = false;
            dataGridView.CurrentCell = dataGridView.Rows[this.index].Cells[0];
        }