Ejemplo n.º 1
0
        public void OnSave()
        {
            try
            {
                if (!Validation())
                {
                    return;
                }

                string trangThai = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();

                obj = new DM_CUM();

                GetFormData(ref obj, trangThai);

                if (action == DatabaseConstant.Action.THEM)
                {
                    OnAddNew(obj);
                }
                else if (action == DatabaseConstant.Action.SUA)
                {
                    OnModify(obj);
                }
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
Ejemplo n.º 2
0
        public void AfterAddNew(bool ret, DM_CUM obj, List <ClientResponseDetail> listClientResponseDetail)
        {
            try
            {
                if (ret)
                {
                    LMessage.ShowMessage("M.DungChung.ThemThanhCong", LMessage.MessageBoxType.Information);

                    if (chkThemNhieuLan.IsChecked == true)
                    {
                        BeforeAddNew();
                    }
                    else
                    {
                        id            = obj.ID;
                        txtMaCum.Text = obj.MA_CUM;

                        sTrangThaiNVu           = obj.TTHAI_NVU;
                        lblTrangThai.Content    = BusinessConstant.layNgonNguNghiepVu(sTrangThaiNVu);
                        txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);

                        BeforeViewFromDetail();
                    }
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Ejemplo n.º 3
0
        private void ResetForm()
        {
            sTrangThaiNVu        = "";
            lblTrangThai.Content = "";
            id          = 0;
            idCumTruong = 0;
            obj         = null;

            #region Thông tin chung
            txtMaCum.Text                = "";
            txtTenCum.Text               = "";
            txtTenTat.Text               = "";
            raddtNgayThanhLap.Value      = LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd");
            chkCumTruongLaKHTV.IsChecked = true;
            txtCumTruong.Text            = "";
            txtTenCumTruong.Text         = "";
            #endregion

            #region Thông tin kiểm soát
            txtTrangThaiBanGhi.Text = "";
            raddtNgayLap.Value      = LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd");
            txtNguoiLap.Text        = ClientInformation.TenDangNhap;
            raddtNgayCapNhat.Value  = null;
            txtNguoiCapNhat.Text    = "";
            #endregion
        }
Ejemplo n.º 4
0
        private void GetFormData(ref DM_CUM obj, string sTrangThaiNVu)
        {
            try
            {
                obj = new DM_CUM();

                obj.ID      = id;
                obj.ID_DVI  = Convert.ToInt32(lstSourcePhongGiaoDich.ElementAt(cmbPhongGiaoDich.SelectedIndex).KeywordStrings.ElementAt(1));
                obj.ID_KVUC = Convert.ToInt32(lstSourceKhuVuc.ElementAt(cmbKhuVuc.SelectedIndex).KeywordStrings.ElementAt(1));
                obj.MA_CUM  = txtMaCum.Text;
                obj.MA_KVUC = lstSourceKhuVuc.ElementAt(cmbKhuVuc.SelectedIndex).KeywordStrings.First();
                obj.MA_DVI  = lstSourcePhongGiaoDich.ElementAt(cmbPhongGiaoDich.SelectedIndex).KeywordStrings.First();
                if (raddtNgayThanhLap.Value != null)
                {
                    obj.NGAY_TLAP = Convert.ToDateTime(raddtNgayThanhLap.Value).ToString("yyyyMMdd");
                }
                obj.TEN_CUM       = txtTenCum.Text;
                obj.TEN_TAT       = txtTenTat.Text;
                obj.ID_CBO_QLY    = Convert.ToInt32(lstSourceCBQL.ElementAt(cmbCBQL.SelectedIndex).KeywordStrings.ElementAt(1));
                obj.MA_CBO_QLY    = lstSourceCBQL.ElementAt(cmbCBQL.SelectedIndex).KeywordStrings.First();
                obj.ID_CUM_TRUONG = idCumTruong;
                obj.MA_CUM_TRUONG = txtCumTruong.Text;
                if (chkCumTruongLaKHTV.IsChecked == true)
                {
                    obj.LOAI_CUM_TRUONG = "KHTV";
                }
                else
                {
                    obj.LOAI_CUM_TRUONG = "CONG_TAC_VIEN";
                }

                //Thông tin kiểm soát
                obj.TTHAI_BGHI = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri();
                obj.TTHAI_NVU  = sTrangThaiNVu;
                obj.MA_DVI_QLY = lstSourceChiNhanh.ElementAt(cmbChiNhanh.SelectedIndex).KeywordStrings.First();
                obj.MA_DVI_TAO = obj.MA_DVI;
                obj.NGAY_NHAP  = Convert.ToDateTime(raddtNgayLap.Value).ToString("yyyyMMdd");
                obj.NGUOI_NHAP = txtNguoiLap.Text;
                if (action != DatabaseConstant.Action.THEM)
                {
                    obj.NGAY_CNHAT  = ClientInformation.NgayLamViecHienTai;
                    obj.NGUOI_CNHAT = ClientInformation.TenDangNhap;
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Ejemplo n.º 5
0
        public void AfterModify(bool ret, DM_CUM obj, List <ClientResponseDetail> listClientResponseDetail)
        {
            try
            {
                if (ret)
                {
                    LMessage.ShowMessage("M.DungChung.CapNhatThanhCong", LMessage.MessageBoxType.Information);

                    sTrangThaiNVu           = obj.TTHAI_NVU;
                    lblTrangThai.Content    = BusinessConstant.layNgonNguNghiepVu(sTrangThaiNVu);
                    txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);
                    raddtNgayCapNhat.Value  = LDateTime.StringToDate(ClientInformation.NgayLamViecHienTai, "yyyyMMdd");
                    txtNguoiCapNhat.Text    = ClientInformation.TenDangNhap;

                    BeforeViewFromDetail();
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                    //LMessage.ShowMessage("M.DungChung.CapNhatKoThanhCong", LMessage.MessageBoxType.Error);
                }

                // Yêu cầu Unlock bản ghi cần sửa
                UtilitiesProcess process    = new UtilitiesProcess();
                List <int>       listLockId = new List <int>();
                listLockId.Add(id);

                bool retUnlockData = process.UnlockData(DatabaseConstant.Module.DMDC,
                                                        DatabaseConstant.Function.DC_DM_CUM,
                                                        DatabaseConstant.Table.DM_CUM,
                                                        DatabaseConstant.Action.SUA,
                                                        listLockId);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Ejemplo n.º 6
0
        public void OnAddNew(DM_CUM obj)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                DanhMucProcess processDanhMuc = new DanhMucProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                DM_TEMP_CUM objTempCum = new DM_TEMP_CUM();
                ret = processDanhMuc.Cum02(DatabaseConstant.Action.THEM, ref obj, ref objTempCum, ref listClientResponseDetail);
                AfterAddNew(ret, obj, listClientResponseDetail);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Ejemplo n.º 7
0
        private void SetFormData()
        {
            DanhMucProcess processDanhMuc = new DanhMucProcess();

            List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();

            obj = new DM_CUM();
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                bool ret = false;
                obj.ID = id;
                DM_TEMP_CUM objTempCum = new DM_TEMP_CUM();
                ret = processDanhMuc.Cum02(DatabaseConstant.Action.LOAD, ref obj, ref objTempCum, ref listClientResponseDetail);
                if (ret == true)
                {
                    sTrangThaiNVu        = obj.TTHAI_NVU;
                    lblTrangThai.Content = BusinessConstant.layNgonNguNghiepVu(sTrangThaiNVu);

                    #region Thông tin chung
                    cmbChiNhanh.SelectedIndex      = lstSourceChiNhanh.IndexOf(lstSourceChiNhanh.FirstOrDefault(e => e.KeywordStrings.First().Equals(obj.MA_DVI_QLY)));
                    cmbPhongGiaoDich.SelectedIndex = lstSourcePhongGiaoDich.IndexOf(lstSourcePhongGiaoDich.FirstOrDefault(e => e.KeywordStrings.First().Equals(obj.MA_DVI)));
                    cmbPhongGiaoDich_SelectionChanged(null, null);
                    cmbKhuVuc.SelectedIndex = lstSourceKhuVuc.IndexOf(lstSourceKhuVuc.FirstOrDefault(e => e.KeywordStrings.First().Equals(obj.MA_KVUC)));
                    txtMaCum.Text           = obj.MA_CUM;
                    txtTenCum.Text          = obj.TEN_CUM;
                    txtTenTat.Text          = obj.TEN_TAT;
                    if (LDateTime.IsDate(obj.NGAY_TLAP, "yyyyMMdd"))
                    {
                        raddtNgayThanhLap.Value = LDateTime.StringToDate(obj.NGAY_TLAP, "yyyyMMdd");
                    }
                    cmbCBQL.SelectedIndex = lstSourceCBQL.IndexOf(lstSourceCBQL.FirstOrDefault(e => e.KeywordStrings.First().Equals(obj.MA_CBO_QLY)));
                    if (obj.LOAI_CUM_TRUONG.Equals("KHTV"))
                    {
                        chkCumTruongLaKHTV.IsChecked = true;
                    }
                    else
                    {
                        chkCumTruongLaKHTV.IsChecked = false;
                    }
                    txtCumTruong.Text = obj.MA_CUM_TRUONG;
                    if (objTempCum != null)
                    {
                        txtTenCumTruong.Text = objTempCum.TEN_CUM_TRUONG;
                    }
                    #endregion

                    #region Thông tin kiểm soát
                    txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguSuDung(obj.TTHAI_BGHI);
                    raddtNgayLap.Value      = LDateTime.StringToDate(obj.NGAY_NHAP, "yyyyMMdd");
                    txtNguoiLap.Text        = obj.NGUOI_NHAP;
                    if (LDateTime.IsDate(obj.NGAY_CNHAT, "yyyyMMdd") == true)
                    {
                        raddtNgayCapNhat.Value = LDateTime.StringToDate(obj.NGAY_CNHAT, "yyyyMMdd");
                    }
                    txtNguoiCapNhat.Text = obj.NGUOI_CNHAT;
                    #endregion
                }
                else
                {
                    LMessage.ShowMessage("M_ResponseMessage_HanhDong_LayDuLieuKhongThanhCong", LMessage.MessageBoxType.Warning);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                LMessage.ShowMessage("M_ResponseMessage_HanhDong_LayDuLieuKhongThanhCong", LMessage.MessageBoxType.Warning);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }