protected override void SaveDetail() { try { if (ValidateData()) { MessageBox.Show(@"Vui lòng nhập đầy đủ thông tin", @"Lỗi"); } else { foreach (var row in dgv_DanhSach.Rows.Where(row => string.IsNullOrEmpty(row.Cells["ID"].Text))) { var hs = new Taikhoan { TaiKhoan = row.Cells["TaiKhoan"].Value.ToString(), HoTen = row.Cells["HoTen"].Value.ToString(), Quyen = row.Cells["Quyen"].Value.ToString(), MatKhau = MaHoaMd5.Md5(row.Cells["MatKhau"].Value.ToString()) }; _listAdd.Add(hs); } if (_listAdd.Count <= 0 && _listUpdate.Count <= 0 && _listUpdatepass.Count <= 0) { return; } if (_listUpdate.Count > 0) { UpdateData.UpdateTaiKhoan(_listUpdate); } if (_listUpdatepass.Count > 0) { UpdateData.UpdateMatKhau(_listUpdatepass); } if (_listAdd.Count > 0) { InsertData.ThemTaiKhoan(_listAdd); } MessageBox.Show(FormResource.MsgThongbaothanhcong, FormResource.MsgCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); LoadFormDetail(); } } catch (Exception ex) { Log2File.LogExceptionToFile(ex); } }