private void btnLuuTQH_Click(object sender, EventArgs e) { string name = dtgvThemQuyenHan.Rows[0].Cells[0].Value.ToString(); string hethong = dtgvThemQuyenHan.Rows[0].Cells[1].Value.ToString(); string danhmuc = dtgvThemQuyenHan.Rows[0].Cells[2].Value.ToString(); string chucnang = dtgvThemQuyenHan.Rows[0].Cells[3].Value.ToString(); string trogiup = dtgvThemQuyenHan.Rows[0].Cells[4].Value.ToString(); string them = dtgvThemQuyenHan.Rows[0].Cells[5].Value.ToString(); string xoa = dtgvThemQuyenHan.Rows[0].Cells[6].Value.ToString(); string sua = dtgvThemQuyenHan.Rows[0].Cells[7].Value.ToString(); int _hethong = 0, _danhmuc = 0, _chucnang = 0, _trogiup = 0, _them = 0, _xoa = 0, _sua = 0; if (hethong == "True") { _hethong = 1; } if (danhmuc == "True") { _danhmuc = 1; } if (chucnang == "True") { _chucnang = 1; } if (trogiup == "True") { _trogiup = 1; } if (them == "True") { _them = 1; } if (xoa == "True") { _xoa = 1; } if (sua == "True") { _sua = 1; } int id = b_user.Call_Get_ID_User(name); try { b_per.Call_Update_Per(id, _hethong, _danhmuc, _chucnang, _trogiup, _them, _xoa, _sua); MessageBox.Show("Chỉnh sửa thành công", "Thông Báo", MessageBoxButtons.OK); } catch { } }
private void btnDK_Click(object sender, EventArgs e) { DTO_Users dto_user = new DTO_Users(); BLL_Users bll_user = new BLL_Users(); BLL_Per b_per = new BLL_Per(); string temp_urname = bll_user.Call_Get_Username_User(txtUsername.Text); if (txtname.Text == "" || txtpassword.Text == "" || txtemail.Text == "" || txtUsername.Text == "") { MessageBox.Show("Không được để trống bất cứ ô nào", "Thông báo", MessageBoxButtons.OK); } else if (temp_urname == txtUsername.Text) { MessageBox.Show("Tên Đăng nhập đã tồn tại, vui lòng nhập vào tên đăng nhập khác", "Thông báo", MessageBoxButtons.OK); txtUsername.Focus(); } else { try { dto_user.F_Username = txtUsername.Text; dto_user.F_Password = txtpassword.Text; dto_user.F_Name = txtname.Text; dto_user.F_DOB = DateTime.Parse(dtdbo.Text); dto_user.F_Email = txtemail.Text; bll_user.Call_Insert_User(dto_user); // int id = bll_user.Call_Get_ID_User(txtUsername.Text); b_per.Call_Insert_per(id); MessageBox.Show("successful"); this.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }