コード例 #1
0
        public A05_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 <Other_MasterInfo> pOther_MasterInfo,
                                           ref List <AppDocumentOthersInfo> pAppDocOtherInfo)
        {
            try
            {
                A05_DA          _obj_da   = new A05_DA();
                DataSet         dataSet   = _obj_da.GetByID(p_app_header_id, p_language_code);
                A05_Info_Export _A05_Info = CBO <A05_Info_Export> .FillObjectFromDataSet(dataSet);

                if (dataSet != null && dataSet.Tables.Count == 6)
                {
                    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]);

                    pAppDocOtherInfo = CBO <AppDocumentOthersInfo> .FillCollectionFromDataTable(dataSet.Tables[5]);
                }
                return(_A05_Info);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new A05_Info_Export());
            }
        }
コード例 #2
0
ファイル: A05Controller.cs プロジェクト: SangDD/Legaltech
        public static void Prepare_Data_Export_A05(ref A05_Info_Export app_Detail, ApplicationHeaderInfo applicationHeaderInfo,
                                                   List <AppDocumentInfo> appDocumentInfos, List <AppFeeFixInfo> _lst_appFeeFixInfos, List <Other_MasterInfo> _lst_Other_MasterInfo,
                                                   List <AppDocumentOthersInfo> _LstDocumentOthersInfo)
        {
            try
            {
                // copy Header
                A05_Info_Export.CopyAppHeaderInfo(ref app_Detail, applicationHeaderInfo);

                foreach (var item in MemoryData.c_lst_Country)
                {
                    if (app_Detail.NUOCDANGKY == item.Country_Id.ToString())
                    {
                        app_Detail.TENNUOCDANGKY = item.Name;
                        break;
                    }
                }
                // copy class

                // copy tác giả



                // copy chủ đơn khác
                if (_lst_Other_MasterInfo != null && _lst_Other_MasterInfo.Count > 1)
                {
                    A05_Info_Export.CopyOther_MasterInfo(ref app_Detail, _lst_Other_MasterInfo[0], 0);
                }
                else
                {
                    A05_Info_Export.CopyOther_MasterInfo(ref app_Detail, null, 0);
                }

                if (_lst_Other_MasterInfo != null && _lst_Other_MasterInfo.Count > 2)
                {
                    A05_Info_Export.CopyOther_MasterInfo(ref app_Detail, _lst_Other_MasterInfo[1], 1);
                }
                else
                {
                    A05_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 == "A05_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 == "A05_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 == "A05_03")
                        {
                            app_Detail.Doc_Id_3_Check = item.Isuse;
                            app_Detail.Doc_Id_3       = item.CHAR01;
                            app_Detail.Doc_Id_302     = item.CHAR02;
                        }
                        else if (item.Document_Id == "A05_04")
                        {
                            app_Detail.Doc_Id_4       = item.CHAR01;
                            app_Detail.Doc_Id_4_Check = item.Isuse;
                            app_Detail.Doc_Id_402     = item.CHAR02;
                        }
                        else if (item.Document_Id == "A05_05")
                        {
                            app_Detail.Doc_Id_5_Check = item.Isuse;
                            app_Detail.Doc_Id_5       = item.CHAR01;
                        }

                        else if (item.Document_Id == "A05_06")
                        {
                            app_Detail.Doc_Id_6_Check = item.Isuse;
                            app_Detail.Doc_Id_6       = item.CHAR01;
                        }
                        else if (item.Document_Id == "A05_07")
                        {
                            app_Detail.Doc_Id_7_Check = item.Isuse;
                            app_Detail.Doc_Id_7       = item.CHAR01;
                        }


                        else if (item.Document_Id == "A05_08")
                        {
                            app_Detail.Doc_Id_8_Check = item.Isuse;
                            app_Detail.Doc_Id_8       = item.CHAR01;
                        }

                        else if (item.Document_Id == "A05_09")
                        {
                            app_Detail.Doc_Id_9       = item.CHAR01;
                            app_Detail.Doc_Id_9_Check = item.Isuse;
                        }
                        else if (item.Document_Id == "A05_10")
                        {
                            app_Detail.Doc_Id_10_Check = item.Isuse;
                            app_Detail.Doc_Id_10       = item.CHAR01;
                        }
                        else if (item.Document_Id == "A05_11")
                        {
                            app_Detail.Doc_Id_11_Check = item.Isuse;
                            app_Detail.Doc_Id_11       = item.CHAR01;
                        }
                        else if (item.Document_Id == "A05_12")
                        {
                            app_Detail.Doc_Id_12_Check = item.Isuse;
                            app_Detail.Doc_Id_12       = item.CHAR01;
                        }
                        else if (item.Document_Id == "A05_13")
                        {
                            app_Detail.Doc_Id_13_Check = item.Isuse;
                            app_Detail.Doc_Id_13       = item.CHAR01;
                        }
                    }
                }

                #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 == 4)
                        {
                            app_Detail.Fee_Id_4       = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_4_Check = item.Isuse;
                            app_Detail.Fee_Id_4_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);
            }
        }
コード例 #3
0
ファイル: A05Controller.cs プロジェクト: SangDD/Legaltech
        public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, string p_Language)
        {
            try
            {
                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string language     = AppsCommon.GetCurrentLang();

                var objBL = new A05_BL();
                List <A05_Info_Export> _lst = new List <A05_Info_Export>();

                List <AppDocumentInfo>       appDocumentInfos       = new List <AppDocumentInfo>();
                List <AppFeeFixInfo>         _lst_appFeeFixInfos    = new List <AppFeeFixInfo>();
                ApplicationHeaderInfo        applicationHeaderInfo  = new ApplicationHeaderInfo();
                List <Other_MasterInfo>      _lst_Other_MasterInfo  = new List <Other_MasterInfo>();
                List <AppDocumentOthersInfo> _LstDocumentOthersInfo = new List <AppDocumentOthersInfo>();
                A05_Info_Export pDetail = objBL.GetByID_Exp(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref _lst_appFeeFixInfos,
                                                            ref _lst_Other_MasterInfo, ref _LstDocumentOthersInfo);
                pDetail.IMG_URL = Server.MapPath(pDetail.IMG_URL);
                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf");
                if (pDetail.Languague_Code == Language.LangVI)
                {
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf";
                }
                else
                {
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_EN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A05_EN_" + _datetimenow + ".pdf";
                }

                Prepare_Data_Export_A05(ref pDetail, applicationHeaderInfo, appDocumentInfos, _lst_appFeeFixInfos, _lst_Other_MasterInfo,
                                        _LstDocumentOthersInfo);

                _lst.Add(pDetail);
                DataSet _ds_all = ConvertData.ConvertToDataSet <A05_Info_Export>(_lst, false);
                _ds_all.WriteXml(@"C:\inetpub\A05.xml", XmlWriteMode.WriteSchema);
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _tempfile = "A05.rpt";
                if (p_Language == Language.LangEN)
                {
                    _tempfile = "A05_EN.rpt";
                }
                oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile));
                #region Set vị trí ảnh

                CrystalDecisions.CrystalReports.Engine.PictureObject _pic01;
                _pic01        = (CrystalDecisions.CrystalReports.Engine.PictureObject)oRpt.ReportDefinition.Sections[0].ReportObjects["Picture1"];
                _pic01.Width  = 200;
                _pic01.Height = 200;
                try
                {
                    Bitmap img = new Bitmap(pDetail.IMG_URL);
                    try
                    {
                        double _Const = 6.666666666666 / 2;
                        int    _left = 0, _top = 0, _marginleft = 225, _margintop = 3540;
                        int    _h  = 600;
                        double _d1 = (_h - img.Width) / 2;
                        _d1   = _Const * _d1;
                        _left = _marginleft + Convert.ToInt32(_d1);
                        if (_left < 0)
                        {
                            _left = _marginleft;
                        }
                        _pic01.Left = _left;
                        // top

                        _d1  = (_h - img.Height) / 2;
                        _d1  = _Const * _d1;
                        _top = _margintop + Convert.ToInt32(_d1);
                        if (_top < 0)
                        {
                            _top = _margintop;
                        }
                        _pic01.Top = _top;
                    }
                    catch (Exception ex)
                    {
                        Logger.LogException(ex);
                    }
                    finally
                    {
                        img.Dispose();
                    }
                }
                catch (Exception ex)
                {
                }

                System.IO.FileInfo file = new System.IO.FileInfo(pDetail.IMG_URL);

                #endregion
                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 }));
            }
        }
コード例 #4
0
ファイル: A05Controller.cs プロジェクト: SangDD/Legaltech
        public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, A05_Info pDetail,
                                               List <AppDocumentInfo> pAppDocumentInfo,
                                               List <AppFeeFixInfo> pFeeFixInfo,
                                               List <Other_MasterInfo> pOther_MasterInfo,
                                               List <AppClassDetailInfo> pAppClassInfo,
                                               List <AppDocumentOthersInfo> pAppDocOtherInfo
                                               )
        {
            try
            {
                string _datetimenow         = DateTime.Now.ToString("ddMMyyyyHHmm");
                string language             = AppsCommon.GetCurrentLang();
                var    objBL                = new A05_BL();
                List <A05_Info_Export> _lst = new List <A05_Info_Export>();

                string p_appCode = "A05_Preview";

                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf");
                if (language == Language.LangVI)
                {
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A05_VN_" + _datetimenow + ".pdf";
                }
                else
                {
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "A05_EN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "A05_EN_" + _datetimenow + ".pdf";
                }

                A05_Info_Export _A05_Info_Export = new A05_Info_Export();
                if (string.IsNullOrEmpty(pDetail.IMG_URL))
                {
                    pDetail.IMG_URL = pDetail.IMG_URLOrg;
                }
                if (pDetail.pfileLogo != null)
                {
                    pDetail.IMG_URL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                }
                A05_Info_Export.CopyA05_Info(ref _A05_Info_Export, pDetail);

                _A05_Info_Export.IMG_URL = Server.MapPath(_A05_Info_Export.IMG_URL);

                // Phí cố định

                List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_A05(pDetail, pAppDocumentInfo);
                Prepare_Data_Export_A05(ref _A05_Info_Export, pInfo, pAppDocumentInfo, _lstFeeFix, pOther_MasterInfo,
                                        pAppDocOtherInfo);

                _lst.Add(_A05_Info_Export);
                DataSet _ds_all = ConvertData.ConvertToDataSet <A05_Info_Export>(_lst, false);
                //_ds_all.WriteXml(@"C:\inetpub\A05.xml", XmlWriteMode.WriteSchema);
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _tempfile = "A05.rpt";
                if (pInfo.View_Language_Report == Language.LangEN)
                {
                    _tempfile = "A05_EN.rpt";
                }
                oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile));
                #region Set vị trí ảnh

                CrystalDecisions.CrystalReports.Engine.PictureObject _pic01;
                _pic01        = (CrystalDecisions.CrystalReports.Engine.PictureObject)oRpt.ReportDefinition.Sections[0].ReportObjects["Picture1"];
                _pic01.Width  = 200;
                _pic01.Height = 200;
                try
                {
                    pDetail.IMG_URL = Server.MapPath(pDetail.IMG_URL);
                    Bitmap img = new Bitmap(pDetail.IMG_URL);
                    try
                    {
                        double _Const = 6.666666666666 / 2;
                        int    _left = 0, _top = 0, _marginleft = 225, _margintop = 3540;
                        int    _h  = 600;
                        double _d1 = (_h - img.Width) / 2;
                        _d1   = _Const * _d1;
                        _left = _marginleft + Convert.ToInt32(_d1);
                        if (_left < 0)
                        {
                            _left = _marginleft;
                        }
                        _pic01.Left = _left;
                        // top

                        _d1  = (_h - img.Height) / 2;
                        _d1  = _Const * _d1;
                        _top = _margintop + Convert.ToInt32(_d1);
                        if (_top < 0)
                        {
                            _top = _margintop;
                        }
                        _pic01.Top = _top;
                    }
                    catch (Exception ex)
                    {
                        Logger.LogException(ex);
                    }
                    finally
                    {
                        img.Dispose();
                    }
                }
                catch (Exception)
                {
                }

                System.IO.FileInfo file = new System.IO.FileInfo(pDetail.IMG_URL);

                #endregion
                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 }));
            }
        }