/// <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) { if (Validation()) { AutoComboBox au = new AutoComboBox(); string loai_giay_to = au.getEntryByDisplayName(lstSourceLoaiGiayTo, ref cmbLoaiGiayTo).KeywordStrings[0]; string noi_cap = au.getEntryByDisplayName(lstSourceNoiCap, ref cmbNoiCap).KeywordStrings[0]; DateTime ngay_cap = Convert.ToDateTime(raddtNgayCap.Value); DateTime ngay_het_han = Convert.ToDateTime(raddtNgayHetHan.Value); if (!isUpdate) { _dtSource.Rows.Add(false, grGiayToLienQuanDS.Items.Count + 1, -1, -1, loai_giay_to, txtSoGiayTo.Text.Trim(), ngay_cap.ToString("yyyyMMdd"), ngay_het_han.ToString("yyyyMMdd"), noi_cap, cmbLoaiGiayTo.Text, ngay_cap.ToString("dd/MM/yyyy"), ngay_het_han.ToString("dd/MM/yyyy"), cmbNoiCap.Text); idTuSinh = idTuSinh - 1; } else { DataRowView dr = (DataRowView)grGiayToLienQuanDS.SelectedItem; dr["GTLQ_LOAI"] = loai_giay_to; dr["GTLQ_SO"] = txtSoGiayTo.Text.Trim(); dr["GTLQ_NGAY_CAP"] = ngay_cap.ToString("yyyyMMdd"); dr["GTLQ_NGAY_HHAN"] = ngay_het_han.ToString("yyyyMMdd"); dr["GTLQ_NOI_CAP"] = noi_cap; dr["GTLQ_LOAI_TEXT"] = cmbLoaiGiayTo.Text; dr["GTLQ_NGAY_CAP_TEXT"] = ngay_cap.ToString("dd/MM/yyyy"); dr["GTLQ_NGAY_HHAN_TEXT"] = ngay_het_han.ToString("dd/MM/yyyy"); dr["GTLQ_NOI_CAP_TEXT"] = cmbNoiCap.Text; } ResetForm(); } }
/// <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> /// 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) { if (Validation()) { if (this.grDinhKhoan.GroupDescriptors.Count > 0) { this.grDinhKhoan.GroupDescriptors.RemoveAt(0); } AutoComboBox au = new AutoComboBox(); AutoCompleteEntry auDinhKhoan = au.getEntryByDisplayName(lstSourceDinhKhoan, ref cmbDinhKhoan); AutoCompleteEntry auLoaiChungTu = au.getEntryByDisplayName(lstSourceLoaiChungTu, ref cmbLoaiChungTu); 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"] = grDinhKhoan.Items.Count; dr["ID"] = -1; idTuSinh = idTuSinh - 1; } else { dr = (DataRowView)grDinhKhoan.SelectedItem; } if (dr == null) { DataRow drAdd = _dtSource.NewRow(); _dtSource.Rows.Add(drAdd); dr = _dtSource.DefaultView[_dtSource.Rows.Count - 1]; dr["CHON"] = false; dr["STT"] = grDinhKhoan.Items.Count; dr["ID"] = -1; idTuSinh = idTuSinh - 1; } dr["DINHKHOAN_MA"] = auDinhKhoan.KeywordStrings[0]; dr["DINHKHOAN_TEN"] = auDinhKhoan.DisplayName; dr["MA_PHAN_LOAI"] = txtMaPhanLoai.Text; dr["TEN_PHAN_LOAI"] = lblTenPhanLoai.Content.ToString(); dr["NHOM_DK"] = txtNhomDinhKhoan.Text; dr["CHUNGTU_MA"] = auLoaiChungTu.KeywordStrings[0]; dr["CHUNGTU_TEN"] = auLoaiChungTu.DisplayName; this.grDinhKhoan.GroupDescriptors.Add(new ColumnGroupDescriptor() { Column = this.grDinhKhoan.Columns["NHOM_DK"], SortDirection = ListSortDirection.Ascending }); ResetForm(); } }
private void TaoTreeView() { Presentation.Process.KeToanProcess process = new Presentation.Process.KeToanProcess(); AutoComboBox au = new AutoComboBox(); try { AutoCompleteEntry auDonVi = au.getEntryByDisplayName(lstSourceDonVi, ref cmbDonVi); if (auDonVi != null) { trvPhanLoai.Items.Clear(); dtMaPhanLoai = process.getDanhSachMaPhanLoai(auDonVi.KeywordStrings[0], "(''" + BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri() + "'')", BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri(), "%"); if (dtMaPhanLoai != null && dtMaPhanLoai.Tables.Count > 0) { dtMaPhanLoai.Relations.Add("Master2Detail", dtMaPhanLoai.Tables[0].Columns["ID"], dtMaPhanLoai.Tables[0].Columns["ID_PLOAI_CHA"]); DataView dv = dtMaPhanLoai.Tables[0].DefaultView; dv.RowFilter = "ID_PLOAI_CHA IS NULL"; trvPhanLoai.ItemsSource = dv; } } } catch (System.Exception ex) { LMessage.ShowMessage("M.DungChung.LoiLoadDuLieu", LMessage.MessageBoxType.Error); LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } finally { au = null; process = null; } }
/// <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 cmbNSD_SelectionChanged(object sender, SelectionChangedEventArgs e) { AutoComboBox au = new AutoComboBox(); AutoCompleteEntry auNSD = au.getEntryByDisplayName(lstSourceNguoiBanGiao, ref cmbNSD); maChucVu = auNSD.KeywordStrings[1].SplitByDelimiter("#")[0]; tenChucVu = auNSD.KeywordStrings[1].SplitByDelimiter("#")[1]; lbChucVu.Content = tenChucVu; }
/// <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); }
void LoadDulieu() { AutoComboBox au = new AutoComboBox(); try { DataTable dtBaoCao = null; AutoCompleteEntry auDonVi = au.getEntryByDisplayName(lstSourceDonVi, ref cmbDonVi); LDatatable.MakeParameterTable(ref dtBaoCao); string maPhanLoai = "("; foreach (object item in trvPhanLoai.CheckedItems) { DataRowView dr = item as DataRowView; if (dr["MA_PLOAI"].ToString().Length != 1) { maPhanLoai += "''" + dr["MA_PLOAI"].ToString() + "'',"; } } if (trvPhanLoai.CheckedItems.Count > 0) { maPhanLoai = maPhanLoai.Substring(0, maPhanLoai.Length - 1) + ")"; } else { maPhanLoai = ""; } string ngayHluc = ""; if (teldtNgayHieuLuc.Value.HasValue) { ngayHluc = teldtNgayHieuLuc.Value.GetValueOrDefault().ToString(ApplicationConstant.defaultDateTimeFormat); } LDatatable.AddParameter(ref dtBaoCao, "@MaDViTao", "STRING", auDonVi.KeywordStrings.FirstOrDefault()); LDatatable.AddParameter(ref dtBaoCao, "@MaDViQLy", "STRING", ClientInformation.MaDonViQuanLy); LDatatable.AddParameter(ref dtBaoCao, "@MaPhanLoai", "STRING", ClientInformation.MaDonViQuanLy); LDatatable.AddParameter(ref dtBaoCao, "@MaSo", "STRING", txtMaSo.Text); LDatatable.AddParameter(ref dtBaoCao, "@TenSo", "STRING", txtTenSo.Text); LDatatable.AddParameter(ref dtBaoCao, "@TinhChat", "STRING", cmbTinhChat.SelectedValue.ToString()); LDatatable.AddParameter(ref dtBaoCao, "@NgayHLuc", "STRING", ngayHluc); DataSet ds = new KeToanProcess().GetDSGhiSoKBao(dtBaoCao); DataTable dt = ds.Tables["DANH_SACH"]; grdGhiSoTKhoan.ItemsSource = dt.DefaultView; } catch (Exception ex) { } }
private void cmbTaiKhoanTK_SelectionChanged(object sender, SelectionChangedEventArgs e) { AutoComboBox auto = new AutoComboBox(); try { AutoCompleteEntry au = auto.getEntryByDisplayName(lstSourceTaiKhoanKhongKyHan, ref cmbTaiKhoanTK); if (au != null) { string[] a = au.KeywordStrings[0].Split('#'); numSoDuTaiKhoanTK.Value = Convert.ToDouble(a[0]); cmbTaiKhoanTK.Tag = a[1]; } } catch (System.Exception ex) { 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() { 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); }
/// <summary> /// Luu du lieu /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tlbSave_Click(object sender, RoutedEventArgs e) { try { if (Validation()) { AutoComboBox au = new AutoComboBox(); AutoCompleteEntry auNSD = au.getEntryByDisplayName(lstSourceNguoiBanGiao, ref cmbNSD); if (DuLieuTraVe != null) { List <TS_BAN_GIAO_CT_GIAO_NHAN> list = new List <TS_BAN_GIAO_CT_GIAO_NHAN>(); TS_BAN_GIAO_CT_GIAO_NHAN nbg = new TS_BAN_GIAO_CT_GIAO_NHAN(); nbg.MA_HSO = auNSD.KeywordStrings.First(); nbg.TEN_HSO = auNSD.DisplayName; if (rbBenGiao.IsChecked == true) { nbg.DAI_DIEN = "Bên giao"; } else if (rbBenNhan.IsChecked == true) { nbg.DAI_DIEN = "Bên nhận"; } else if (rbKhac.IsChecked == true) { nbg.DAI_DIEN = txtDaiDienKhac.Text; } nbg.MA_CHUC_VU = maChucVu; nbg.TEN_CHUC_VU = tenChucVu; list.Add(nbg); DuLieuTraVe(list); } CustomControl.CommonFunction.CloseUserControl(this); } } catch (Exception ex) { LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } }
/// <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) { if (Validation()) { AutoComboBox au = new AutoComboBox(); AutoCompleteEntry auViTri = au.getEntryByDisplayName(lstSourceViTri, ref cmbViTri); if (!isUpdate) { _dtSource.Rows.Add(false, grNguoiDaiDien.Items.Count + 1, idTuSinh + 1, -1, txtHoTen.Text.Trim(), auViTri.DisplayName, auViTri.KeywordStrings[0], txtDienThoai.Text); //idTuSinh = idTuSinh - 1; } else { DataRowView dr = (DataRowView)grNguoiDaiDien.SelectedItem; dr["DDIEN_HO_TEN"] = txtHoTen.Text.Trim(); dr["DDIEN_VI_TRI_TEN"] = auViTri.DisplayName; dr["DDIEN_VI_TRI"] = auViTri.KeywordStrings[0]; dr["DDIEN_DTHOAI"] = txtDienThoai.Text.Trim(); } ResetForm(); } }
/// <summary> /// Kiem tra du lieu truoc khi luu /// </summary> /// <returns></returns> private bool Validation() { AutoComboBox au = new AutoComboBox(); AutoCompleteEntry auNSD = au.getEntryByDisplayName(lstSourceNguoiBanGiao, ref cmbNSD); if (auNSD == null) { CommonFunction.ThongBaoTrong("Chưa chọn người sử dụng"); cmbNSD.Focus(); return(false); } else if (rbBenGiao.IsChecked == false && rbBenNhan.IsChecked == false && rbKhac.IsChecked == false) { CommonFunction.ThongBaoTrong("Chưa chọn đại diện"); return(false); } else if (rbKhac.IsChecked == true && txtDaiDienKhac.Text.IsNullOrEmptyOrSpace()) { CommonFunction.ThongBaoTrong("Chưa nhập thông tin đại diện khác"); 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) { if (Validation()) { AutoComboBox au = new AutoComboBox(); string moi_quan_he = au.getEntryByDisplayName(lstSourceMoiQuanHe, ref cmbMoiQuanHe).KeywordStrings[0]; if (!isUpdate) { _dtSource.Rows.Add(false, grKhachHang.Items.Count + 1, idTuSinh - 1, -1, txtMaKhachHang.Text.Trim(), moi_quan_he, lblTenKhachHang.Content, cmbMoiQuanHe.Text); idTuSinh = idTuSinh - 1; } else { DataRowView dr = (DataRowView)grKhachHang.SelectedItem; dr["KHLQ_MA"] = txtMaKhachHang.Text.Trim(); dr["KHLQ_TEN"] = lblTenKhachHang.Content; dr["KHLQ_MOI_QUAN_HE"] = moi_quan_he; dr["KHLQ_MOI_QUAN_HE_TEXT"] = cmbMoiQuanHe.Text; } ResetForm(); } }
/// <summary> /// Tìm kiếm nâng cao /// </summary> private void TimKiem() { AutoComboBox au = new AutoComboBox(); AutoCompleteEntry auLyDo = au.getEntryByDisplayName(lstSourceLyDoRa, ref cmbLyDoRaKhoiNhom); AutoCompleteEntry auLoaiGiayTo = au.getEntryByDisplayName(lstSourceLoaiGiayTo, ref cmbLoaiGiayTo); Mouse.OverrideCursor = Cursors.Wait; DataTable dt = null; LDatatable.MakeParameterTable(ref dt); // Lay du lieu treeview cho tim kiem string ma_don_vi = "-1"; string ma_khu_vuc = "-1"; string ma_cum = "-1"; string ma_nhom = "-1"; if (tvwKhachHangDS.SelectedItem != null) { RadTreeViewItem item = tvwKhachHangDS.SelectedItem as RadTreeViewItem; string level = item.Tag.ToString().Split('#')[0]; string[] path = item.Tag.ToString().Split('#')[1].Split('/'); string type = item.Tag.ToString().Split('#')[2]; if (type == "DVI") { ma_don_vi = path[path.Length - 1]; } else { ma_don_vi = path[0]; //ma_khu_vuc = path[1]; //ma_cum = path[1]; if (type == "KVUC") { ma_khu_vuc = path[1]; } if (type == "CUM") { if (path.Length > 2) { ma_cum = path[2]; } else { ma_cum = path[1]; } } if (type == "NHOM") { if (path.Length > 3) { ma_nhom = path[3]; } else { ma_nhom = path[2]; } } } } if (ucTrangThaiNVu.GetItemsSelected() == "NULL") { LDatatable.AddParameter(ref dt, "@TrangThaiNghiepVu", "STRING", ""); } else { LDatatable.AddParameter(ref dt, "@TrangThaiNghiepVu", "STRING", ucTrangThaiNVu.GetItemsSelected()); } LDatatable.AddParameter(ref dt, "@IdDonVi", "INT", ma_don_vi); LDatatable.AddParameter(ref dt, "@IdKhuVuc", "INT", ma_khu_vuc); LDatatable.AddParameter(ref dt, "@IdCum", "INT", ma_cum); LDatatable.AddParameter(ref dt, "@IdNhom", "INT", ma_nhom); LDatatable.AddParameter(ref dt, "@SoGD", "STRING", txtSoGD.Text); if (raddtTuNgayGD.Value != null) { LDatatable.AddParameter(ref dt, "@NgayGDTu", "STRING", txtMaKH.Text); } else { LDatatable.AddParameter(ref dt, "@NgayGDTu", "STRING", ""); } if (raddtDenNgayGD.Value != null) { LDatatable.AddParameter(ref dt, "@NgayGDDen", "STRING", txtMaKH.Text); } else { LDatatable.AddParameter(ref dt, "@NgayGDDen", "STRING", ""); } if (auLyDo != null) { LDatatable.AddParameter(ref dt, "@LyDo", "STRING", auLyDo.KeywordStrings[0]); } else { LDatatable.AddParameter(ref dt, "@LyDo", "STRING", ""); } LDatatable.AddParameter(ref dt, "@MaKhang", "STRING", txtMaKH.Text); LDatatable.AddParameter(ref dt, "@TenKhang", "STRING", txtTenKH.Text); if (auLoaiGiayTo != null) { LDatatable.AddParameter(ref dt, "@LoaiGTO", "STRING", txtMaKH.Text); } else { LDatatable.AddParameter(ref dt, "@LoaiGTO", "STRING", ""); } LDatatable.AddParameter(ref dt, "@SoGTO", "STRING", txtSoGiayTo.Text); LDatatable.AddParameter(ref dt, "@Email", "STRING", txtEmail.Text); LDatatable.AddParameter(ref dt, "@SoDThoai", "STRING", txtDienThoai.Text); LDatatable.AddParameter(ref dt, "@TenDangNhap", "STRING", ClientInformation.TenDangNhap); LDatatable.AddParameter(ref dt, "@DonViQLy", "STRING", ClientInformation.MaDonViQuanLy); // Tim kiem Presentation.Process.KhachHangProcess process = new Presentation.Process.KhachHangProcess(); DataSet ds = process.getChuyenDiaBanDS(dt); if (ds != null && ds.Tables.Count > 0) { grKhachHangDS.ItemsSource = ds.Tables[0].DefaultView; if (!LObject.IsNullOrEmpty(grKhachHangDS.SelectedItems)) { grKhachHangDS.SelectedItems.Clear(); } lblSumDonVi.Content = ds.Tables[0].Rows.Count.ToString(); } Mouse.OverrideCursor = Cursors.Arrow; }
private void GetDataOnForm(ref DANH_SACH_KHE_UOC_VONG_VAY obj) { List <Presentation.Process.TinDungServiceRef.DANH_SACH_SO> lstRutTien = new List <Presentation.Process.TinDungServiceRef.DANH_SACH_SO>(); List <Presentation.Process.TinDungServiceRef.DANH_SACH_SO> lstNopTien = new List <Presentation.Process.TinDungServiceRef.DANH_SACH_SO>(); if (_kheUoc.DSACH_SO_NOP_TIEN != null) { _kheUoc.DSACH_SO_NOP_TIEN = null; } if (_kheUoc.DSACH_SO_RUT_TIEN != null) { _kheUoc.DSACH_SO_RUT_TIEN = null; } if (chkNopBangTienMat.IsChecked == true) { _kheUoc.THUC_THU_TIEN_MAT = Convert.ToDecimal(numTienMat.Value); } if (chkTKTietKiemKhongKyHan.IsChecked == true) { _kheUoc.NOP_TIEN_TU_TKKKH = "CO"; AutoComboBox auto = new AutoComboBox(); AutoCompleteEntry au = auto.getEntryByDisplayName(lstSourceTaiKhoanKhongKyHan, ref cmbTaiKhoanTK); Presentation.Process.TinDungServiceRef.DANH_SACH_SO objRutTK = new Presentation.Process.TinDungServiceRef.DANH_SACH_SO(); objRutTK.SO_SO = au.DisplayName; objRutTK.SO_TAI_KHOAN = cmbTaiKhoanTK.Tag.ToString(); objRutTK.SO_DU = Convert.ToDecimal(numSoDuTaiKhoanTK.Value); objRutTK.SO_TIEN_RUT_RA = Convert.ToDecimal(numSoTienRutTuTK.Value); lstRutTien.Add(objRutTK); } else { _kheUoc.NOP_TIEN_TU_TKKKH = "KHONG"; } if (chkTKKhongKyHanTienThua.IsChecked == false) { _kheUoc.NOP_TIEN_VAO_TKKKH = "KHONG"; } else { _kheUoc.NOP_TIEN_VAO_TKKKH = "CO"; DataTable dt = ((DataView)grTKKhongKyHanTienThua.ItemsSource).Table; foreach (DataRow dr in dt.Rows) { if (!dr["so_so_tg"].ToString().Equals(obj.SO_SO_TG)) { Presentation.Process.TinDungServiceRef.DANH_SACH_SO objNopTK = new Presentation.Process.TinDungServiceRef.DANH_SACH_SO(); if (!dr["so_so_tg"].ToString().Equals(_kheUoc.SO_SO_TG)) { objNopTK.SO_SO = dr["so_so_tg"].ToString(); objNopTK.SO_TAI_KHOAN = dr["so_tai_khoan"].ToString(); objNopTK.SO_DU = Convert.ToDecimal(dr["so_tien"]); objNopTK.SO_TIEN_NOP_VAO = Convert.ToDecimal(dr["so_tien_nop"]); lstNopTien.Add(objNopTK); obj.THUC_THU_NOP_VAO_TKKKH += Convert.ToDecimal(dr["so_tien_nop"]); } } else { obj.THUC_THU_TKQD += Convert.ToDecimal(dr["so_tien_nop"]); } } } //if (chkGhiTKNoiBo.IsChecked == false) //{ _kheUoc.GHI_NHAN_VAO_TKNB = "KHONG"; //} //else //{ // _kheUoc.GHI_NHAN_VAO_TKNB = "CO"; //} if (chkTraTruocHan.IsChecked == false) { _kheUoc.TRA_GOC_LAI_TRUOC_HAN = "KHONG"; } else { _kheUoc.TRA_GOC_LAI_TRUOC_HAN = "CO"; _kheUoc.TONG_TIEN_TRA_TRUOC = Convert.ToDecimal(numSoTienNop.Value); } if (lstNopTien != null && lstNopTien.Count > 0) { obj.DSACH_SO_NOP_TIEN = lstNopTien.ToArray(); } if (lstRutTien != null && lstRutTien.Count > 0) { obj.DSACH_SO_RUT_TIEN = lstRutTien.ToArray(); } _kheUoc.PHI_TRA_TRUOC = Convert.ToDecimal(numPhiTraTruoc.Value); PhanBoSoTienThuDuoc(); }
/// <summary> /// Tìm kiếm nâng cao /// </summary> private void TimKiem() { string maPhanLoai = "("; string tthaiNvu = ""; foreach (object item in trvPhanLoai.CheckedItems) { DataRowView dr = (DataRowView)item; maPhanLoai += dr["MA_PLOAI"] + ","; } if (trvPhanLoai.CheckedItems.Count > 0) { maPhanLoai = maPhanLoai.Substring(0, maPhanLoai.Length - 1) + ")"; } else { maPhanLoai = ""; } if (ucTrangThaiNVu.GetItemsSelected() != "NULL") { tthaiNvu = ucTrangThaiNVu.GetItemsSelected(); } else { tthaiNvu = ""; } KeToanProcess process = new KeToanProcess(); AutoComboBox au = new AutoComboBox(); Mouse.OverrideCursor = Cursors.Wait; try { AutoCompleteEntry auDonVi = au.getEntryByDisplayName(lstSourceDonVi, ref cmbDonVi); DataSet ds = process.getDanhSachMaPhanLoai(auDonVi.KeywordStrings[0], tthaiNvu, BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri(), maPhanLoai); raddgrPhanLoaiTK.ItemsSource = null; if (ds != null && ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { dr["TRANG_THAI"] = BusinessConstant.layNgonNguNghiepVu(dr["TTHAI_NVU"].ToString()); dr["TCHAT_CNO"] = BusinessConstant.layNgonNguTuGiaTri(dr["MA_TCHAT_CNO"].ToString(), "CO_KHONG"); } raddgrPhanLoaiTK.ItemsSource = ds.Tables[0].DefaultView; lblSum.Content = ds.Tables[0].Rows.Count.ToString("#"); } else { raddgrPhanLoaiTK.ItemsSource = null; lblSum.Content = 0; } } catch (System.Exception ex) { LMessage.ShowMessage("M.DungChung.LoiLoadDuLieu", LMessage.MessageBoxType.Error); LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } finally { process = null; au = null; } Mouse.OverrideCursor = Cursors.Arrow; }
/// <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 radpage_PageIndexChanged(object sender, PageIndexChangedEventArgs e) //{ // if (e.NewPageIndex < radpage.PageCount) // { // CurrentPagging = e.NewPageIndex + 1; // StartRow = (CurrentPagging - 1) * PaggingSize + 1; // EndRow = StartRow + PaggingSize; // //radpage = new RadDataPager(); // TimKiemPhanTrang(); // } //} /// <summary> /// Tìm kiếm phân trang /// </summary> private void TimKiemPhanTrang() { Mouse.OverrideCursor = Cursors.Wait; DataTable dt = null; LDatatable.MakeParameterTable(ref dt); // Lay du lieu treeview cho tim kiem string ma_don_vi = "-1"; string ma_khu_vuc = "-1"; string ma_cum = "-1"; string ma_nhom = "-1"; if (tvwKhachHangDS.SelectedItem != null) { RadTreeViewItem item = tvwKhachHangDS.SelectedItem as RadTreeViewItem; string level = item.Tag.ToString().Split('#')[0]; string[] path = item.Tag.ToString().Split('#')[1].Split('/'); string type = item.Tag.ToString().Split('#')[2]; if (type == "DVI") { ma_don_vi = path[path.Length - 1]; } else { ma_don_vi = path[0]; //ma_khu_vuc = path[1]; //ma_cum = path[1]; if (type == "KVUC") { ma_khu_vuc = path[1]; } if (type == "CUM") { if (path.Length > 2) { ma_cum = path[2]; } else { ma_cum = path[1]; } } if (type == "NHOM") { if (path.Length > 3) { ma_nhom = path[3]; } else { ma_nhom = path[2]; } } } } // Thong tin ngay gia nhap if (raddtTuNgayGiaNhap.Value != null) { LDatatable.AddParameter(ref dt, "@NgayGiaNhapTu", "STRING", Convert.ToDateTime(raddtTuNgayGiaNhap.Value).ToString("yyyyMMdd")); } else { LDatatable.AddParameter(ref dt, "@NgayGiaNhapTu", "STRING", ""); } if (raddtDenNgayGiaNhap.Value != null) { LDatatable.AddParameter(ref dt, "@NgayGiaNhapDen", "STRING", Convert.ToDateTime(raddtDenNgayGiaNhap.Value).ToString("yyyyMMdd")); } else { LDatatable.AddParameter(ref dt, "@NgayGiaNhapDen", "STRING", ""); } // Lay du lieu tu cac combobox AutoComboBox au = new AutoComboBox(); AutoCompleteEntry nganhKT = au.getEntryByDisplayName(lstSourceNganhKinhTe, ref cmbNganhKT); AutoCompleteEntry loaihinhToChuc = au.getEntryByDisplayName(lstSourceLoaiHinhToChuc, ref cmbLoaiHinhToChuc); AutoCompleteEntry loaiKhachHang = au.getEntryByDisplayName(lstSourceLoaiKhachHang, ref cmbLoaiKhachHang); if (nganhKT != null) { LDatatable.AddParameter(ref dt, "@NganhKT", "STRING", nganhKT.KeywordStrings[0]); } else { LDatatable.AddParameter(ref dt, "@NganhKT", "STRING", ""); } if (loaihinhToChuc != null) { LDatatable.AddParameter(ref dt, "@LoaiHinhToChuc", "STRING", loaihinhToChuc.KeywordStrings[0]); } else { LDatatable.AddParameter(ref dt, "@LoaiHinhToChuc", "STRING", ""); } if (loaiKhachHang != null) { LDatatable.AddParameter(ref dt, "@LoaiKhachHang", "STRING", loaiKhachHang.KeywordStrings[0]); } else { LDatatable.AddParameter(ref dt, "@LoaiKhachHang", "STRING", ""); } // Them du lieu vao tim kiem if (ucTrangThaiNVu.GetItemsSelected() == "NULL") { LDatatable.AddParameter(ref dt, "@TrangThaiNghiepVu", "STRING", ""); } else { LDatatable.AddParameter(ref dt, "@TrangThaiNghiepVu", "STRING", ucTrangThaiNVu.GetItemsSelected()); } LDatatable.AddParameter(ref dt, "@MaKhachHang", "STRING", txtMaKH.Text); LDatatable.AddParameter(ref dt, "@TenKhachHang", "STRING", txtTenKH.Text); LDatatable.AddParameter(ref dt, "@DkienMPA", "STRING", ""); if (cmbDanToc.SelectedIndex >= 0) { LDatatable.AddParameter(ref dt, "@DanToc", "STRING", lstSourceDanToc.ElementAt(cmbDanToc.SelectedIndex).KeywordStrings.First()); } else { LDatatable.AddParameter(ref dt, "@DanToc", "STRING", ""); } if (cmbGioiTinh.SelectedIndex >= 0) { LDatatable.AddParameter(ref dt, "@GioiTinh", "STRING", lstSourceGioiTinh.ElementAt(cmbGioiTinh.SelectedIndex).KeywordStrings.First()); } else { LDatatable.AddParameter(ref dt, "@GioiTinh", "STRING", ""); } if (cmbLHCongTac.SelectedIndex >= 0) { LDatatable.AddParameter(ref dt, "@NgheNghiep", "STRING", lstSourceLHinhCongTac.ElementAt(cmbLHCongTac.SelectedIndex).KeywordStrings.First()); } else { LDatatable.AddParameter(ref dt, "@NgheNghiep", "STRING", ""); } LDatatable.AddParameter(ref dt, "@TuoiTu", "STRING", Convert.ToInt32(numTuoiTu.Value).ToString()); LDatatable.AddParameter(ref dt, "@TuoiDen", "STRING", Convert.ToInt32(numTuoiDen.Value).ToString()); LDatatable.AddParameter(ref dt, "@NgayHienTai", "STRING", ClientInformation.NgayLamViecHienTai); LDatatable.AddParameter(ref dt, "@SoCMND", "STRING", txtCMND.Text); LDatatable.AddParameter(ref dt, "@SoDkyKDoanh", "STRING", txtSoDKKD.Text); LDatatable.AddParameter(ref dt, "@TenDangNhap", "STRING", ClientInformation.TenDangNhap); LDatatable.AddParameter(ref dt, "@DonViQLy", "STRING", ClientInformation.MaDonViQuanLy); LDatatable.AddParameter(ref dt, "@DonVi", "INT", ma_don_vi); LDatatable.AddParameter(ref dt, "@KhuVuc", "INT", ma_khu_vuc); LDatatable.AddParameter(ref dt, "@Cum", "INT", ma_cum); LDatatable.AddParameter(ref dt, "@Nhom", "INT", ma_nhom); LDatatable.AddParameter(ref dt, "@StartRow", "INT", StartRow.ToString()); LDatatable.AddParameter(ref dt, "@EndRow", "INT", EndRow.ToString()); // Tim kiem Presentation.Process.KhachHangProcess process = new Presentation.Process.KhachHangProcess(); DataSet ds = process.getKetQuaTimKiemNangCao(dt); if (ds != null && ds.Tables.Count > 0) { DataTable serverDataTable = ds.Tables[0]; int totalRecord = Int32.Parse(ds.Tables[1].Rows[0][0].ToString()); DataTable clientDataTable = CommonFunction.BuildClientDataTable(serverDataTable, CurrentPagging, PaggingSize, totalRecord); //grKhachHangDS.ItemsSource = ds.Tables[0].DefaultView; //lblSumKhachHang.Content = ds.Tables[0].Rows.Count.ToString(); lblSumKhachHang.Content = totalRecord; //radpage.Source = ds.Tables[0].DefaultView; //radpage = new RadDataPager(); //radpage.Source = clientDataTable.DefaultView; //radpage.PageSize = PaggingSize; //radpage.PageIndex = CurrentPagging - 1; //grKhachHangDS.ItemsSource = radpage.PagedSource; grKhachHangDS.ItemsSource = null; grKhachHangDS.ItemsSource = clientDataTable.DefaultView; if (!LObject.IsNullOrEmpty(grKhachHangDS.SelectedItem)) { grKhachHangDS.SelectedItems.Clear(); } } Mouse.OverrideCursor = Cursors.Arrow; }
/// <summary> /// Tìm kiếm nâng cao /// </summary> private void TimKiem() { Mouse.OverrideCursor = Cursors.Wait; KeToanProcess process = new KeToanProcess(); AutoComboBox au = new AutoComboBox(); try { if (cmbDonVi.SelectedIndex < 0) { return; } AutoCompleteEntry auDonVi = au.getEntryByDisplayName(lstSourceDonVi, ref cmbDonVi); string maDonVi = "("; string ngayDL = ""; string maPhanLoai = "("; string tinhChatTK = ""; string maChon = lstSourceDonVi.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings.ElementAt(0); string donVi = ""; foreach (AutoCompleteEntry item in lstSourceDonVi) { donVi = item.KeywordStrings.ElementAt(0); if (donVi.Contains(maChon)) { maDonVi += "''" + donVi + "'',"; } } maDonVi = maDonVi.Substring(0, maDonVi.Length - 1) + ")"; foreach (object item in trvPhanLoai.CheckedItems) { DataRowView dr = item as DataRowView; if (dr["MA_PLOAI"].ToString().Length != 1) { maPhanLoai += "''" + dr["MA_PLOAI"].ToString() + "'',"; } } if (trvPhanLoai.CheckedItems.Count > 0) { maPhanLoai = maPhanLoai.Substring(0, maPhanLoai.Length - 1) + ")"; } else { maPhanLoai = ""; } if (raddtSoDuNgay.Value != null) { ngayDL = Convert.ToDateTime(raddtSoDuNgay.Value).ToString("yyyyMMdd"); } DataTable dtThamSo = null; LDatatable.MakeParameterTable(ref dtThamSo); LDatatable.AddParameter(ref dtThamSo, "@MaDonVi", "STRING", maDonVi); LDatatable.AddParameter(ref dtThamSo, "@MaPhanLoai", "STRING", maPhanLoai); LDatatable.AddParameter(ref dtThamSo, "@MaTK", "STRING", txtMaPhanLoaiTK.Text); LDatatable.AddParameter(ref dtThamSo, "@TenTK", "STRING", ""); LDatatable.AddParameter(ref dtThamSo, "@NgayDL", "STRING", ngayDL); LDatatable.AddParameter(ref dtThamSo, "@SoDuTu", "DECIMAL", "0"); LDatatable.AddParameter(ref dtThamSo, "@SoDuDen", "DECIMAL", "0"); LDatatable.AddParameter(ref dtThamSo, "@TinhChat", "STRING", tinhChatTK); DataSet ds = process.getDanhSachTaiKhoanChiTiet(dtThamSo, "DANH_SACH"); raddgrDanhSachTK.ItemsSource = null; if (ds != null && ds.Tables.Count > 0) { raddgrDanhSachTK.ItemsSource = ds.Tables[0].DefaultView; lblSumSoTK.Content = ds.Tables[0].Rows.Count.ToString("###,###,###"); decimal tongSoDu = 0; foreach (DataRow dr in ds.Tables[0].Rows) { tongSoDu += Convert.ToDecimal(dr["SODU"]); } lblSumSoDu.Content = tongSoDu.ToString("###,###,###,###,###,###"); } } catch (System.Exception ex) { LMessage.ShowMessage("M.DungChung.LoiLoadDuLieu", LMessage.MessageBoxType.Error); LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex); } finally { process = null; au = null; } Mouse.OverrideCursor = Cursors.Arrow; }