public A02_Info_Export GetByID_Exp(decimal p_app_header_id, string p_language_code, ref ApplicationHeaderInfo applicationHeaderInfo, ref List <AppDocumentInfo> appDocumentInfos, ref List <AppFeeFixInfo> appFeeFixInfos, ref List <AuthorsInfo> pAppAuthorsInfo, ref List <Other_MasterInfo> pOther_MasterInfo, ref List <AppDocumentOthersInfo> pAppDocOtherInfo, ref List <AppDocumentOthersInfo> pLstIndustyDesign) { try { A02_DA _obj_da = new A02_DA(); DataSet dataSet = _obj_da.GetByID(p_app_header_id, p_language_code); A02_Info_Export _A02_Info = CBO <A02_Info_Export> .FillObjectFromDataSet(dataSet); if (dataSet != null && dataSet.Tables.Count == 8) { applicationHeaderInfo = CBO <ApplicationHeaderInfo> .FillObjectFromDataTable(dataSet.Tables[1]); appDocumentInfos = CBO <AppDocumentInfo> .FillCollectionFromDataTable(dataSet.Tables[2]); appFeeFixInfos = CBO <AppFeeFixInfo> .FillCollectionFromDataTable(dataSet.Tables[3]); pOther_MasterInfo = CBO <Other_MasterInfo> .FillCollectionFromDataTable(dataSet.Tables[4]); pAppAuthorsInfo = CBO <AuthorsInfo> .FillCollectionFromDataTable(dataSet.Tables[5]); pAppDocOtherInfo = CBO <AppDocumentOthersInfo> .FillCollectionFromDataTable(dataSet.Tables[6]); pLstIndustyDesign = CBO <AppDocumentOthersInfo> .FillCollectionFromDataTable(dataSet.Tables[7]); } return(_A02_Info); } catch (Exception ex) { Logger.LogException(ex); return(new A02_Info_Export()); } }
public static void Prepare_Data_Export_A02(ref A02_Info_Export app_Detail, ApplicationHeaderInfo applicationHeaderInfo, List <AppDocumentInfo> appDocumentInfos, List <AppFeeFixInfo> _lst_appFeeFixInfos, List <AuthorsInfo> _lst_authorsInfos, List <Other_MasterInfo> _lst_Other_MasterInfo, List <AppDocumentOthersInfo> _LstDocumentOthersInfo, List <AppDocumentOthersInfo> pAppDocDesign) { try { // copy Header A02_Info_Export.CopyAppHeaderInfo(ref app_Detail, applicationHeaderInfo); // copy class // copy tác giả if (_lst_authorsInfos != null && _lst_authorsInfos.Count > 0) { A02_Info_Export.CopyAuthorsInfo(ref app_Detail, _lst_authorsInfos[0], 0); } if (_lst_authorsInfos != null && _lst_authorsInfos.Count > 1) { A02_Info_Export.CopyAuthorsInfo(ref app_Detail, _lst_authorsInfos[1], 1); app_Detail.Author_Others = "Y"; } else { A02_Info_Export.CopyAuthorsInfo(ref app_Detail, null, 1); app_Detail.Author_Others = "N"; } if (_lst_authorsInfos != null && _lst_authorsInfos.Count > 2) { A02_Info_Export.CopyAuthorsInfo(ref app_Detail, _lst_authorsInfos[2], 2); } else { A02_Info_Export.CopyAuthorsInfo(ref app_Detail, null, 2); } // copy chủ đơn khác if (_lst_Other_MasterInfo != null && _lst_Other_MasterInfo.Count > 1) { A02_Info_Export.CopyOther_MasterInfo(ref app_Detail, _lst_Other_MasterInfo[0], 0); } else { A02_Info_Export.CopyOther_MasterInfo(ref app_Detail, null, 0); } if (_lst_Other_MasterInfo != null && _lst_Other_MasterInfo.Count > 2) { A02_Info_Export.CopyOther_MasterInfo(ref app_Detail, _lst_Other_MasterInfo[1], 1); } else { A02_Info_Export.CopyOther_MasterInfo(ref app_Detail, null, 1); } #region Tài liệu có trong đơn if (_LstDocumentOthersInfo != null) { foreach (var item in _LstDocumentOthersInfo) { if (!string.IsNullOrEmpty(item.Documentname)) { app_Detail.strDanhSachFileDinhKem += item.Documentname + " ; "; } } if (!string.IsNullOrEmpty(app_Detail.strDanhSachFileDinhKem)) { app_Detail.strDanhSachFileDinhKem = app_Detail.strDanhSachFileDinhKem.Substring(0, app_Detail.strDanhSachFileDinhKem.Length - 2); } } if (appDocumentInfos != null) { foreach (AppDocumentInfo item in appDocumentInfos) { if (item.Document_Id == "A02_01") { app_Detail.Doc_Id_1 = item.CHAR01; app_Detail.Doc_Id_102 = item.CHAR02; app_Detail.Doc_Id_1_Check = item.Isuse; } else if (item.Document_Id == "A02_02") { app_Detail.Doc_Id_2 = item.CHAR01; app_Detail.Doc_Id_202 = item.CHAR02; app_Detail.Doc_Id_2_Check = item.Isuse; } else if (item.Document_Id == "A02_03") { app_Detail.Doc_Id_3_Check = item.Isuse; app_Detail.Doc_Id_3 = item.CHAR01; } else if (item.Document_Id == "A02_04") { app_Detail.Doc_Id_4 = item.CHAR01; app_Detail.Doc_Id_4_Check = item.Isuse; } else if (item.Document_Id == "A02_05") { app_Detail.Doc_Id_5_Check = item.Isuse; app_Detail.Doc_Id_5 = item.CHAR01; } else if (item.Document_Id == "A02_06") { app_Detail.Doc_Id_6_Check = item.Isuse; app_Detail.Doc_Id_6 = item.CHAR01; } else if (item.Document_Id == "A02_07") { app_Detail.Doc_Id_7_Check = item.Isuse; app_Detail.Doc_Id_7 = item.CHAR01; } else if (item.Document_Id == "A02_08") { app_Detail.Doc_Id_8_Check = item.Isuse; app_Detail.Doc_Id_8 = item.CHAR01; } else if (item.Document_Id == "A02_09") { app_Detail.Doc_Id_9 = item.CHAR01; app_Detail.Doc_Id_9_Check = item.Isuse; } else if (item.Document_Id == "A02_10") { app_Detail.Doc_Id_10_Check = item.Isuse; app_Detail.Doc_Id_10 = item.CHAR01; } else if (item.Document_Id == "A02_11") { app_Detail.Doc_Id_11_Check = item.Isuse; app_Detail.Doc_Id_11 = item.CHAR01; } else if (item.Document_Id == "A02_12") { app_Detail.Doc_Id_12_Check = item.Isuse; app_Detail.Doc_Id_12 = item.CHAR01; app_Detail.Doc_Id_1202 = item.CHAR02; } } } #endregion #region Fee if (_lst_appFeeFixInfos.Count > 0) { foreach (var item in _lst_appFeeFixInfos) { if (item.Fee_Id == 1) { app_Detail.Fee_Id_1 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString(); app_Detail.Fee_Id_1_Check = item.Isuse; app_Detail.Fee_Id_1_Val = item.Amount.ToString("#,##0.##"); } else if (item.Fee_Id == 2) { app_Detail.Fee_Id_2 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString(); app_Detail.Fee_Id_2_Check = item.Isuse; app_Detail.Fee_Id_2_Val = item.Amount.ToString("#,##0.##"); } else if (item.Fee_Id == 3) { app_Detail.Fee_Id_3 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString(); app_Detail.Fee_Id_3_Check = item.Isuse; app_Detail.Fee_Id_3_Val = item.Amount.ToString("#,##0.##"); } else if (item.Fee_Id == 31) { app_Detail.Fee_Id_31 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString(); app_Detail.Fee_Id_31_Check = item.Isuse; app_Detail.Fee_Id_31_Val = item.Amount.ToString("#,##0.##"); } app_Detail.Total_Fee = app_Detail.Total_Fee + item.Amount; app_Detail.Total_Fee_Str = app_Detail.Total_Fee.ToString("#,##0.##"); } } #endregion } catch (Exception ex) { Logger.LogException(ex); } }
public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, decimal p_View_Translate) { try { string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm"); string language = AppsCommon.GetCurrentLang(); var objBL = new A02_BL(); List <A02_Info_Export> _lst = new List <A02_Info_Export>(); List <AppDocumentInfo> appDocumentInfos = new List <AppDocumentInfo>(); List <AppFeeFixInfo> _lst_appFeeFixInfos = new List <AppFeeFixInfo>(); ApplicationHeaderInfo applicationHeaderInfo = new ApplicationHeaderInfo(); List <AuthorsInfo> _lst_authorsInfos = new List <AuthorsInfo>(); List <Other_MasterInfo> _lst_Other_MasterInfo = new List <Other_MasterInfo>(); List <AppDocumentOthersInfo> _LstDocumentOthersInfo = new List <AppDocumentOthersInfo>(); List <AppDocumentOthersInfo> pLstImageDesign = new List <AppDocumentOthersInfo>(); A02_Info_Export app_Detail = objBL.GetByID_Exp(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref _lst_appFeeFixInfos, ref _lst_authorsInfos, ref _lst_Other_MasterInfo, ref _LstDocumentOthersInfo, ref pLstImageDesign); Prepare_Data_Export_A02(ref app_Detail, applicationHeaderInfo, appDocumentInfos, _lst_appFeeFixInfos, _lst_authorsInfos, _lst_Other_MasterInfo, _LstDocumentOthersInfo, pLstImageDesign); _lst.Add(app_Detail); DataSet _ds_all = ConvertData.ConvertToDataSet <A02_Info_Export>(_lst, false); _ds_all.WriteXml(@"C:\inetpub\A02.xml", XmlWriteMode.WriteSchema); CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); string _tempfile = "A02.rpt"; if (p_View_Translate == 1) { // nếu là tiếng việt thì xem bản tiếng anh và ngược lại if (app_Detail.Languague_Code == Language.LangVI) { _tempfile = "A02_EN.rpt"; // tiếng anh fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"; } else { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"; } } else { if (app_Detail.Languague_Code == Language.LangVI) { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"; } else { _tempfile = "A02_EN.rpt"; // tiếng anh fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"; } } oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile)); if (_ds_all != null) { _ds_all.Tables[0].TableName = "Table1"; oRpt.SetDataSource(_ds_all); } oRpt.Refresh(); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); //oRpt.ExportToDisk(ExportFormatType.PortableDocFormat, fileName_pdf); System.IO.Stream oStream = oRpt.ExportToStream(ExportFormatType.PortableDocFormat); byte[] byteArray = new byte[oStream.Length]; oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1)); System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq return(Json(new { success = 0 })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = 0 })); } }
public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, A02_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo, List <AuthorsInfo> pAppAuthorsInfo, List <Other_MasterInfo> pOther_MasterInfo, List <AppClassDetailInfo> pAppClassInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo, List <UTienInfo> pUTienInfo, List <AppDocumentOthersInfo> pAppDocDesign) { try { string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm"); string language = AppsCommon.GetCurrentLang(); var objBL = new A02_BL(); List <A02_Info_Export> _lst = new List <A02_Info_Export>(); string p_appCode = "A02_Preview"; string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); if (language == Language.LangVI) { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_VN_" + _datetimenow + ".pdf"; } else { fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"); SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A02_EN_" + _datetimenow + ".pdf"; } A02_Info_Export _A02_Info_Export = new A02_Info_Export(); A02_Info_Export.CopyA02_Info(ref _A02_Info_Export, pDetail); // Phí cố định List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_A02(pDetail, pAppDocumentInfo, pAppDocDesign); Prepare_Data_Export_A02(ref _A02_Info_Export, pInfo, pAppDocumentInfo, _lstFeeFix, pAppAuthorsInfo, pOther_MasterInfo, pAppDocOtherInfo, pAppDocDesign); _lst.Add(_A02_Info_Export); DataSet _ds_all = ConvertData.ConvertToDataSet <A02_Info_Export>(_lst, false); //_ds_all.WriteXml(@"C:\inetpub\A02.xml", XmlWriteMode.WriteSchema); CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); string _tempfile = "A02.rpt"; if (language == Language.LangEN) { _tempfile = "A02_EN.rpt"; } oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile)); if (_ds_all != null) { _ds_all.Tables[0].TableName = "Table1"; oRpt.SetDataSource(_ds_all); } oRpt.Refresh(); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); System.IO.Stream oStream = oRpt.ExportToStream(ExportFormatType.PortableDocFormat); byte[] byteArray = new byte[oStream.Length]; oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1)); System.IO.File.WriteAllBytes(fileName_pdf, byteArray.ToArray()); // Requires System.Linq return(Json(new { success = 0 })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = 0 })); } }