/// <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); }
/// <summary> /// Lưu dữ liệu (hay trình duyệt) /// </summary> private void onSave() { string trangThai = CommonFunction.LayTrangThaiBanGhi(DatabaseConstant.Action.LUU, BusinessConstant.layTrangThaiNghiepVu(tthaiNvu)); if (Validation()) { DanhMucProcess danhMucProcess = new DanhMucProcess(); try { // Dữ liệu truyền vào và dữ liệu trả về DC_TSUAT obj = new DC_TSUAT(); DC_TSUAT ret = null; // Nếu là lưu tạm hoặc thêm mới lần đầu if (Id == 0) { // Lấy dữ liệu từ form GetFormData(ref obj); obj.TTHAI_NVU = trangThai; // Set các thông tin khác obj.TTHAI_BGHI = BusinessConstant.TrangThaiSuDung.SU_DUNG.layGiaTri(); obj.NGUOI_NHAP = ClientInformation.TenDangNhap; obj.NGAY_NHAP = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat); ret = danhMucProcess.ThemTanSuat(obj); afterAddNew(ret); } // Nếu là lưu tạm khi sửa // Hoặc lưu tạm khi sửa sau duyệt // Hoặc sửa else { // Lấy thông tin cũ obj = danhMucProcess.getTanSuatById(Id); // Lấy dữ liệu từ form GetFormData(ref obj); obj.TTHAI_NVU = trangThai; ret = danhMucProcess.SuaTanSuat(obj); afterModify(ret); } } catch (System.Exception ex) { this.Cursor = Cursors.Arrow; CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } finally { danhMucProcess = null; } } }
/// <summary> /// Đưa các control của form về trạng thái mặc định /// </summary> private void ResetForm() { isUpdate = false; txtSoGiayTo.Text = ""; raddtNgayCap.Value = LDateTime.GetCurrentDate(); raddtNgayHetHan.Value = LDateTime.GetCurrentDate(); cmbLoaiGiayTo.SelectedIndex = 0; cmbNoiCap.SelectedIndex = 0; cmbLoaiGiayTo.Focus(); }
/// <summary> /// Đưa dữ liệu từ form vào object DC_TSUAT /// </summary> private void GetFormData(ref DC_TSUAT obj) { obj.MA_TSUAT = txtMa.Text; obj.TEN_TSUAT = txtTen.Text; obj.TSUAT_LAN = Convert.ToInt32(nudLan.Value); obj.TSUAT_TGIAN_SLUONG = Convert.ToInt32(nudThoiGian.Value); obj.TSUAT_TGIAN_DVI_TINH = lstSourceTanSuat.ElementAt(cmbLoaiThoiGian.SelectedIndex).KeywordStrings.First(); obj.NGAY_NHAP = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat); obj.MA_DVI_QLY = ClientInformation.MaDonVi; obj.MA_DVI_TAO = ClientInformation.MaDonVi; obj.NGUOI_NHAP = ClientInformation.TenDangNhap; return; }
/// <summary> /// Lay du lieu tu control dieu khien dua vao object /// </summary> /// <param name="obj"></param> /// <param name="banghi"></param> /// <param name="nghiepvu"></param> void LayDuLieu(ref Presentation.Process.DanhMucServiceRef.DM_TINH_TP obj, BusinessConstant.TrangThaiBanGhi banghi, BusinessConstant.TrangThaiNghiepVu nghiepvu) { obj.MA_TINHTP = txtMaSo.Text; obj.TEN_TINHTP = txtTenDayDu.Text; obj.TEN_TAT = txtTenTat.Text; obj.ID_VUNG_MIEN = int.Parse(IdVung); obj.NGAY_NHAP = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat); obj.MA_DVI_QLY = ClientInformation.MaDonVi; obj.MA_DVI_TAO = ClientInformation.MaDonVi; obj.NGUOI_NHAP = ClientInformation.TenDangNhap; obj.TTHAI_BGHI = BusinessConstant.layGiaTri(banghi); obj.TTHAI_NVU = BusinessConstant.layGiaTri(nghiepvu); }
/// <summary> /// Lay du lieu tu control dieu khien dua vao object /// </summary> /// <param name="obj"></param> /// <param name="banghi"></param> /// <param name="nghiepvu"></param> void LayDuLieu(ref Presentation.Process.DanhMucServiceRef.DC_TSUAT obj, BusinessConstant.TrangThaiBanGhi banghi, BusinessConstant.TrangThaiNghiepVu nghiepvu) { obj.MA_TSUAT = txtMa.Text; obj.TEN_TSUAT = txtTen.Text; obj.TSUAT_LAN = Convert.ToInt32(nudLan.Value); obj.TSUAT_TGIAN_SLUONG = Convert.ToInt32(nudThoiGian.Value); obj.TSUAT_TGIAN_DVI_TINH = lstSourceTanSuat.ElementAt(cmbLoaiThoiGian.SelectedIndex).KeywordStrings.First(); obj.NGAY_NHAP = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat); obj.MA_DVI_QLY = ClientInformation.MaDonVi; obj.MA_DVI_TAO = ClientInformation.MaDonVi; obj.NGUOI_NHAP = ClientInformation.TenDangNhap; obj.TTHAI_BGHI = BusinessConstant.layGiaTri(banghi); obj.TTHAI_NVU = BusinessConstant.layGiaTri(nghiepvu); }
public ucNhomKhachHangCT() { InitializeComponent(); //HeThong hethong = new HeThong(); //hethong.DuyetQuyenTinhNangToolbar("/PresentationWPF.KhachHang;component/NhomKhachHang/ucNhomKhachHangCT.xaml", ref Toolbar, ref mnuMain); //foreach (var item in mnuMain.Items) //{ // if (item is MenuItem) // ((MenuItem)item).Click += btnShortcutKey_Click; //} txtMaNhom.Focus(); lblTenCum.Content = ""; raddtNgayTao.Value = LDateTime.GetCurrentDate(); dtpNgayTao.SelectedDate = raddtNgayTao.Value = LDateTime.GetCurrentDate(); }
public void getObjectValue(DatabaseConstant.Action action) { Mouse.OverrideCursor = Cursors.Wait; try { obj.GIA_TRI = txtGiaTri.Text; obj.NGAY_CNHAT = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat); obj.NGUOI_CNHAT = ClientInformation.TenDangNhap; } catch (System.Exception ex) { CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } Mouse.OverrideCursor = Cursors.Arrow; }
public ucNhomKhachHangDS() { InitializeComponent(); //HeThong hethong = new HeThong(); //hethong.DuyetQuyenTinhNangToolbar("/PresentationWPF.KhachHang;component/NhomKhachHang/ucNhomKhachHangDS.xaml", ref Toolbar, ref mnuGrid); //foreach (var item in mnuGrid.Items) //{ // if (item is MenuItem) // ((MenuItem)item).Click += btnShortcutKey_Click; //} BindHotkey(); radPage.PageSize = (int)nudPageSize.Value; LoadDuLieu(); raddtTuNgayCapNhat.Value = LDateTime.GetCurrentDate(); raddtDenNgayCapNhat.Value = LDateTime.GetCurrentDate(); dtpNgayCapNhatTu.SelectedDate = LDateTime.GetCurrentDate(); dtpNgayCapNhatDen.SelectedDate = LDateTime.GetCurrentDate(); }
/// <summary> /// Sự kiện ClearForm khi chọn thêm mới nhiều lần /// </summary> void ClearForm() { HeThong hethong = new HeThong(); hethong.DuyetQuyenTinhNangToolbar("/PresentationWPF.DanhMuc;component/TienTe/ucTienTeCT.xaml", ref Toolbar, ref mnuMain); foreach (var item in mnuMain.Items) { if (item is MenuItem) { ((MenuItem)item).Click += btnShortcutKey_Click; } } txtMaSo.Text = ""; txtTenTat.Text = ""; txtNgayLap.Value = LDateTime.GetCurrentDate(); txtNgayDuyet.Value = null; txtNguoiLap.Text = ClientInformation.TenDangNhap; txtNguoiDuyet.Text = ""; txtTrangThaiBanGhi.Text = BusinessConstant.TrangThaiBanGhi.SU_DUNG.ToString(); lblTrangThai.Content = BusinessConstant.TrangThaiNghiepVu.CHO_DUYET.ToString(); }
/// <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); } }