Exemplo n.º 1
0
        public void AfterAddNew(bool ret, NS_DM_QUAN_HUYEN obj, List <ClientResponseDetail> listClientResponseDetail)
        {
            try
            {
                if (ret)
                {
                    LMessage.ShowMessage("M.DungChung.ThemThanhCong", LMessage.MessageBoxType.Information);

                    if (chkThemNhieuLan.IsChecked == true)
                    {
                        BeforeAddNew();
                        txtMa.Focus();
                    }
                    else
                    {
                        id                      = obj.ID;
                        trangThaiNVu            = obj.TTHAI_NVU;
                        lblTrangThai.Content    = BusinessConstant.layNgonNguNghiepVu(trangThaiNVu);
                        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;
            }
        }
Exemplo n.º 2
0
        public void OnSave()
        {
            try
            {
                if (!Validation())
                {
                    return;
                }

                obj = new NS_DM_QUAN_HUYEN();
                GetFormData(ref obj);

                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);
            }
        }
Exemplo n.º 3
0
        private void GetFormData(ref NS_DM_QUAN_HUYEN obj)
        {
            try
            {
                obj.ID           = id;
                obj.MA           = txtMa.Text;
                obj.TEN          = txtTen.Text;
                obj.MO_TA        = txtMoTa.Text;
                obj.MA_DOI_TUONG = "NS_DM_QUAN_HUYEN";
                obj.FN001        = lstSourceTinhTP.ElementAt(cmbTinhTP.SelectedIndex).KeywordStrings.ElementAt(1);
                obj.FN002        = lstSourceQuocGia.ElementAt(cmbQuocGia.SelectedIndex).KeywordStrings.ElementAt(1);

                #region Thông tin kiểm soát
                obj.TTHAI_BGHI = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri();
                obj.TTHAI_NVU  = trangThaiNVu;
                obj.MA_DVI_QLY = ClientInformation.MaDonVi;
                obj.MA_DVI_TAO = ClientInformation.MaDonViGiaoDich;
                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;
                }
                #endregion
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
Exemplo n.º 4
0
        private void SetFormData()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                NhanSuProcess processNhanSu = new NhanSuProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                obj    = new NS_DM_QUAN_HUYEN();
                obj.ID = id;

                ret = processNhanSu.QuanHuyen(DatabaseConstant.Action.LOAD_DATA, ref obj, ref listClientResponseDetail);
                if (ret == true)
                {
                    id = obj.ID;

                    #region Thông tin chung
                    lblTrangThai.Content     = BusinessConstant.layNgonNguNghiepVu(obj.TTHAI_NVU);
                    cmbQuocGia.SelectedIndex = lstSourceQuocGia.IndexOf(lstSourceQuocGia.FirstOrDefault(i => i.KeywordStrings[1].Equals(obj.FN002)));
                    cmbTinhTP.SelectedIndex  = lstSourceTinhTP.IndexOf(lstSourceTinhTP.FirstOrDefault(i => i.KeywordStrings[1].Equals(obj.FN001)));
                    txtMa.Text   = obj.MA;
                    txtTen.Text  = obj.TEN;
                    txtMoTa.Text = obj.MO_TA;
                    #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");
                    }
                    else
                    {
                        raddtNgayCapNhat.Value = null;
                    }
                    txtNguoiCapNhat.Text = obj.NGUOI_CNHAT;
                    #endregion
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Exemplo n.º 5
0
        private void ResetForm()
        {
            //Biến
            obj = null;
            id  = 0;

            //Thông tin chung
            lblTrangThai.Content = "";
            txtMa.Text           = "";
            txtTen.Text          = "";
            txtMoTa.Text         = "";

            //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    = "";
        }
Exemplo n.º 6
0
        public void OnModify(NS_DM_QUAN_HUYEN obj)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                NhanSuProcess processNhanSu = new NhanSuProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                ret = processNhanSu.QuanHuyen(DatabaseConstant.Action.SUA, ref obj, ref listClientResponseDetail);
                AfterModify(ret, obj, listClientResponseDetail);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Exemplo n.º 7
0
        public void AfterModify(bool ret, NS_DM_QUAN_HUYEN obj, List <ClientResponseDetail> listClientResponseDetail)
        {
            try
            {
                if (ret)
                {
                    LMessage.ShowMessage("M.DungChung.CapNhatThanhCong", LMessage.MessageBoxType.Information);

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

                    BeforeViewFromDetail();
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                }

                // 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.NSTL,
                                                        DatabaseConstant.Function.NS_DM_QUAN_HUYEN_CT,
                                                        DatabaseConstant.Table.NS_DM_QUAN_HUYEN,
                                                        DatabaseConstant.Action.SUA,
                                                        listLockId);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
        }
        /// <summary>
        /// Xóa
        /// </summary>
        /// <param name="listId"></param>
        private void OnDelete(List <int> listId)
        {
            NhanSuProcess processNhanSu = new NhanSuProcess();

            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                List <NS_DM_QUAN_HUYEN>     lstDMQuanHuyen           = new List <NS_DM_QUAN_HUYEN>();
                NS_DM_QUAN_HUYEN            obj = null;
                foreach (int id in listId)
                {
                    obj    = new NS_DM_QUAN_HUYEN();
                    obj.ID = id;
                    lstDMQuanHuyen.Add(obj);
                }
                bool ret = processNhanSu.DanhSachQuanHuyen(DatabaseConstant.Action.XOA, ref lstDMQuanHuyen, ref listClientResponseDetail);

                AfterDelete(ret, listId, listClientResponseDetail);
            }
            catch (System.Exception ex)
            {
                // Yêu cầu unlock dữ liệu
                UtilitiesProcess process = new UtilitiesProcess();

                bool retUnlockData = process.UnlockData(DatabaseConstant.Module.NSTL,
                                                        DatabaseConstant.Function.NS_DM_QUAN_HUYEN_DS,
                                                        DatabaseConstant.Table.NS_DM_QUAN_HUYEN,
                                                        DatabaseConstant.Action.XOA,
                                                        listId);
                this.Cursor = Cursors.Arrow;
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }