Exemplo n.º 1
0
        private void ban_hanh_van_ban(
            string ip_str_danh_sach_email_ban_hanh
            , decimal ip_dc_id_van_thu)
        {
            US_GD_VAN_THU v_us = new US_GD_VAN_THU(ip_dc_id_van_thu);
            string[] v_arr_email = ip_str_danh_sach_email_ban_hanh.Split(';');
            string v_str_mess = "";
            try
            {
                for (int i = 0; i < v_arr_email.Length; i++)
                {
                    if (!v_arr_email[i].Trim().Equals(""))
                    {

                        string v_str_send_to = v_arr_email[i];
                        if (!v_str_send_to.Contains("@gmail.com")
                            && !v_str_send_to.Contains("@yahoo.com")
                            && !v_str_send_to.Contains("@topica.edu.vn")) v_str_send_to += "@topica.edu.vn";
                        //Ghi du lieu Ban hanh van ban
                        VanThu v_van_thu = new VanThu();
                        decimal v_dc_id_gd_ban_hanh = -1;
                        v_dc_id_gd_ban_hanh = v_van_thu.ban_hanh_van_ban(v_us.dcID, DateTime.Now, v_str_send_to);
                        string v_str_web_url = get_html_contain(ConfigurationSettings.AppSettings["WEB_URL"] + "/ChucNang/f604_xac_nhan_cong_van.aspx?mail=" + v_str_send_to + "&id_cong_van=" + v_dc_id_gd_ban_hanh, v_us.strTEN_LOAI_VA_TRICH_YEU_ND);

                        if (!HelpUtils.SendEmailWithHtmlContent(v_str_send_to
                            , "[QuanLyVanThu] Ban hanh van ban"
                        , v_str_web_url
                        , v_us.strLINK_SCAN))
                        {
                            MessageBox.Show("Đã có lỗi trong quá trình thực hiện, bạn vui lòng thực hiện lại thao tác!", "Thông báo");
                            return;
                        }

                        //Ghi lich su Ban hanh van ban
                        string v_str_van_ban_so = "";
                        if (v_us.dcID_LOAI_CONG_VAN == ID_LOAI_VAN_THU.CONG_VAN_DEN)
                        {
                            v_str_van_ban_so = v_us.strSO_CV_DEN;
                        }
                        else v_str_van_ban_so = v_us.strSO_VA_KY_HIEU;
                        v_van_thu.ghi_lich_su_hanh_dong(
                            CAppContext_201.getCurrentUserID()
                            , DateTime.Now
                            , "Ban hành văn bản số: " + v_str_van_ban_so + " cho email: " + v_str_send_to);
                    }
                }
                v_us.Update();
                MessageBox.Show("Đã gửi email ban hành văn bản thành công!", "Thông báo");
                this.Close();
            }
            catch (Exception v_e)
            {
                //CSystemLog_301.ExceptionHandle(v_e);
                MessageBox.Show("Đã có lỗi trong quá trình thực hiện, bạn vui lòng thực hiện lại thao tác!", "Thông báo");
                return;
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string v_str_email = "";
            decimal v_dc_id_cong_van = 0;
            if (Request.QueryString["mail"] != null)
            {
                v_str_email = Request.QueryString["mail"];
            }
            else
            {
                Response.Redirect("../../QuanLyHanhChinh");
            }
            if (Request.QueryString["id_cong_van"] != null)
            {
                v_dc_id_cong_van = CIPConvert.ToDecimal(Request.QueryString["id_cong_van"]);
            }
            else
            {
                Response.Redirect("../../QuanLyHanhChinh");
            }
            v_str_email = v_str_email.Replace("@topica.edu.vn", "").Replace("@gmail.com", "");
            DS_GD_BAN_HANH_VAN_BAN v_ds_gd_ban_hanh = new DS_GD_BAN_HANH_VAN_BAN();
            US_GD_BAN_HANH_VAN_BAN v_us_gd_ban_hanh = new US_GD_BAN_HANH_VAN_BAN();
            v_us_gd_ban_hanh.FillDataset(v_ds_gd_ban_hanh, "where id=" + v_dc_id_cong_van);
            if (v_ds_gd_ban_hanh.GD_BAN_HANH_VAN_BAN.Count > 0)
            {
                // update lai danh sach email xac nhan
                VanThu v_van_thu = new VanThu();
                v_van_thu.nhan_van_ban(v_dc_id_cong_van, DateTime.Now);
                //Ghi lich su
                v_us_gd_ban_hanh = new US_GD_BAN_HANH_VAN_BAN(v_dc_id_cong_van);
                string v_str_van_ban_so = "";
                US_GD_VAN_THU v_us_gd_van_thu = new US_GD_VAN_THU(v_us_gd_ban_hanh.dcID_VAN_BAN);
                if (v_us_gd_van_thu.dcID_LOAI_CONG_VAN == ID_LOAI_VAN_THU.CONG_VAN_DEN)
                {
                    v_str_van_ban_so = v_us_gd_van_thu.strSO_CV_DEN;
                }
                else v_str_van_ban_so = v_us_gd_van_thu.strSO_VA_KY_HIEU;
                //v_van_thu.ghi_lich_su_hanh_dong(Person.get_user_id(), DateTime.Now, "Nhận văn bản số: " + v_str_van_ban_so);
                m_lbl_thong_bao.Text = "Cám ơn bạn đã xác nhận công văn! Từ bây giờ, bạn có thể tra cứu công văn này trong chức năng!";
                m_hpl_chuc_nang.NavigateUrl = "f603_tra_cuu_van_ban.aspx";
                m_hpl_chuc_nang.Text = "Tra cứu văn thư";
            }
            else Response.Redirect("../../QuanLyHanhChinh");

        }
    }
    protected void m_grv_dm_bill_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandArgument.ToString().Equals("")) return;
        decimal v_dc_id_van_thu = CIPConvert.ToDecimal(e.CommandArgument);
        US_GD_VAN_THU v_us = new US_GD_VAN_THU(v_dc_id_van_thu);
        if (v_us.strLINK_SCAN.Equals("")) return;
        if (e.CommandName == "TaiFile")
        {
            BCTKApp.App_Code.HelpUtils.Download(Server.MapPath("~") + "\\PdfScan", v_us.strLINK_SCAN.Replace("210.245.89.37/FileUpload_Vanthu/", ""));
            string v_str_file_save = Server.MapPath("~") + "\\PdfScan\\" + v_us.strLINK_SCAN.Replace("210.245.89.37/FileUpload_Vanthu/", "");
            WebClient User = new WebClient();
            Byte[] FileBuffer = User.DownloadData(v_str_file_save);
            if (FileBuffer != null)
            {
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-length", FileBuffer.Length.ToString());
                Response.BinaryWrite(FileBuffer);

            }
        }
    }
        private bool insert_data()
        {
            try
            {
                string v_str_file_name = m_txt_file_upload.Text.Split('\\')[m_txt_file_upload.Text.Split('\\').Length - 1];
                string v_str_save_file = ConfigurationSettings.AppSettings["DOMAIN"] + "/" + "FileUpload_Vanthu" + "/" + v_str_file_name.Replace(ConfigurationSettings.AppSettings["DOMAIN"] + "/" + "FileUpload_Vanthu" + "/","");
                if (!m_txt_file_upload.Text.Trim().Equals("") && !m_txt_file_upload.Text.Contains(ConfigurationSettings.AppSettings["DOMAIN"]))
                {
                    if (!HelpUtils.ftpTransfer(m_txt_file_upload.Text.Replace(v_str_file_name, ""), v_str_file_name)) return false;
                }

                US_GD_VAN_THU v_us_gd_van_thu = new US_GD_VAN_THU();
                if (m_dc_id_van_thu != 0) v_us_gd_van_thu = new US_GD_VAN_THU(m_dc_id_van_thu);

                if (m_tcd_ngay_tren_cv.getValue() == null) v_us_gd_van_thu.SetNGAY_THANG_TREN_CONG_VANNull();
                else
                    v_us_gd_van_thu.datNGAY_THANG_TREN_CONG_VAN = CIPConvert.ToDatetime(m_tcd_ngay_tren_cv.Text, "dd/MM/yyyy");

                if (m_tcd_ngay_nhap.getValue() == null) v_us_gd_van_thu.SetNGAY_LAPNull();
                else
                    v_us_gd_van_thu.datNGAY_LAP = CIPConvert.ToDatetime(m_tcd_ngay_nhap.Text, "dd/MM/yyyy");

                v_us_gd_van_thu.strSO_VA_KY_HIEU = m_txt_so_va_ky_hieu.Text.Trim();
                v_us_gd_van_thu.strTEN_LOAI_VA_TRICH_YEU_ND = m_txt_ten_loai.Text.Trim();

                US_DM_PHONG_BAN_PHAP_NHAN v_us_dm_phong_ban = new US_DM_PHONG_BAN_PHAP_NHAN();
                DS_DM_PHONG_BAN_PHAP_NHAN v_ds_dm_phong_ban = new DS_DM_PHONG_BAN_PHAP_NHAN();

                if (m_cbx_ban_luu.SelectedValue != null)
                {
                    v_us_dm_phong_ban.FillDataset(v_ds_dm_phong_ban,
                                                  " where id_phong_ban = " + m_cbx_ban_luu.SelectedValue);
                    v_us_gd_van_thu.dcID_NGUOI_NHAN_BAN_LUU = CIPConvert.ToDecimal(m_cbx_ban_luu.SelectedValue);
                    v_us_gd_van_thu.dcID_NOI_NGUOI_NHAN = CIPConvert.ToDecimal(m_cbx_ban_luu.SelectedValue);
                }
                else
                {
                    v_us_gd_van_thu.SetID_NGUOI_NHAN_BAN_LUUNull();
                    v_us_gd_van_thu.SetID_NOI_NGUOI_NHANNull();
                }

                if (v_ds_dm_phong_ban.Tables[0].Rows.Count > 0)
                    v_us_gd_van_thu.dcID_PHAP_NHAN = CIPConvert.ToDecimal(v_ds_dm_phong_ban.Tables[0].Rows[0][DM_PHONG_BAN_PHAP_NHAN.ID_PHAP_NHAN]);
                else v_us_gd_van_thu.SetID_PHAP_NHANNull();

                v_us_gd_van_thu.strGHI_CHU = m_txt_ghi_chu.Text.Trim();
                v_us_gd_van_thu.dcID_TRANG_THAI = CIPConvert.ToDecimal(m_cbx_trang_thai.SelectedValue);
                v_us_gd_van_thu.strNGUOI_LAP = m_txt_nguoi_nhap.Text.Trim();
                if (!m_txt_file_upload.Text.Trim().Equals(string.Empty))
                    v_us_gd_van_thu.strLINK_SCAN = v_str_save_file;
                else v_us_gd_van_thu.strLINK_SCAN = string.Empty;
                v_us_gd_van_thu.strSO_CV_DEN = m_txt_so_cv_den.Text.Trim();
                v_us_gd_van_thu.strNOI_GUI = m_txt_noi_gui.Text.Trim();
                v_us_gd_van_thu.dcID_LOAI_CONG_VAN = ID_LOAI_VAN_THU.CONG_VAN_DEN;
                v_us_gd_van_thu.strNOI_NHAN = m_cbx_ban_luu.Text.Trim();
                if (v_us_dm_phong_ban.dcID == -1)
                {
                    v_us_gd_van_thu.Insert();
                    US_CM_DM_TU_DIEN v_us = new US_CM_DM_TU_DIEN();
                    DS_CM_DM_TU_DIEN v_ds = new DS_CM_DM_TU_DIEN();
                    v_us.FillDataset(v_ds, "where ma_tu_dien='CV_DEN'");
                    if (v_ds.CM_DM_TU_DIEN.Count > 0)
                    {
                        v_us.DataRow2Me(v_ds.Tables[0].Rows[0]);
                        string v_str_so = v_ds.Tables[0].Rows[0][CM_DM_TU_DIEN.TEN_NGAN].ToString();
                        string v_str_nam = v_ds.Tables[0].Rows[0][CM_DM_TU_DIEN.TEN].ToString();
                        v_str_so = CIPConvert.ToStr(CIPConvert.ToDecimal(v_str_so) + 1, "0#");
                        m_txt_so_cv_den.Text = v_str_so + "/" + v_str_nam;
                        v_us.strTEN = v_str_nam;
                        v_us.strTEN_NGAN = v_str_so;
                        v_us.Update();
                    }
                }
                else
                {
                    v_us_dm_phong_ban.Update();
                }
                return true;
            }
            catch (Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);
                return false;
            }
        }
 private void us_object_to_form()
 {
     if (m_dc_id_van_thu == 0) return;
     else
     {
         US_GD_VAN_THU v_us = new US_GD_VAN_THU(m_dc_id_van_thu);
         m_txt_file_upload.Text = v_us.strLINK_SCAN;
         m_txt_ghi_chu.Text = v_us.strGHI_CHU;
         m_txt_nguoi_nhap.Text = v_us.strNGUOI_LAP;
         m_txt_noi_gui.Text = v_us.strNOI_GUI;
         m_txt_so_va_ky_hieu.Text = v_us.strSO_VA_KY_HIEU;
         m_txt_so_cv_den.Text = v_us.strSO_CV_DEN;
         m_txt_ten_loai.Text = "";
     }
 }
Exemplo n.º 6
0
 private void delete_v_gd_van_thu_all()
 {
     if (!CGridUtils.IsThere_Any_NonFixed_Row(m_fg)) return;
     if (!CGridUtils.isValid_NonFixed_RowIndex(m_fg, m_fg.Row)) return;
     if (BaseMessages.askUser_DataCouldBeDeleted(8) != BaseMessages.IsDataCouldBeDeleted.CouldBeDeleted) return;
     US_V_GD_VAN_THU_ALL v_us = new US_V_GD_VAN_THU_ALL();
     US_GD_VAN_THU v_us_gd_van_thu = new US_GD_VAN_THU();
     grid2us_object(v_us, m_fg.Row);
     try
     {
         v_us_gd_van_thu = new US_GD_VAN_THU(v_us.dcID);
         v_us_gd_van_thu.BeginTransaction();
         v_us_gd_van_thu.Delete();
         v_us_gd_van_thu.CommitTransaction();
         m_fg.Rows.Remove(m_fg.Row);
     }
     catch (Exception v_e)
     {
         v_us_gd_van_thu.Rollback();
         CDBExceptionHandler v_objErrHandler = new CDBExceptionHandler(v_e,
             new CDBClientDBExceptionInterpret());
         v_objErrHandler.showErrorMessage();
     }
 }
 private void us_object_to_form(decimal ip_dc_id_cong_van)
 {
     if (ip_dc_id_cong_van == 0)
     {
         xoa_trang();
         return;
     }
     US_GD_VAN_THU v_us = new US_GD_VAN_THU(ip_dc_id_cong_van);
     string[] v_arr_i = v_us.strSO_VA_KY_HIEU.Split('/');
     m_txt_ghi_chu.Text = v_us.strGHI_CHU;
     m_txt_noi_nhan.Text = v_us.strNOI_NHAN;
     m_txt_file_upload.Text = v_us.strLINK_SCAN;
     m_txt_nguoi_ky.Text = v_us.strNGUOI_KY;
     m_txt_nguoi_nhap.Text = v_us.strNGUOI_LAP;
     m_txt_so.Text = v_arr_i[0] + "/" + v_arr_i[1];
     m_cbx_ky_hieu.Text = v_us.strSO_VA_KY_HIEU.Replace(m_txt_so.Text,"");
     m_cbx_phap_nhan.SelectedValue = v_us.dcID_PHAP_NHAN.ToString();
     m_cbx_trang_thai.SelectedValue = v_us.dcID_TRANG_THAI.ToString();
     if (v_us.IsNGAY_LAPNull())
         m_tcd_ngay_nhap.Text = "";
     else
     m_tcd_ngay_nhap.Text = CIPConvert.ToStr(v_us.datNGAY_LAP, "dd/MM/yyyy");
     if (v_us.IsNGAY_THANG_TREN_CONG_VANNull())
         m_tcd_ngay_tren_cv.Text = "";
     else
         m_tcd_ngay_tren_cv.Text = CIPConvert.ToStr(v_us.datNGAY_THANG_TREN_CONG_VAN, "dd/MM/yyyy");
     m_txt_ten_loai.Text = v_us.strTEN_LOAI_VA_TRICH_YEU_ND;
 }
        private bool save_data()
        {
            try
            {
                string v_str_file_name = m_txt_file_upload.Text.Split('\\')[m_txt_file_upload.Text.Split('\\').Length - 1];
                string v_str_save_file = ConfigurationSettings.AppSettings["DOMAIN"] + "/" + "FileUpload_Vanthu" + "/" + v_str_file_name.Replace(ConfigurationSettings.AppSettings["DOMAIN"] + "/" + "FileUpload_Vanthu" + "/","");
                if (!m_txt_file_upload.Text.Trim().Equals("") && !m_txt_file_upload.Text.Contains(ConfigurationSettings.AppSettings["DOMAIN"]))
                {
                    if (!HelpUtils.ftpTransfer(m_txt_file_upload.Text.Replace(v_str_file_name, ""), v_str_file_name)) return false;
                }

                //HelpUtils.open_pdf_file(v_str_file_name, "..//Debug/FileScan");
                US_GD_VAN_THU v_us_gd_van_thu = new US_GD_VAN_THU();
                v_us_gd_van_thu.dcID = m_dc_id_cong_van;
                v_us_gd_van_thu.dcID_PHAP_NHAN = CIPConvert.ToDecimal(m_cbx_phap_nhan.SelectedValue);
                if (m_tcd_ngay_nhap.getValue()==null)
                {
                    v_us_gd_van_thu.SetNGAY_LAPNull();
                }
                else
                v_us_gd_van_thu.datNGAY_LAP = CIPConvert.ToDatetime(m_tcd_ngay_nhap.Text,"dd/MM/yyyy");
                if (m_tcd_ngay_tren_cv.getValue()==null)
                {
                    v_us_gd_van_thu.SetNGAY_THANG_TREN_CONG_VANNull();
                }
                else v_us_gd_van_thu.datNGAY_THANG_TREN_CONG_VAN=CIPConvert.ToDatetime(m_tcd_ngay_tren_cv.Text,"dd/MM/yyyy");
                v_us_gd_van_thu.strSO_VA_KY_HIEU =
                    new StringBuilder(m_txt_so.Text.Trim()).Append(m_cbx_ky_hieu.Text.Trim()).ToString();
                v_us_gd_van_thu.strNGUOI_KY = m_txt_nguoi_ky.Text;
                v_us_gd_van_thu.strTEN_LOAI_VA_TRICH_YEU_ND = m_txt_ten_loai.Text.Trim();
                v_us_gd_van_thu.strNOI_NHAN = m_txt_noi_nhan.Text.Trim();
                v_us_gd_van_thu.dcID_NGUOI_NHAN_BAN_LUU = CIPConvert.ToDecimal(m_cbx_ban_luu.SelectedValue);
                if (m_cbx_ban_luu.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("Bạn phải chọn Người nhận/Nơi nhận bản lưu", "Cảnh báo");
                    return false;
                }

                if (m_cbx_ban_luu.SelectedValue != null)
                {
                    v_us_gd_van_thu.dcID_NOI_NGUOI_NHAN = CIPConvert.ToDecimal(m_cbx_ban_luu.SelectedValue);
                    v_us_gd_van_thu.dcID_NGUOI_NHAN_BAN_LUU = CIPConvert.ToDecimal(m_cbx_ban_luu.SelectedValue);
                }
                else
                {
                    v_us_gd_van_thu.SetID_NOI_NGUOI_NHANNull();
                    v_us_gd_van_thu.SetID_NGUOI_NHAN_BAN_LUUNull();
                }
                v_us_gd_van_thu.strGHI_CHU = m_txt_ghi_chu.Text.Trim();
                v_us_gd_van_thu.dcID_TRANG_THAI = CIPConvert.ToDecimal(m_cbx_trang_thai.SelectedValue);
                v_us_gd_van_thu.strNGUOI_LAP = m_txt_nguoi_nhap.Text.Trim();
                if (!m_txt_file_upload.Text.Trim().Equals(""))
                    v_us_gd_van_thu.strLINK_SCAN = v_str_save_file;
                else v_us_gd_van_thu.strLINK_SCAN = "";
                v_us_gd_van_thu.dcID_LOAI_CONG_VAN = (m_rdb_noi_bo.Checked)
                                                         ? ID_LOAI_VAN_THU.CONG_VAN_DI_NOI_BO
                                                         : ID_LOAI_VAN_THU.CONG_VAN_DI_BEN_NGOAI;
                v_us_gd_van_thu.dcID_PHAP_NHAN = CIPConvert.ToDecimal(m_cbx_phap_nhan.SelectedValue);

                //Tu Dong nhay so cong van
                if (m_dc_id_cong_van == 0)
                {
                    v_us_gd_van_thu.Insert();
                    //US_CM_DM_TU_DIEN v_us = new US_CM_DM_TU_DIEN();
                    //DS_CM_DM_TU_DIEN v_ds = new DS_CM_DM_TU_DIEN();
                    //v_us.FillDataset(v_ds, "where ma_tu_dien='" + m_cbx_phap_nhan.Text + "'");
                    //if (v_ds.CM_DM_TU_DIEN.Count > 0)
                    //{
                    //	string v_str_so = v_ds.Tables[0].Rows[0][CM_DM_TU_DIEN.TEN_NGAN].ToString();
                    //	string v_str_nam = v_ds.Tables[0].Rows[0][CM_DM_TU_DIEN.TEN].ToString();
                    //	v_str_so = CIPConvert.ToStr((CIPConvert.ToDecimal(v_str_so) + 1), "0#");
                    //	v_us.DataRow2Me(v_ds.Tables[0].Rows[0]);
                    //	v_us.strTEN = v_str_nam;
                    //	v_us.strTEN_NGAN = v_str_so;
                    //	v_us.Update();
                    //}
                }
                else v_us_gd_van_thu.Update();
                return true;
            }
            catch (Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);
                return false;
            }
        }
 private void m_cmd_save_Click(object sender, EventArgs e)
 {
     try
     {
         US_GD_VAN_THU v_us = new US_GD_VAN_THU();
         if (!check_data_is_ok()) return;
         if (save_data())
         {
             MessageBox.Show("Đã cập nhật văn bản thành công", "Thông báo");
             clear_form_data();
         }
         else
         {
             MessageBox.Show("Đã xảy lỗi trong quá trình xử lý!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception v_e)
     {
         CSystemLog_301.ExceptionHandle(v_e);
     }
 }
 private void form_to_us_object(US_GD_VAN_THU op_us)
 {
     op_us.dcID = m_dc_id_cong_van;
     op_us.dcID_LOAI_CONG_VAN = ID_LOAI_VAN_THU.CONG_VAN_DEN;
     op_us.dcID_PHAP_NHAN=CIPConvert.ToDecimal(m_cbx_phap_nhan.SelectedValue);
     op_us.dcID_TRANG_THAI = CIPConvert.ToDecimal(m_cbx_trang_thai.SelectedValue);
     op_us.dcID_NOI_NGUOI_NHAN = CIPConvert.ToDecimal(m_cbx_ban_luu.SelectedValue);
     op_us.strGHI_CHU = m_txt_ghi_chu.Text;
     op_us.strLINK_SCAN = m_txt_file_upload.Text;
     op_us.strNGUOI_KY = m_txt_nguoi_ky.Text;
     op_us.strNGUOI_LAP = m_txt_nguoi_nhap.Text;
     op_us.strNOI_NHAN = m_txt_noi_nhan.Text;
     if (m_tcd_ngay_nhap.getValue()==null)
     {
         op_us.SetNGAY_LAPNull();
     }
     else
     op_us.datNGAY_LAP = CIPConvert.ToDatetime(m_tcd_ngay_nhap.Text, "dd/MM/yyyy");
     if (m_tcd_ngay_tren_cv.getValue() == null)
     {
         op_us.SetNGAY_THANG_TREN_CONG_VANNull();
     }
     else
         op_us.datNGAY_THANG_TREN_CONG_VAN = CIPConvert.ToDatetime(m_tcd_ngay_tren_cv.Text, "dd/MM/yyyy");
 }