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 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"); }