private void ThoaiDuyet()
 {
     try
     {
         HanMucProcess process = new HanMucProcess();
         int[]         arrayID = new int[0];
         Mouse.OverrideCursor = Cursors.Wait;
         try
         {
             foreach (DataRowView dr in grKhachHangDS.SelectedItems)
             {
                 Array.Resize(ref arrayID, arrayID.Length + 1);
                 arrayID[arrayID.Length - 1] = Convert.ToInt32(dr["ID"]);
             }
             HM_HMUC_TONG obj = new HM_HMUC_TONG();
             obj.lstID = arrayID;
             List <ClientResponseDetail>        lstResponseDetail = new List <ClientResponseDetail>();
             ApplicationConstant.ResponseStatus ret = process.HanMucTong(_function, DatabaseConstant.Action.THOAI_DUYET, ref obj, ref lstResponseDetail);
             CommonFunction.ThongBaoKetQua(lstResponseDetail);
             TimKiem();
         }
         catch (System.Exception ex)
         {
             this.Cursor = Cursors.Arrow;
             CommonFunction.ThongBaoLoi(ex);
             LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
         }
         Mouse.OverrideCursor = Cursors.Arrow;
     }
     catch (System.Exception ex)
     {
         CommonFunction.ThongBaoLoi(ex);
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
     }
 }
Exemple #2
0
        public void OnDelete()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
            HanMucProcess process = new HanMucProcess();

            try
            {
                bool ret = false;
                List <DC_HAN_MUC> lstObjHM = new List <DC_HAN_MUC>();

                GetFormData(ref lstObjHM);

                ret = new HanMucProcess().HanMucChung(DatabaseConstant.Action.XOA, ref lstObjHM, ref listClientResponseDetail);
                AfterDelete(ret, listClientResponseDetail);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                Mouse.OverrideCursor     = Cursors.Arrow;
                listClientResponseDetail = null;
                process = null;
            }
        }
        /// <summary>
        /// Tìm kiếm nâng cao
        /// </summary>
        private void TimKiem()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                DataTable dt = null;
                LDatatable.MakeParameterTable(ref dt);

                // Load dữ liệu lên grid
                Presentation.Process.HanMucProcess processHanMuc = new HanMucProcess();
                if (ucTrangThaiNVu.GetItemsSelected() == "NULL")
                {
                    LDatatable.AddParameter(ref dt, "@MA_TRANG_THAI_NGHIEP_VU", "STRING", "");
                }
                else
                {
                    LDatatable.AddParameter(ref dt, "@MA_TRANG_THAI_NGHIEP_VU", "STRING", ucTrangThaiNVu.GetItemsSelected());
                }

                LDatatable.AddParameter(ref dt, "@MA_HAN_MUC", "STRING", txtMaHanMuc.Text);
                LDatatable.AddParameter(ref dt, "@HMUC_PDUYET_TU", "DECIMAL", telHMPheDuyetTu.Value.Value.ToString());
                LDatatable.AddParameter(ref dt, "@HMUC_PDUYET_DEN", "DECIMAL", telHMPheDuyetDen.Value.Value.ToString());
                LDatatable.AddParameter(ref dt, "@HMUC_KDUNG_TU", "DECIMAL", telHMKhaDungTu.Value.Value.ToString());
                LDatatable.AddParameter(ref dt, "@HMUC_KDUNG_DEN", "DECIMAL", telHMKhaDungDen.Value.Value.ToString());
                LDatatable.AddParameter(ref dt, "@MA_KHANG", "STRING", txtMaKhachHang.Text.Trim());
                LDatatable.AddParameter(ref dt, "@TEN_KHANG", "STRING", txtTenKhachHang.Text.Trim());
                LDatatable.AddParameter(ref dt, "@TEN_DANG_NHAP", "STRING", ClientInformation.TenDangNhap);
                LDatatable.AddParameter(ref dt, "@MA_DON_VI", "STRING", ClientInformation.MaDonVi);
                LDatatable.AddParameter(ref dt, "@START_ROW", "INT", "0");
                LDatatable.AddParameter(ref dt, "@END_ROW", "INT", "0");

                Presentation.Process.HanMucProcess process = new Presentation.Process.HanMucProcess();
                DataSet ds = process.GetDanhSachHanMuc(dt);
                if (ds != null && ds.Tables.Count > 0)
                {
                    grKhachHangDS.ItemsSource = ds.Tables[0].DefaultView;
                }
                else
                {
                    grKhachHangDS.ItemsSource = null;
                }


                // Phân trang
                int StartRow       = 1;
                int EndRow         = ClientInformation.SoLuongBanGhi;
                int CurrentPagging = 1;
                int PaggingSize    = ClientInformation.SoLuongBanGhi;
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }

            Mouse.OverrideCursor = Cursors.Arrow;
        }
Exemple #4
0
        private void LoadGrid()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                #region Lấy điều kiện truyền vào
                string maDonVi = ClientInformation.MaDonVi;

                //foreach (RadTreeViewItem item in tvwTree.CheckedItems)
                //{
                //    int i = item.Tag.ToString().IndexOf("#");
                //    string sValue = item.Tag.ToString().Substring(0, i);
                //    int iLevel = Convert.ToInt32(item.Tag.ToString().Substring(i + 1));

                //    if (iLevel == 3)
                //    {
                //        maDonVi = maDonVi + "''" + sValue + "'',";
                //    }
                //}
                //if (maDonVi.Length > 0)
                //{
                //    maDonVi = maDonVi.Substring(0, maDonVi.Length - 1);
                //    maDonVi = "(" + maDonVi + ")";
                //}
                //else
                //{
                //    maDonVi = "('''')";
                //}

                #endregion

                DataSet ds = new HanMucProcess().GetDanhSachHanMucChung(maDonVi);
                if (ds != null)
                {
                    grHanMucDS.DataContext = ds.Tables[0].DefaultView;
                }
                else
                {
                    grHanMucDS.Items.Clear();
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Exemple #5
0
        public void OnModify(ref List <DC_HAN_MUC> lstObjHM)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                HanMucProcess process = new HanMucProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                ret = new HanMucProcess().HanMucChung(DatabaseConstant.Action.SUA, ref lstObjHM, ref listClientResponseDetail);
                AfterAddNew(ret, lstObjHM, listClientResponseDetail);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Exemple #6
0
        /// <summary>
        /// Xóa
        /// </summary>
        /// <param name="listId"></param>
        private void OnDelete(List <DC_HAN_MUC> lstObjHM)
        {
            DanhMucProcess processDanhMuc = new DanhMucProcess();

            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();


                bool ret = new HanMucProcess().HanMucChung(DatabaseConstant.Action.XOA, ref lstObjHM, ref listClientResponseDetail);

                AfterDelete(ret, listClientResponseDetail);
            }
            catch (System.Exception ex)
            {
                this.Cursor = Cursors.Arrow;
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
        private void Luu()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            List <DC_HAN_MUC> lstHanMuc = null;

            try
            {
                if (!Validation())
                {
                    return;
                }

                GetFormData(ref lstHanMuc);

                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;
                ret = new HanMucProcess().HanMucChung(DatabaseConstant.Action.SUA, ref lstHanMuc, ref listClientResponseDetail);

                if (ret == true)
                {
                    LMessage.ShowMessage("M.DungChung.CapNhatThanhCong", LMessage.MessageBoxType.Information);
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                }
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            finally
            {
                lstHanMuc            = null;
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
        private void BuildGridDoiTuong()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                string maLoaiDTuong = lstSourceLoaiDTuong.ElementAt(cmbDoiTuong.SelectedIndex).KeywordStrings.First();
                if (maLoaiDTuong.IsNullOrEmptyOrSpace())
                {
                    dtDoiTuong = null;
                    grDSDoiTuong.ItemsSource = null;
                    return;
                }

                DataSet ds = new HanMucProcess().GetHanMucChung(maLoaiDTuong, ClientInformation.MaDonVi);
                if (ds != null && ds.Tables.Count > 0)
                {
                    dtDoiTuong = ds.Tables[0];
                    grDSDoiTuong.ItemsSource = null;
                    grDSDoiTuong.ItemsSource = dtDoiTuong.DefaultView;
                }
                else
                {
                    dtDoiTuong = null;
                    grDSDoiTuong.ItemsSource = null;
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }
Exemple #9
0
        private void SetFormData()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                #region Get data từ server
                HanMucProcess process = new HanMucProcess();
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                bool ret = false;

                ret = process.HanMucChung(DatabaseConstant.Action.LOAD, ref _lstObjHM, ref listClientResponseDetail);
                #endregion

                if (ret == true)
                {
                    tthaiNvu = _lstObjHM.FirstOrDefault().TTHAI_NVU;

                    cmbLoaiDoiTuong.SelectedIndex = lstLoaiDoiTuong.IndexOf(lstLoaiDoiTuong.FirstOrDefault(e => e.KeywordStrings.First().Equals(_lstObjHM.FirstOrDefault().MA_DTUONG_LOAI)));
                    txtMaDoiTuong.Tag             = _lstObjHM.FirstOrDefault().ID_DTUONG;
                    txtMaDoiTuong.Text            = _lstObjHM.FirstOrDefault().MA_DTUONG;

                    if (_lstObjHM.Where(e => e.MA_TNANG == "ADD").FirstOrDefault().MAX != null)
                    {
                        chkHMGiaoDichToiDa.IsChecked = false;
                        numHMGiaoDich.Value          = (double?)_lstObjHM.Where(e => e.MA_TNANG == "ADD").FirstOrDefault().MAX;
                    }
                    else
                    {
                        chkHMGiaoDichToiDa.IsChecked = true;
                    }

                    if (_lstObjHM.Where(e => e.MA_TNANG == "APPROVE").FirstOrDefault().MAX != null)
                    {
                        chkHMPheDuyetToiDa.IsChecked = false;
                        numHMPheDuyet.Value          = (double?)_lstObjHM.Where(e => e.MA_TNANG == "APPROVE").FirstOrDefault().MAX;
                    }
                    else
                    {
                        chkHMPheDuyetToiDa.IsChecked = true;
                    }

                    teldtNgayHieuLuc.Value = LDateTime.StringToDate(_lstObjHM.FirstOrDefault().NGAY_ADUNG, "yyyyMMdd");
                    if (_lstObjHM.FirstOrDefault().NGAY_HHAN != null)
                    {
                        teldtNgayHetHieuLuc.Value = LDateTime.StringToDate(_lstObjHM.FirstOrDefault().NGAY_HHAN, "yyyyMMdd");
                    }
                    else
                    {
                        teldtNgayHetHieuLuc.Value = null;
                    }

                    lblTrangThai.Content = BusinessConstant.layNgonNguSuDung(_lstObjHM.FirstOrDefault().TTHAI_BGHI);
                    txtTrangThai.Text    = BusinessConstant.layNgonNguSuDung(_lstObjHM.FirstOrDefault().TTHAI_BGHI);

                    txtNguoiLap.Text    = _lstObjHM.FirstOrDefault().NGUOI_NHAP;
                    teldtNgayNhap.Value = LDateTime.StringToDate(_lstObjHM.FirstOrDefault().NGAY_NHAP, "yyyyMMdd");

                    if (_lstObjHM.FirstOrDefault().NGUOI_CNHAT != null)
                    {
                        txtNguoiCapNhat.Text = _lstObjHM.FirstOrDefault().NGUOI_CNHAT;
                    }
                    else
                    {
                        txtNguoiCapNhat.Text = "";
                    }
                    if (_lstObjHM.FirstOrDefault().NGAY_CNHAT != null)
                    {
                        teldtNgayCNhat.Value = LDateTime.StringToDate(_lstObjHM.FirstOrDefault().NGAY_CNHAT, "yyyyMMdd");
                    }
                    else
                    {
                        teldtNgayCNhat.Value = null;
                    }
                }
                else
                {
                    CommonFunction.ThongBaoKetQua(listClientResponseDetail);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                CommonFunction.ThongBaoLoi(ex);
            }
            finally
            {
                Mouse.OverrideCursor = Cursors.Arrow;
            }
        }