public JsonResult Save(string id, string maNhnsd, string tenNhnsd, string moTa, string maDviQly, bool hanCheTruyCap)
        {
            try
            {
                string msg = "";
                var    obj = qtht.layNhomNSD(ClientInformation.LoaiNguoiSuDung).FirstOrDefault(e => e.ID == id.Trim().StringToInt32());

                if (obj != null)
                {
                    obj.MA_NHNSD         = maNhnsd;
                    obj.TEN_NHNSD        = tenNhnsd;
                    obj.MO_TA            = moTa;
                    obj.MA_DVI_QLY       = maDviQly;
                    obj.HAN_CHE_TRUY_CAP =
                        hanCheTruyCap == true
                            ? BusinessConstant.CoKhong.CO.layGiaTri()
                            : BusinessConstant.CoKhong.KHONG.layGiaTri();

                    obj.NGAY_CNHAT = (DateTime.Today).ToString("yyyyMMdd");
                    if (obj.ID == 0)
                    {
                        obj.NGAY_NHAP = (DateTime.Today).ToString("yyyyMMdd");
                    }
                    obj.NGUOI_CNHAT = ClientInformation.TenDangNhap;
                    if (obj.ID == 0)
                    {
                        obj.NGUOI_NHAP = ClientInformation.TenDangNhap;
                    }
                    string strTtnv = string.Empty;
                    var    action  = DatabaseConstant.Action.SUA;
                    if (obj.ID == 0)
                    {
                        obj.NGUON_TAO_DL = "NSD";
                        obj.PVI_KTHAC    = "K";
                        strTtnv          = obj.TTHAI_NVU;
                        action           = DatabaseConstant.Action.THEM;
                    }
                    obj.TTHAI_NVU  = Common.LayTrangThaiBanGhi(action, BusinessConstant.layTrangThaiNghiepVu(strTtnv));
                    obj.TTHAI_BGHI = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri();

                    // Luôn là đã duyệt (???)
                    obj.TTHAI_NVU = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();
                    OnSave(ref msg, obj);
                }

                return(Json(msg.IsNullOrEmpty() ? Common.ResultJson.Success.LayMa() : msg, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex) { throw new Exception(ex.Message); }
        }
        public void OnSave()
        {
            if (!Validation())
            {
                return;
            }
            GetFormData(ref objHDTC, BusinessConstant.layTrangThaiNghiepVu(tThai_NVu));
            TaiSanDamBaoProcess         processTSDB = new TaiSanDamBaoProcess();
            List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
            bool ret = false;

            if (idHDTC == 0)
            {
                ret = processTSDB.HopDongTheChapTDTD(DatabaseConstant.Action.THEM, ref objHDTC, ref listClientResponseDetail);
            }
            else
            {
                ret = processTSDB.HopDongTheChapTDTD(DatabaseConstant.Action.SUA, ref objHDTC, ref listClientResponseDetail);
            }
            AfterSave(ret, listClientResponseDetail);
        }
Example #3
0
        /// <summary>
        /// Sự kiện load dữ liệu lên form
        /// </summary>
        private void LoadForm()
        {
            DanhMucProcess danhmucProcess = new DanhMucProcess();

            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (idPhanHeGD != 0)
                {
                    //Sự kiện load dữ liệu
                    DataSet dsPhanHeGD = danhmucProcess.getDanhSachPhanHeGDTheoID(idPhanHeGD);
                    if (dsPhanHeGD != null && dsPhanHeGD.Tables.Count > 0)
                    {
                        DataTable dtPhanHeGD = danhmucProcess.getDanhSachPhanHeGDTheoID(idPhanHeGD).Tables[0];
                        if (dtPhanHeGD.Rows.Count > 0)
                        {
                            lblTrangThai.Content            = BusinessConstant.layTrangThaiNghiepVu(dtPhanHeGD.Rows[0]["TTHAI_NVU"].ToString());
                            txtMaLoaiGD.Text                = dtPhanHeGD.Rows[0]["MA_LOAI_GDICH"].ToString();
                            txtNgayDuyet.Text               = dtPhanHeGD.Rows[0]["NGAY_CNHAT"].ToString();
                            txtNgayLap.Text                 = dtPhanHeGD.Rows[0]["NGAY_NHAP"].ToString();
                            txtTenLoaiGD.Text               = dtPhanHeGD.Rows[0]["TEN_LOAI_GDICH"].ToString();
                            txtTentat.Text                  = dtPhanHeGD.Rows[0]["TEN_TAT"].ToString();
                            txtTrangThaiBanGhi.Text         = dtPhanHeGD.Rows[0]["TTHAI_BGHI"].ToString();
                            txtNguoiDuyet.Text              = dtPhanHeGD.Rows[0]["NGUOI_CNHAT"].ToString();
                            txtNguoiLap.Text                = dtPhanHeGD.Rows[0]["NGUOI_NHAP"].ToString();
                            cmbPhanHe.SelectedIndex         = lstSourcePhanHe.IndexOf(lstSourcePhanHe.FirstOrDefault(i => i.KeywordStrings.First().Equals(dtPhanHeGD.Rows[0]["MA_PHAN_HE"].ToString())));
                            cmbTrangThaiSDung.SelectedIndex = lstSourceTrangThai.IndexOf(lstSourceTrangThai.FirstOrDefault(i => i.KeywordStrings.First().Equals(dtPhanHeGD.Rows[0]["TTHAI_BGHI"].ToString())));
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                LMessage.ShowMessage("M.DanhMuc.ucPhanHeGDCT.LoiLoadDuLieu", LMessage.MessageBoxType.Error);
                LLogging.WriteLog(ex.TargetSite.Name, LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
        public void getObject(DatabaseConstant.Action action)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (obj == null)
                {
                    obj = new HT_NHNSD();
                }
                //obj.MA_DVI_QLY = txtMaDonVi.Text;
                obj.MA_DVI_QLY = lstSourceDonVi.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings.First();
                obj.MA_DVI_TAO = ClientInformation.MaDonVi;
                obj.MA_NHNSD   = txtMaNhom.Text;
                obj.MO_TA      = txtMoTa.Text;
                if (chkHoatDong.IsChecked == true)
                {
                    obj.HAN_CHE_TRUY_CAP = BusinessConstant.CoKhong.CO.layGiaTri();
                }
                else
                {
                    obj.HAN_CHE_TRUY_CAP = BusinessConstant.CoKhong.KHONG.layGiaTri();
                }
                obj.NGAY_CNHAT = (DateTime.Today).ToString("yyyyMMdd");
                if (obj.ID == 0)
                {
                    obj.NGAY_NHAP = (DateTime.Today).ToString("yyyyMMdd");
                }
                obj.NGUOI_CNHAT = ClientInformation.TenDangNhap;
                if (obj.ID == 0)
                {
                    obj.NGUOI_NHAP = ClientInformation.TenDangNhap;
                }
                obj.TEN_NHNSD = txtTenNhom.Text;
                string strTTNV = string.Empty;
                if (obj.ID == 0)
                {
                    obj.NGUON_TAO_DL = "NSD";
                    obj.PVI_KTHAC    = "K";
                    strTTNV          = obj.TTHAI_NVU;
                }
                obj.TTHAI_NVU  = CommonFunction.LayTrangThaiBanGhi(action, BusinessConstant.layTrangThaiNghiepVu(strTTNV));
                obj.TTHAI_BGHI = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri();

                // Luôn là đã duyệt (???)
                obj.TTHAI_NVU = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();

                //Lấy thông tin hạn chế truy cập MAC or IP
                lstTruyCap = new List <HT_TRUY_CAP>();
                foreach (DataRow dr in dtTruyCap.Rows)
                {
                    if (!dr["STT"].ToString().IsNullOrEmptyOrSpace())
                    {
                        HT_TRUY_CAP objTruyCap = new HT_TRUY_CAP();
                        objTruyCap.ID_DTUONG   = obj.ID;
                        objTruyCap.MA_DTUONG   = obj.MA_NHNSD;
                        objTruyCap.LOAI_DTUONG = BusinessConstant.LoaiDoiTuong.NHOM_NGUOI_SDUNG.layGiaTri();

                        if (Convert.ToBoolean(dr["KICH_HOAT"]) == true)
                        {
                            objTruyCap.KICH_HOAT = BusinessConstant.CoKhong.CO.layGiaTri();
                        }
                        else
                        {
                            objTruyCap.KICH_HOAT = BusinessConstant.CoKhong.KHONG.layGiaTri();
                        }

                        objTruyCap.DIA_CHI      = dr["DIA_CHI"].ToString().ToUpper();
                        objTruyCap.LOAI_DIA_CHI = dr["LOAI_DIA_CHI"].ToString();

                        lstTruyCap.Add(objTruyCap);
                    }
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }
 public void getObject(DatabaseConstant.Action action)
 {
     Mouse.OverrideCursor = Cursors.Wait;
     try
     {
         if (obj == null)
         {
             obj = new HT_TSO();
         }
         //obj.MA_TSO_LOAI = txtMaLoaiThamSo.Text;
         //obj.ID_TSO_LOAI = idLoai;
         obj.MA_TSO          = txtMaThamSo.Text;
         obj.TEN_TSO         = txtTenThamSo.Text;
         obj.PVI_AHUONG      = lstSourcePhamVi.ElementAt(cmbPhamViAHuong.SelectedIndex).KeywordStrings.First();
         obj.MO_TA           = txtMoTaThamSo.Text;
         obj.MA_DVI_QLY      = ClientInformation.MaDonVi;
         obj.MA_DVI_TAO      = ClientInformation.MaDonVi;
         obj.HTHI_DIEU_KHIEN = lstSourceLoaiControl.ElementAt(cmbHienThiTren.SelectedIndex).KeywordStrings.First();
         obj.HTHI_GTRI_MDINH = txtGiaTriMacDinh.Text;
         obj.GIA_TRI         = txtGiaTri.Text;
         //if (rbtCodeQuery.IsChecked == true)
         //{
         //    obj.HTHI_POPUP = BusinessConstant.CoKhong.CO.layGiaTri();
         //    obj.HTHI_SDUNG_TVAN = BusinessConstant.CoKhong.CO.layGiaTri();
         //}
         //else
         //{
         obj.HTHI_POPUP      = BusinessConstant.CoKhong.KHONG.layGiaTri();
         obj.HTHI_SDUNG_TVAN = BusinessConstant.CoKhong.KHONG.layGiaTri();
         //}
         //if (rbtSQLQuery.IsChecked == true)
         //    obj.HTHI_SQL = BusinessConstant.CoKhong.CO.layGiaTri();
         //else
         obj.HTHI_SQL = BusinessConstant.CoKhong.KHONG.layGiaTri();
         //obj.ID_PHAN_HE = Convert.ToInt32(lstSourcePhanHe.ElementAt(cmbThuocPhanHe.SelectedIndex).KeywordStrings.ElementAt(1));
         obj.MA_PHAN_HE   = lstSourcePhanHe.ElementAt(cmbThuocPhanHe.SelectedIndex).KeywordStrings.First();
         obj.KIEU_DU_LIEU = lstSourceKieuDL.ElementAt(cmbKieuDuLieu.SelectedIndex).KeywordStrings.First();
         obj.TTHAI_BGHI   = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri();
         obj.NGAY_CNHAT   = string.IsNullOrEmpty(raddtNgayCNhat.Value.ToString().Trim()) ? ((DateTime)raddtNgayCNhat.Value).ToString("yyyyMMdd") : (DateTime.Today).ToString("yyyyMMdd");
         if (obj.ID == 0)
         {
             obj.NGAY_NHAP  = string.IsNullOrEmpty(raddtNgayCNhat.Value.ToString().Trim()) ? ((DateTime)raddtNgayNhap.Value).ToString("yyyyMMdd") : (DateTime.Today).ToString("yyyyMMdd");
             obj.NGUOI_NHAP = ClientInformation.TenDangNhap;
         }
         obj.NGUOI_CNHAT  = ClientInformation.TenDangNhap;
         obj.NGUON_TAO_DL = "NSD";
         string strTTNV = string.Empty;
         if (obj.ID > 0)
         {
             strTTNV = obj.TTHAI_NVU;
         }
         obj.TTHAI_NVU  = CommonFunction.LayTrangThaiBanGhi(action, BusinessConstant.layTrangThaiNghiepVu(strTTNV));
         obj.TTHAI_BGHI = BusinessConstant.TrangThaiBanGhi.SU_DUNG.layGiaTri();
     }
     catch (System.Exception ex)
     {
         CommonFunction.ThongBaoLoi(ex);
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
     }
     Mouse.OverrideCursor = Cursors.Arrow;
 }
Example #6
0
 public void OnSave()
 {
     Mouse.OverrideCursor = Cursors.Wait;
     try
     {
         if (!Validation())
         {
             return;
         }
         tthaiNvu = CommonFunction.LayTrangThaiBanGhi(DatabaseConstant.Action.TRINH_DUYET, BusinessConstant.layTrangThaiNghiepVu(tthaiNvu));
         List <DC_HAN_MUC> lstObjHM = null;
         GetFormData(ref lstObjHM);
         if (_action == DatabaseConstant.Action.THEM)
         {
             OnAddNew(ref lstObjHM);
         }
         else if (_action == DatabaseConstant.Action.SUA)
         {
             OnModify(ref lstObjHM);
         }
     }
     catch (Exception ex)
     {
         CommonFunction.ThongBaoLoi(ex);
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
     }
     finally
     {
         Mouse.OverrideCursor = Cursors.Arrow;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     grbThongtinsotiengui.GroupingText = LanguageEngine.Instance().GetContent(LanguageType.TypeUI, "U.HuyDongVon.GiaoDichGuiThem.ucGuiThemTienGuiCT.ThongTinSoTGui");
     grbThongtinKhachang.GroupingText  = LanguageEngine.Instance().GetContent(LanguageType.TypeUI, "U.HuyDongVon.GiaoDichGuiThem.ucGuiThemTienGuiCT.ThongTinKH");
     tbiKiemSoat.GroupingText          = LanguageEngine.Instance().GetContent(LanguageType.TypeUI, "U.DungChung.Tab.ThongTinKiemSoat_2");
     pnThongtinGiaodich.GroupingText   = LanguageEngine.Instance().GetContent(LanguageType.TypeUI, "U.HuyDongVon.GiaoDichGuiThem.ucGuiThemTienGuiCT.ThongTinGD");
     cmbGD_HinhThuc.Attributes.Add("onchange", "changehtgd()");
     inpTrangThai.Value = CommonFuntion.LayTrangThaiBanGhi(DatabaseConstant.Action.LUU, BusinessConstant.layTrangThaiNghiepVu(sTrangThaiNVu));
     if (!IsPostBack)
     {
         inpAction.Value = "THEM";
         LoadCombobox();
         ResetForm();
     }
 }
        public void OnSave()
        {
            try
            {
                if (!Validation())
                {
                    return;
                }

                string trangThai = "";
                if (sTrangThaiNVu.Equals(BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri()))
                {
                    trangThai = BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri();
                }
                else
                {
                    trangThai = CommonFunction.LayTrangThaiBanGhi(DatabaseConstant.Action.LUU, BusinessConstant.layTrangThaiNghiepVu(sTrangThaiNVu));
                }

                GetFormData(trangThai);

                if (action == DatabaseConstant.Action.THEM)
                {
                    OnAddNew();
                }
                else if (action == DatabaseConstant.Action.SUA)
                {
                    OnModify();
                }
            }
            catch (Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
        }
        /// <summary>
        /// Lưu tạm dữ liệu
        /// </summary>
        private void onHold()
        {
            string trangThai = CommonFunction.LayTrangThaiBanGhi(DatabaseConstant.Action.LUU_TAM, 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.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;
                }
            }
        }