Ejemplo n.º 1
0
        public C08_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
            {
                C08_DA          _obj_da   = new C08_DA();
                DataSet         dataSet   = _obj_da.GetByID(p_app_header_id, p_language_code);
                C08_Info_Export _C08_Info = CBO <C08_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(_C08_Info);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new C08_Info_Export());
            }
        }
Ejemplo n.º 2
0
        public static void Prepare_Data_Export_C08(ref C08_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
                C08_Info_Export.CopyAppHeaderInfo(ref app_Detail, applicationHeaderInfo);


                // copy class

                // copy tác giả



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

                if (_lst_Other_MasterInfo != null && _lst_Other_MasterInfo.Count > 2)
                {
                    C08_Info_Export.CopyOther_MasterInfo(ref app_Detail, _lst_Other_MasterInfo[1], 1);
                }
                else
                {
                    C08_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 == "C08_00")
                        {
                            app_Detail.Doc_Id_0       = item.CHAR01;
                            app_Detail.Doc_Id_002     = item.CHAR02;
                            app_Detail.Doc_Id_0_Check = item.Isuse;
                        }
                        if (item.Document_Id == "C08_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 == "C08_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 == "C08_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 == "C08_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 == "C08_05")
                        {
                            app_Detail.Doc_Id_5_Check = item.Isuse;
                            app_Detail.Doc_Id_5       = item.CHAR01;
                            app_Detail.Doc_Id_502     = item.CHAR02;
                        }

                        else if (item.Document_Id == "C08_06")
                        {
                            app_Detail.Doc_Id_6_Check = item.Isuse;
                            app_Detail.Doc_Id_6       = item.CHAR01;
                            app_Detail.Doc_Id_602     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_07")
                        {
                            app_Detail.Doc_Id_7_Check = item.Isuse;
                            app_Detail.Doc_Id_7       = item.CHAR01;
                            app_Detail.Doc_Id_702     = item.CHAR02;
                        }


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

                        else if (item.Document_Id == "C08_09")
                        {
                            app_Detail.Doc_Id_9_Check = item.Isuse;
                            app_Detail.Doc_Id_9       = item.CHAR01;
                            app_Detail.Doc_Id_902     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_10")
                        {
                            app_Detail.Doc_Id_10_Check = item.Isuse;
                            app_Detail.Doc_Id_10       = item.CHAR01;
                            app_Detail.Doc_Id_1002     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_11")
                        {
                            app_Detail.Doc_Id_11_Check = item.Isuse;
                            app_Detail.Doc_Id_11       = item.CHAR01;
                            app_Detail.Doc_Id_1102     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_12")
                        {
                            app_Detail.Doc_Id_12_Check = item.Isuse;
                            app_Detail.Doc_Id_12       = item.CHAR01;
                            app_Detail.Doc_Id_1202     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_13")
                        {
                            app_Detail.Doc_Id_13_Check = item.Isuse;
                            app_Detail.Doc_Id_13       = item.CHAR01;
                            app_Detail.Doc_Id_1302     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_14")
                        {
                            app_Detail.Doc_Id_14_Check = item.Isuse;
                            app_Detail.Doc_Id_14       = item.CHAR01;
                            app_Detail.Doc_Id_1402     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_15")
                        {
                            app_Detail.Doc_Id_15_Check = item.Isuse;
                            app_Detail.Doc_Id_15       = item.CHAR01;
                            app_Detail.Doc_Id_1502     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_15")
                        {
                            app_Detail.Doc_Id_15_Check = item.Isuse;
                            app_Detail.Doc_Id_15       = item.CHAR01;
                            app_Detail.Doc_Id_1502     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_16")
                        {
                            app_Detail.Doc_Id_16_Check = item.Isuse;
                            app_Detail.Doc_Id_16       = item.CHAR01;
                            app_Detail.Doc_Id_1602     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_17")
                        {
                            app_Detail.Doc_Id_17_Check = item.Isuse;
                            app_Detail.Doc_Id_17       = item.CHAR01;
                            app_Detail.Doc_Id_1702     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_18")
                        {
                            app_Detail.Doc_Id_18_Check = item.Isuse;
                            app_Detail.Doc_Id_18       = item.CHAR01;
                            app_Detail.Doc_Id_1802     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_19")
                        {
                            app_Detail.Doc_Id_19_Check = item.Isuse;
                            app_Detail.Doc_Id_19       = item.CHAR01;
                            app_Detail.Doc_Id_1902     = item.CHAR02;
                        }
                        else if (item.Document_Id == "C08_20")
                        {
                            app_Detail.Doc_Id_20_Check = item.Isuse;
                            app_Detail.Doc_Id_20       = item.CHAR01;
                            app_Detail.Doc_Id_2002     = 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.##");
                        }
                        if (item.Fee_Id == 11)
                        {
                            app_Detail.Fee_Id_11       = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_11_Check = item.Isuse;
                            app_Detail.Fee_Id_11_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 == 21)
                        {
                            app_Detail.Fee_Id_21       = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_21_Check = item.Isuse;
                            app_Detail.Fee_Id_21_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.##");
                        }
                        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.##");
                        }

                        else if (item.Fee_Id == 41)
                        {
                            app_Detail.Fee_Id_41       = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_41_Check = item.Isuse;
                            app_Detail.Fee_Id_41_Val   = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 5)
                        {
                            app_Detail.Fee_Id_5       = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_5_Check = item.Isuse;
                            app_Detail.Fee_Id_5_Val   = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 51)
                        {
                            app_Detail.Fee_Id_51       = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_51_Check = item.Isuse;
                            app_Detail.Fee_Id_51_Val   = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 6)
                        {
                            app_Detail.Fee_Id_6       = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_6_Check = item.Isuse;
                            app_Detail.Fee_Id_6_Val   = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 61)
                        {
                            app_Detail.Fee_Id_61       = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_61_Check = item.Isuse;
                            app_Detail.Fee_Id_61_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

                #region class


                //foreach (AppClassDetailInfo item in appClassDetailInfos.OrderBy(m => m.Code))
                //{
                //    // nếu là tiếng việt thì hiện tiếng anh
                //    if (AppsCommon.GetCurrentLang() == "VI_VN")
                //    {
                //        app_Detail.strListClass += "Nhóm" + item.Code.Substring(0, 2) + ": " + item.Textinput.Trim().Trim(',') + " (" + (item.IntTongSanPham < 10 ? "0" + item.IntTongSanPham.ToString() : item.IntTongSanPham.ToString()) + " " + "sản phẩm" + " )" + "\n";
                //    }
                //    else
                //    {
                //        app_Detail.strListClass += "Class " + item.Code.Substring(0, 2) + ": " + item.Textinput.Trim().Trim(',') + " (" + (item.IntTongSanPham < 10 ? "0" + item.IntTongSanPham.ToString() : item.IntTongSanPham.ToString()) + " " + "gooods" + " )" + "\n";

                //    }
                //}

                #endregion
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }
Ejemplo n.º 3
0
        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 C08_BL();
                List <C08_Info_Export> _lst = new List <C08_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>();
                C08_Info_Export pDetail = objBL.GetByID_Exp(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref _lst_appFeeFixInfos,
                                                            ref _lst_Other_MasterInfo, ref _LstDocumentOthersInfo);

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

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

                _lst.Add(pDetail);
                DataSet _ds_all = ConvertData.ConvertToDataSet <C08_Info_Export>(_lst, false);
                try
                {
                    _ds_all.WriteXml(@"C:\inetpub\C08.xml", XmlWriteMode.WriteSchema);
                }
                catch (Exception ex)
                {
                    Logger.LogException(ex);
                }
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _tempfile = "C08.rpt";
                if (p_Language == Language.LangEN)
                {
                    _tempfile = "C08_EN.rpt";
                }
                oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile));

                if (_ds_all != null)
                {
                    _ds_all.Tables[0].TableName = "Table";
                    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 }));
            }
        }