/// <summary> /// Xử lý xóa dữ liệu /// </summary> private void Luu(string trangThai) { DanhMucProcess danhmucProcess = new DanhMucProcess(); Mouse.OverrideCursor = Cursors.Wait; try { DM_DMUC_GTRI obj = new DM_DMUC_GTRI(); if (ID > 0) { obj.ID = ID; } obj.ID_DMUC_LOAI = Convert.ToInt32(lstSourceLoai.ElementAt(cmbLoaiDanhMuc.SelectedIndex).KeywordStrings.ElementAt(1)); obj.MA_DMUC = txtMa.Text; obj.MA_DMUC_LOAI = lstSourceLoai.ElementAt(cmbLoaiDanhMuc.SelectedIndex).KeywordStrings.First(); obj.MA_DVI_QLY = ClientInformation.MaDonVi; obj.MA_DVI_TAO = ClientInformation.MaDonVi; obj.NGAY_CNHAT = string.IsNullOrEmpty(raddtNgayCNhat.Value.ToString().Trim()) ? ((DateTime)raddtNgayCNhat.Value).ToString("yyyyMMdd") : (DateTime.Today).ToString("yyyyMMdd"); obj.NGAY_NHAP = string.IsNullOrEmpty(raddtNgayNhap.Value.ToString().Trim()) ? ((DateTime)raddtNgayNhap.Value).ToString("yyyyMMdd") : (DateTime.Today).ToString("yyyyMMdd"); obj.NGUOI_CNHAT = ClientInformation.TenDangNhap; if (ID == 0) { obj.NGUOI_NHAP = ClientInformation.TenDangNhap; } obj.TEN_DMUC = txtTen.Text; obj.TTHAI_BGHI = lstSourceTrangThai.ElementAt(cmbTrangThaiSDung.SelectedIndex).KeywordStrings.First(); obj.TTHAI_NVU = trangThai; if (ID == 0) { danhmucProcess.ThemDungChung(obj); } else { danhmucProcess.SuaDungChung(obj); } HoanThanh(); } catch (System.Exception ex) { this.Cursor = Cursors.Arrow; if (ex.GetType() == typeof(CustomException)) { new frmThongBaoLoi(ex.Message, ex.InnerException).ShowDialog(); } else if (ex.InnerException.GetType() == typeof(CustomException)) { new frmThongBaoLoi(ex.InnerException.Message, ex.InnerException).ShowDialog(); } else { new frmThongBaoLoi("M.DanhMuc.ucDonViDS.LoiXoaDuLieu", ex).ShowDialog(); } LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } Mouse.OverrideCursor = Cursors.Arrow; }