private void LayThongTinTheoCum() { BaoCaoProcess baocaoProcess = new BaoCaoProcess(); List <string> lstDK = new List <string>(); string maCum = ""; if (cmbCum.SelectedIndex >= 0) { maCum = lstSourceCum_Select.ElementAt(cmbCum.SelectedIndex).KeywordStrings.ElementAt(0); } DataSet ds = baocaoProcess.GetThongTinTheoCum(maCum); if (!ds.IsNullOrEmpty() && ds.Tables.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; if (dr["NGAY_GIAI_NGAN"] != null && !LString.IsNullOrEmptyOrSpace(dr["NGAY_GIAI_NGAN"].ToString())) { raddtNgayPhatVon.Value = LDateTime.StringToDate(dr["NGAY_GIAI_NGAN"].ToString(), "yyyyMMdd"); } else { raddtNgayPhatVon.Value = LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd"); } } else { raddtNgayPhatVon.Value = LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd"); } }
/// <summary> /// Kiem tra du lieu truoc khi luu xuong grid /// </summary> /// <returns></returns> private bool Validation() { AutoComboBox au = new AutoComboBox(); AutoCompleteEntry auDinhKhoan = au.getEntryByDisplayName(lstSourceDinhKhoan, ref cmbDinhKhoan); AutoCompleteEntry auLoaiChungTu = au.getEntryByDisplayName(lstSourceLoaiChungTu, ref cmbLoaiChungTu); if (LString.IsNullOrEmptyOrSpace(txtNhomDinhKhoan.Text)) { LMessage.ShowMessage("Nhóm định khoản không được để trống", LMessage.MessageBoxType.Warning); txtNhomDinhKhoan.Focus(); return(false); } else if (auDinhKhoan == null) { LMessage.ShowMessage("Định khoản không được để trống", LMessage.MessageBoxType.Warning); cmbDinhKhoan.Focus(); return(false); } else if (LString.IsNullOrEmptyOrSpace(txtMaPhanLoai.Text)) { LMessage.ShowMessage("Mã phân loại không được để trống", LMessage.MessageBoxType.Warning); cmbDinhKhoan.Focus(); return(false); } else if (auLoaiChungTu == null) { LMessage.ShowMessage("Loại chứng từ không được để trống", LMessage.MessageBoxType.Warning); cmbLoaiChungTu.Focus(); return(false); } return(true); }
/// <summary> /// Đưa dữ liệu từ form vào object DM_PHAN_HE_GD /// </summary> /// <param name="banghi">Trạng thái bản ghi</param> /// <param name="nghiepvu">Trạng thái nghiệp vụ</param> /// <param name="nguoi_cnhap">Tên người cập nhật</param> /// <returns></returns> private Presentation.Process.DanhMucServiceRef.DM_PHAN_HE_GD LayDuLieu(BusinessConstant.TrangThaiNghiepVu nghiepvu, string nguoi_cnhat) { Presentation.Process.DanhMucServiceRef.DM_PHAN_HE_GD obj = new Presentation.Process.DanhMucServiceRef.DM_PHAN_HE_GD(); if (idPhanHeGD != 0) { obj.ID = idPhanHeGD; } obj.MA_LOAI_GDICH = txtMaLoaiGD.Text; obj.TEN_LOAI_GDICH = txtTenLoaiGD.Text; obj.TEN_TAT = txtTentat.Text; obj.MA_PHAN_HE = cmbPhanHe.SelectedValue.ToString(); obj.ID_PHAN_HE = 0; //obj.TTHAI_BGHI = cmbTrangThaiSDung.SelectedValue.ToString(); obj.TTHAI_NVU = BusinessConstant.layGiaTri(nghiepvu); obj.MA_DVI_TAO = Presentation.Process.Common.ClientInformation.MaDonVi; obj.MA_DVI_QLY = Presentation.Process.Common.ClientInformation.MaDonVi; if (!LString.IsNullOrEmptyOrSpace(nguoi_cnhat)) { obj.NGUOI_CNHAT = nguoi_cnhat; obj.NGAY_CNHAT = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat); } else { obj.NGUOI_NHAP = Presentation.Process.Common.ClientInformation.TenDangNhap; obj.NGAY_NHAP = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat); } return(obj); }
private void grThanhVienTrongGD_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e) { if (grThanhVienTrongGD.SelectedItem != null) { DataRowView dr = (DataRowView)grThanhVienTrongGD.SelectedItem; txtTenKhachHang.Text = dr["GD_HO_TEN"].ToString(); raddtNgaySinh.Value = LDateTime.StringToDate(dr["GD_NGAY_SINH"].ToString(), "yyyyMMdd"); cmbGioiTinh.SelectedIndex = lstSourceGioiTinh.IndexOf(lstSourceGioiTinh.FirstOrDefault(f => f.KeywordStrings.First().Equals(dr["GD_GIOI_TINH"].ToString()))); cmbMoiQuanHe.SelectedIndex = lstSourceMoiQuanHe.IndexOf(lstSourceMoiQuanHe.FirstOrDefault(f => f.KeywordStrings.First().Equals(dr["GD_MOI_QUAN_HE"].ToString()))); cmbTTSucKhoe.SelectedIndex = lstSourceSucKhoe.IndexOf(lstSourceSucKhoe.FirstOrDefault(f => f.KeywordStrings.First().Equals(dr["GD_TTRANG_SKHOE"].ToString()))); chkThongTinCoBanGDinh.IsChecked = Convert.ToBoolean(dr["GD_NGHE_NGHIEP"]); chkNguoiThuaKe.IsChecked = Convert.ToBoolean(dr["GD_NGUOI_TKE"]); chkNguoiDongTrachNhiem.IsChecked = Convert.ToBoolean(dr["GD_NGUOI_DONG_TNHIEM"]); txtSoGiayTo.Text = dr["GD_GTLQ_SO"].ToString(); if (!LString.IsNullOrEmptyOrSpace(dr["GD_GTLQ_NGAY_CAP"].ToString())) { raddtNgayCap.Value = LDateTime.StringToDate(dr["GD_GTLQ_NGAY_CAP"].ToString(), "yyyyMMdd"); } cmbLoaiGiayTo.SelectedIndex = lstSourceLoaiGiayTo.IndexOf(lstSourceLoaiGiayTo.FirstOrDefault(f => f.KeywordStrings.First().Equals(dr["GD_GTLQ_LOAI"].ToString()))); cmbNoiCap.SelectedIndex = lstSourceNoiCap.IndexOf(lstSourceNoiCap.FirstOrDefault(f => f.KeywordStrings.First().Equals(dr["GD_GTLQ_NOI_CAP"].ToString()))); isUpdate = true; txtMaThanhVienGD.Text = dr["GD_MA_DONG_TNHIEM"].ToString(); chkCoViecLam.IsChecked = Convert.ToBoolean(dr["GD_NGHE_NGHIEP"]); } }
/// <summary> /// Kiem tra du lieu truoc khi luu /// </summary> /// <returns></returns> private bool Validation() { AutoComboBox au = new AutoComboBox(); AutoCompleteEntry auVitri = au.getEntryByDisplayName(lstSourceViTri, ref cmbViTri); if (LString.IsNullOrEmptyOrSpace(txtHoTen.Text)) { CommonFunction.ThongBaoTrong(lblHoTen.Content.ToString()); txtHoTen.Focus(); return(false); } else if (auVitri == null) { CommonFunction.ThongBaoTrong(lblViTri.Content.ToString()); cmbViTri.Focus(); return(false); } else if (LString.IsNullOrEmptyOrSpace(txtDienThoai.Text)) { CommonFunction.ThongBaoTrong(lblSoDienThoai.Content.ToString()); txtDienThoai.Focus(); return(false); } return(true); }
private void grGiaoDichDS_GotFocus(object sender, RoutedEventArgs e) { if (!LString.IsNullOrEmptyOrSpace(txtLyDoChung.Text)) { foreach (DataRow dr in _dtGiaoDich.Rows) { if (dr["LY_DO"] == null || LString.IsNullOrEmptyOrSpace(dr["LY_DO"].ToString())) { dr["LY_DO"] = txtLyDoChung.Text; } } } }
/// <summary> /// Đưa các control của form về trạng thái mặc định /// </summary> private void SetFormThanhVienGD(int idKhachHang) { Presentation.Process.KhachHangProcess process = new Presentation.Process.KhachHangProcess(); try { DataSet dsSourceKHang = process.getThongTinKHTheoID(idKhachHang); if (dsSourceKHang != null && dsSourceKHang.Tables.Count > 0) { DataRow dr = dsSourceKHang.Tables["KH_KHANG_HSO"].Rows[0]; isUpdate = false; txtMaThanhVienGD.Text = dr["MA_KHANG"].ToString(); txtTenKhachHang.Text = dr["TEN_KHANG"].ToString(); raddtNgaySinh.Value = LDateTime.StringToDate(dr["DD_NGAY_SINH"].ToString(), "yyyyMMdd"); if (!LString.IsNullOrEmptyOrSpace(dr["DD_GIOI_TINH"].ToString())) { cmbGioiTinh.SelectedIndex = lstSourceGioiTinh.IndexOf(lstSourceGioiTinh.FirstOrDefault(f => f.KeywordStrings.First().Equals(dr["DD_GIOI_TINH"].ToString()))); } cmbMoiQuanHe.SelectedIndex = 0; cmbTTSucKhoe.SelectedIndex = 0; chkThongTinCoBanGDinh.IsChecked = false; chkNguoiThuaKe.IsChecked = false; chkNguoiDongTrachNhiem.IsChecked = false; txtSoGiayTo.Text = ""; raddtNgayCap.Value = null; cmbLoaiGiayTo.SelectedIndex = lstSourceLoaiGiayTo.IndexOf(lstSourceLoaiGiayTo.FirstOrDefault(f => f.KeywordStrings.First().Equals(BusinessConstant.LOAI_GIAY_TO.CHUNG_MINH_ND.layGiaTri()))); cmbNoiCap.SelectedIndex = -1; txtTenKhachHang.Focus(); } } catch (System.Exception ex) { 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.DungChung.LoiLoadDuLieu", ex).ShowDialog(); } LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } finally { process = null; } }
/// <summary> /// Kiểm tra các thông tin nhập vào trước khi lưu dữ liệu /// </summary> /// <returns></returns> private bool Validation() { if (LString.IsNullOrEmptyOrSpace(txtMaLoaiGD.Text)) { LMessage.ShowMessage("Mã loại giao dịch không được để trống", LMessage.MessageBoxType.Warning); txtMaLoaiGD.Focus(); return(false); } else if (LString.IsNullOrEmptyOrSpace(txtTenLoaiGD.Text)) { LMessage.ShowMessage("M.DanhMuc.ucPhanHeGDCT.ThieuTenDonVi", LMessage.MessageBoxType.Warning); txtTenLoaiGD.Focus(); return(false); } return(true); }
private bool Validation() { if (string.IsNullOrEmpty(txtUsername.Text)) { LMessage.ShowMessage("M.ZAMainApp.LoginWindow.ThieuTenDangNhap", LMessage.MessageBoxType.Warning); txtUsername.Focus(); return(false); } else if (LString.IsNullOrEmptyOrSpace(txtPassword.Password)) { LMessage.ShowMessage("M.ZAMainApp.LoginWindow.ThieuMatKhau", LMessage.MessageBoxType.Warning); txtPassword.Focus(); return(false); } return(true); }
private void FindData() { try { List <string> lst = new List <string>(); foreach (RadTreeViewItem item in trvDonvi.CheckedItems) { if (!LString.IsNullOrEmptyOrSpace(item.Tag.ToString())) { lst.Add(item.Tag.ToString()); } } DataTable grdData = new DataTable("FIND_DATA"); foreach (DataColumn col in dt.Columns) { grdData.Columns.Add(col.ColumnName, col.DataType); } grNhanSuDS.ItemsSource = null; if (lst.Count > 0) { foreach (DataRow row in dt.Rows) { if (lst.Contains(row["MA_PHAN_HE"].ToString())) { grdData.ImportRow(row); grdData.Rows[grdData.Rows.Count - 1]["STT"] = grdData.Rows.Count; } } grNhanSuDS.ItemsSource = grdData; UpdateLayout(); lblSum.Content = grdData.Rows.Count; } else { grNhanSuDS.ItemsSource = dt; lblSum.Content = dt.Rows.Count; } } catch (System.Exception ex) { this.Cursor = Cursors.Arrow; CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
/// <summary> /// Kiem tra du lieu truoc khi luu /// </summary> /// <returns></returns> private bool Validation() { if (LString.IsNullOrEmptyOrSpace(txtSoTaiKhoan.Text)) { CommonFunction.ThongBaoTrong(lblSoTaiKhoan.Content.ToString()); txtSoTaiKhoan.Focus(); return(false); } else if (LString.IsNullOrEmptyOrSpace(txtTCTD.Text)) { CommonFunction.ThongBaoTrong(lblTenTCTD.Content.ToString()); txtTCTD.Focus(); return(false); } return(true); }
private void btnKhachHang_Click(object sender, RoutedEventArgs e) { Window window = new Window(); window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.RenderSize = new Size(1024, 768); ucPopupKhachHang uc = new ucPopupKhachHang(); window.Content = uc; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.ShowDialog(); if (!LString.IsNullOrEmptyOrSpace(uc.id)) { txtMaKhachHang.Text = uc.ma; lblTenKhachHang.Content = uc.ten; } uc = null; }
/// <summary> /// Kiem tra du lieu truoc khi luu /// </summary> /// <returns></returns> private bool Validation() { AutoComboBox au = new AutoComboBox(); AutoCompleteEntry loai_giay_to = au.getEntryByDisplayName(lstSourceLoaiGiayTo, ref cmbLoaiGiayTo); AutoCompleteEntry noi_cap = au.getEntryByDisplayName(lstSourceNoiCap, ref cmbNoiCap); if (loai_giay_to == null) { CommonFunction.ThongBaoTrong(lblLoaiGiayTo.Content.ToString()); cmbLoaiGiayTo.Focus(); return(false); } else if (LString.IsNullOrEmptyOrSpace(txtSoGiayTo.Text)) { CommonFunction.ThongBaoTrong(lblSoGiayTo.Content.ToString()); txtSoGiayTo.Focus(); return(false); } else if (raddtNgayCap.Value == null) { CommonFunction.ThongBaoTrong(lblNgayCap.Content.ToString()); raddtNgayCap.Focus(); return(false); } else if (noi_cap == null) { CommonFunction.ThongBaoTrong(lblNoiCap.Content.ToString()); cmbNoiCap.Focus(); return(false); } else if (raddtNgayHetHan.Value == null) { CommonFunction.ThongBaoTrong(lblNgayHetHan.Content.ToString()); raddtNgayHetHan.Focus(); return(false); } else if (Convert.ToDateTime(raddtNgayHetHan.Value) < Convert.ToDateTime(raddtNgayCap.Value)) { LMessage.ShowMessage("M.KhachHang.Popup.ucThongTinCoBanHoGD.LoiNgayHetHan", LMessage.MessageBoxType.Warning); raddtNgayHetHan.Focus(); return(false); } return(true); }
/// <summary> /// Hiện popup khách hàng chưa phải là thành viên /// </summary> private void HienPopUpThanhVienGD() { Window window = new Window(); window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.RenderSize = new Size(1024, 768); ucPopupKhachHang uc = new ucPopupKhachHang(false); window.Title = "Danh sách khách hàng"; window.Content = uc; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.ShowDialog(); if (!LString.IsNullOrEmptyOrSpace(uc.id)) { int idKhachHang = Convert.ToInt32(uc.id); SetFormThanhVienGD(idKhachHang); } uc = null; }
private void txtLyDoChung_LostFocus(object sender, RoutedEventArgs e) { if (!LString.IsNullOrEmptyOrSpace(txtLyDoChung.Text)) { foreach (DataRow dr in _dtGiaoDich.Rows) { if (KT_KS_LYDO == "RIENG") { if (dr["LY_DO"] == null || LString.IsNullOrEmptyOrSpace(dr["LY_DO"].ToString())) { dr["LY_DO"] = txtLyDoChung.Text; } } else { dr["LY_DO"] = txtLyDoChung.Text; } } } }
/// <summary> /// Kiem tra du lieu truoc khi luu /// </summary> /// <returns></returns> private bool Validation() { AutoComboBox au = new AutoComboBox(); if (LString.IsNullOrEmptyOrSpace(txtMaKhachHang.Text)) { CommonFunction.ThongBaoTrong(lblMaKhachHang.Content.ToString()); txtMaKhachHang.Focus(); return(false); } else if (au.getEntryByDisplayName(lstSourceMoiQuanHe, ref cmbMoiQuanHe) == null) { CommonFunction.ThongBaoTrong(lblMoiQuanHe.Content.ToString()); cmbMoiQuanHe.Focus(); return(false); } return(true); }
private void txtMaPhanLoai_LostFocus(object sender, RoutedEventArgs e) { Presentation.Process.KeToanProcess ketoanProcess = new Presentation.Process.KeToanProcess(); try { if (!LString.IsNullOrEmptyOrSpace(txtMaPhanLoai.Text)) { DataTable dt = ketoanProcess.getThongTinMaPhanLoaiTheoMa(txtMaPhanLoai.Text); if (dt != null && dt.Rows.Count > 0) { txtMaPhanLoai.Tag = dt.Rows[0]["ID"].ToString(); txtMaPhanLoai.Text = dt.Rows[0]["MA_PLOAI"].ToString(); lblTenPhanLoai.Content = dt.Rows[0]["TEN_PLOAI"].ToString(); } else { LMessage.ShowMessage("Không tồn tại mã phân loại tài khoản này", LMessage.MessageBoxType.Warning); txtMaPhanLoai.Tag = ""; txtMaPhanLoai.Text = ""; lblTenPhanLoai.Content = ""; } } else { txtMaPhanLoai.Tag = ""; txtMaPhanLoai.Text = ""; lblTenPhanLoai.Content = ""; } } catch (System.Exception ex) { LMessage.ShowMessage("M.DungChung.LoiLoadDuLieu", LMessage.MessageBoxType.Error); LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } finally { ketoanProcess = null; } }
/// <summary> /// Kiem tra du lieu truoc khi luu /// </summary> /// <returns></returns> private bool Validation() { AutoComboBox au = new AutoComboBox(); if (LString.IsNullOrEmptyOrSpace(txtTenKhachHang.Text)) { CommonFunction.ThongBaoTrong(lblHoTen.Content.ToString()); txtTenKhachHang.Focus(); return(false); } else if (raddtNgaySinh.Value == null) { CommonFunction.ThongBaoTrong(lblNgayThangNamSinh.Content.ToString()); raddtNgaySinh.Focus(); return(false); } else if (au.getEntryByDisplayName(lstSourceGioiTinh, ref cmbGioiTinh) == null) { CommonFunction.ThongBaoTrong(lblGioiTinh.Content.ToString()); cmbGioiTinh.Focus(); return(false); } else if (au.getEntryByDisplayName(lstSourceMoiQuanHe, ref cmbMoiQuanHe) == null) { CommonFunction.ThongBaoTrong(lblMoiQuanHe.Content.ToString()); cmbMoiQuanHe.Focus(); return(false); } else if (au.getEntryByDisplayName(lstSourceSucKhoe, ref cmbTTSucKhoe) == null) { CommonFunction.ThongBaoTrong(lblTTSucKhoe.Content.ToString()); cmbTTSucKhoe.Focus(); return(false); } else if (Convert.ToDateTime(raddtNgaySinh.Value) > LDateTime.GetCurrentDate()) { LMessage.ShowMessage("M.KhachHang.Popup.ucThongTinCoBanHoGD.LoiNgaySinh", LMessage.MessageBoxType.Warning); raddtNgaySinh.Focus(); return(false); } if (chkNguoiThuaKe.IsChecked == true || chkNguoiDongTrachNhiem.IsChecked == true) { AutoCompleteEntry loai_giay_to = au.getEntryByDisplayName(lstSourceLoaiGiayTo, ref cmbLoaiGiayTo); AutoCompleteEntry noi_cap = au.getEntryByDisplayName(lstSourceNoiCap, ref cmbNoiCap); //if (loai_giay_to == null) //{ // CommonFunction.ThongBaoTrong(lblLoaiGiayTo.Content.ToString()); // cmbLoaiGiayTo.Focus(); // return false; //} //else if (LString.IsNullOrEmptyOrSpace(txtSoGiayTo.Text)) //{ // CommonFunction.ThongBaoTrong(lblSoGiayTo.Content.ToString()); // txtSoGiayTo.Focus(); // return false; //} //else if (raddtNgayCap.Value == null) //{ // CommonFunction.ThongBaoTrong(lblNgayCap.Content.ToString()); // raddtNgayCap.Focus(); // return false; //} //else if (noi_cap == null) //{ // CommonFunction.ThongBaoTrong(lblNoiCap.Content.ToString()); // cmbNoiCap.Focus(); // return false; //} } return(true); }
/// <summary> /// Su kien luu thong tin chi tiet xuong grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tlbSaveThongTin_Click(object sender, RoutedEventArgs e) { try { if (Validation()) { AutoComboBox au = new AutoComboBox(); string gioi_tinh = au.getEntryByDisplayName(lstSourceGioiTinh, ref cmbGioiTinh).KeywordStrings[0]; string suc_khoe = au.getEntryByDisplayName(lstSourceSucKhoe, ref cmbTTSucKhoe).KeywordStrings[0]; string moi_quan_he = au.getEntryByDisplayName(lstSourceMoiQuanHe, ref cmbMoiQuanHe).KeywordStrings[0]; DateTime ngay_sinh = Convert.ToDateTime(raddtNgaySinh.Value); int tuoi = LDateTime.CountYearBetweenDates(LDateTime.GetCurrentDate(), Convert.ToDateTime(raddtNgaySinh.Value)); DataRowView dr = null; if (!isUpdate) { DataRow drAdd = _dtSource.NewRow(); _dtSource.Rows.Add(drAdd); dr = _dtSource.DefaultView[_dtSource.Rows.Count - 1]; dr["CHON"] = false; dr["STT"] = grThanhVienTrongGD.Items.Count; dr["ID_KHANG"] = -1; idTuSinh = idTuSinh - 1; } else { dr = (DataRowView)grThanhVienTrongGD.SelectedItem; } if (dr == null) { DataRow drAdd = _dtSource.NewRow(); _dtSource.Rows.Add(drAdd); dr = _dtSource.DefaultView[_dtSource.Rows.Count - 1]; dr["CHON"] = false; dr["STT"] = grThanhVienTrongGD.Items.Count; dr["ID_KHANG"] = -1; idTuSinh = idTuSinh - 1; } dr["GD_HO_TEN"] = txtTenKhachHang.Text.Trim(); dr["GD_NGAY_SINH"] = ngay_sinh.ToString("yyyyMMdd"); dr["GD_NGAY_SINH_TEXT"] = ngay_sinh.ToString(@"dd/MM/yyyy"); dr["GD_TUOI"] = tuoi; dr["GD_GIOI_TINH"] = gioi_tinh; dr["GD_GIOI_TINH_TEXT"] = cmbGioiTinh.Text; dr["GD_MOI_QUAN_HE"] = moi_quan_he; dr["GD_MOI_QUAN_HE_TEXT"] = cmbMoiQuanHe.Text; dr["GD_TTRANG_SKHOE"] = suc_khoe; dr["GD_TTRANG_SKHOE_TEXT"] = cmbTTSucKhoe.Text; dr["GD_NGHE_NGHIEP"] = chkCoViecLam.IsChecked; dr["GD_NGUOI_TKE"] = chkNguoiThuaKe.IsChecked; dr["GD_NGUOI_DONG_TNHIEM"] = chkNguoiDongTrachNhiem.IsChecked; if (!LString.IsNullOrEmptyOrSpace(txtMaThanhVienGD.Text)) { dr["GD_MA_DONG_TNHIEM"] = txtMaThanhVienGD.Text; } else { dr["GD_MA_DONG_TNHIEM"] = "DTN" + DateTime.Now.ToString("yyyyMMddHHmmss"); } if (chkNguoiThuaKe.IsChecked == true || chkNguoiDongTrachNhiem.IsChecked == true) { AutoCompleteEntry auLoaiGiayTo = au.getEntryByDisplayName(lstSourceLoaiGiayTo, ref cmbLoaiGiayTo); AutoCompleteEntry auNoiCap = au.getEntryByDisplayName(lstSourceNoiCap, ref cmbNoiCap); dr["GD_GTLQ_SO"] = txtSoGiayTo.Text; if (!LObject.IsNullOrEmpty(auNoiCap)) { dr["GD_GTLQ_NOI_CAP"] = auNoiCap.KeywordStrings[0]; } dr["GD_GTLQ_NOI_CAP_TEXT"] = cmbNoiCap.Text; if (!LObject.IsNullOrEmpty(auLoaiGiayTo)) { dr["GD_GTLQ_LOAI"] = auLoaiGiayTo.KeywordStrings[0]; } dr["GD_GTLQ_LOAI_TEXT"] = cmbLoaiGiayTo.Text; if (!LObject.IsNullOrEmpty(raddtNgayCap.Value)) { DateTime ngay_cap = Convert.ToDateTime(raddtNgayCap.Value); dr["GD_GTLQ_NGAY_CAP"] = ngay_cap.ToString("yyyyMMdd"); dr["GD_GTLQ_NGAY_CAP_TEXT"] = ngay_cap.ToString("dd/MM/yyyy"); } } ResetForm(); } } catch (Exception ex) { LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error); LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } }
private void AllColumnCheckBox_Click(object sender, System.Windows.RoutedEventArgs e) { var checkBox = sender as CheckBox; if (checkBox != null) { if (checkBox.IsChecked.GetValueOrDefault()) { if (checkBox.Name.Equals("FullControl")) { foreach (DataRow r in dt.Rows) { for (int i = 3; i < dt.Columns.Count; i++) { string s = r[i].ToString(); if (!LString.IsNullOrEmptyOrSpace(s)) { r[i] = true; } } } } else { foreach (DataRow r in dt.Rows) { string s = r[checkBox.Name].ToString(); if (!LString.IsNullOrEmptyOrSpace(s)) { r[checkBox.Name] = true; } } } } else { if (checkBox.Name.Equals("FullControl")) { foreach (DataRow r in dt.Rows) { for (int i = 3; i < dt.Columns.Count; i++) { string s = r[i].ToString(); if (!LString.IsNullOrEmptyOrSpace(s)) { r[i] = false; } } } } else { foreach (DataRow r in dt.Rows) { string s = r[checkBox.Name].ToString(); if (!LString.IsNullOrEmptyOrSpace(s)) { r[checkBox.Name] = false; // Bỏ check cho các checkbox toàn quyền con r["FullControl"] = false; } } // Bỏ check toàn quyền FullControl.IsChecked = false; } } } }
private void FullControlCheckBox_Click(object sender, System.Windows.RoutedEventArgs e) { var checkBox = sender as CheckBox; if (checkBox != null) { string maChucNang = checkBox.Tag.ToString(); if (checkBox.IsChecked.GetValueOrDefault()) { foreach (DataRow r in dt.Rows) { if (r["MA"].Equals(maChucNang)) { for (int i = 3; i < dt.Columns.Count; i++) { string s = r[i].ToString(); if (!LString.IsNullOrEmptyOrSpace(s)) { r[i] = true; } } } } } else { foreach (DataRow r in dt.Rows) { if (r["MA"].Equals(maChucNang)) { for (int i = 3; i < dt.Columns.Count; i++) { string s = r[i].ToString(); if (!LString.IsNullOrEmptyOrSpace(s)) { r[i] = false; } } } } // Đối với tính năng theo cột string tenCheckBox = checkBox.Name.Substring(3); //if (tenCheckBox.Equals(DatabaseConstant.Action.XEM.getValue())) // View.IsChecked = false; //else if (tenCheckBox.Equals(DatabaseConstant.Action.THEM.getValue())) // Add.IsChecked = false; //else if (tenCheckBox.Equals(DatabaseConstant.Action.SUA.getValue())) // Modify.IsChecked = false; //else if (tenCheckBox.Equals(DatabaseConstant.Action.XOA.getValue())) // Delete.IsChecked = false; //else if (tenCheckBox.Equals(DatabaseConstant.Action.DUYET.getValue())) // Approve.IsChecked = false; //else if (tenCheckBox.Equals(DatabaseConstant.Action.THOAI_DUYET.getValue())) // Cancel.IsChecked = false; //else if (tenCheckBox.Equals(DatabaseConstant.Action.TU_CHOI_DUYET.getValue())) // Refuse.IsChecked = false; //else if (tenCheckBox.Equals(DatabaseConstant.Action.XU_LY.getValue())) // Process.IsChecked = false; if (tenCheckBox.Equals(DatabaseConstant.Action.TOAN_QUYEN.getValue())) { FullControl.IsChecked = false; } } } }
private void CheckBox_Click(object sender, System.Windows.RoutedEventArgs e) { var checkBox = sender as CheckBox; if (checkBox != null) { string maChucNang = checkBox.Tag.ToString(); if (checkBox.IsChecked.GetValueOrDefault()) { // Đối với chức năng theo hàng foreach (DataRow r in dt.Rows) { if (r["MA"].Equals(maChucNang)) { string s = r[3].ToString(); if (!LString.IsNullOrEmptyOrSpace(s)) { r[3] = true; } bool all = true; for (int i = 3; i < dt.Columns.Count - 1; i++) { string ss = r[i].ToString(); if (!LString.IsNullOrEmptyOrSpace(ss)) { if ((bool)r[i] == false) { all = false; break; } } } string sFull = r["FullControl"].ToString(); if (!LString.IsNullOrEmptyOrSpace(sFull)) { r["FullControl"] = all; } } } // Đối với tính năng theo cột } else { // Đối với chức năng theo hàng foreach (DataRow r in dt.Rows) { if (r["MA"].Equals(maChucNang)) { string sFull = r["FullControl"].ToString(); if (!LString.IsNullOrEmptyOrSpace(sFull)) { r["FullControl"] = false; } } } // Đối với tính năng theo cột string tenCheckBox = checkBox.Name.Substring(3); if (tenCheckBox.Equals(DatabaseConstant.Action.XEM.getValue())) { View.IsChecked = false; } else if (tenCheckBox.Equals(DatabaseConstant.Action.THEM.getValue())) { Add.IsChecked = false; } else if (tenCheckBox.Equals(DatabaseConstant.Action.SUA.getValue())) { Modify.IsChecked = false; } else if (tenCheckBox.Equals(DatabaseConstant.Action.XOA.getValue())) { Delete.IsChecked = false; } else if (tenCheckBox.Equals(DatabaseConstant.Action.DUYET.getValue())) { Approve.IsChecked = false; } else if (tenCheckBox.Equals(DatabaseConstant.Action.THOAI_DUYET.getValue())) { Cancel.IsChecked = false; } else if (tenCheckBox.Equals(DatabaseConstant.Action.TU_CHOI_DUYET.getValue())) { Refuse.IsChecked = false; } else if (tenCheckBox.Equals(DatabaseConstant.Action.XU_LY.getValue())) { Process.IsChecked = false; } //else if (tenCheckBox.Equals(DatabaseConstant.Action.TOAN_QUYEN.getValue())) // FullControl.IsChecked = false; // Bỏ check toàn quyền FullControl.IsChecked = false; } } }