public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, decimal p_View_Translate)
        {
            try
            {
                string language = AppsCommon.GetCurrentLang();

                App_Detail_PLB01_SDD_BL   objBL = new App_Detail_PLB01_SDD_BL();
                ApplicationHeaderInfo     applicationHeaderInfo = new ApplicationHeaderInfo();
                App_Detail_PLB01_SDD_Info app_Detail            = new App_Detail_PLB01_SDD_Info();
                List <AppFeeFixInfo>      appFeeFixInfos        = new List <AppFeeFixInfo>();
                List <AppDocumentInfo>    appDocumentInfos      = new List <AppDocumentInfo>();
                app_Detail = objBL.GetByID(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref appFeeFixInfos);

                AppsCommon.Prepare_Data_Export_3B(ref app_Detail, applicationHeaderInfo, appDocumentInfos);
                List <App_Detail_PLB01_SDD_Info> _lst = new List <App_Detail_PLB01_SDD_Info>();
                _lst.Add(app_Detail);
                DataSet _ds_all = ConvertData.ConvertToDataSet <App_Detail_PLB01_SDD_Info>(_lst, false);
                //_ds_all.WriteXml(@"C:\inetpub\B01.xml", XmlWriteMode.WriteSchema);

                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string _tempfile    = "TM_PLB01SDD.rpt";
                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "B01_VN_" + _datetimenow + ".pdf");
                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 (applicationHeaderInfo.Languague_Code == Language.LangVI)
                    {
                        _tempfile    = "TM_PLB01SDD_EN.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "B01_EN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "B01_EN_" + _datetimenow + ".pdf";
                    }
                    else
                    {
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "B01_VN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "B01_VN_" + _datetimenow + ".pdf";
                    }
                }
                else
                {
                    if (applicationHeaderInfo.Languague_Code == Language.LangVI)
                    {
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "B01_VN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "B01_VN_" + _datetimenow + ".pdf";
                    }
                    else
                    {
                        _tempfile    = "TM_PLB01SDD_EN.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "B01_EN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "B01_EN_" + _datetimenow + ".pdf";
                    }
                }

                oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile));

                if (_ds_all != null)
                {
                    _ds_all.Tables[0].TableName = "Table";
                    // đè các bản dịch lên
                    if (p_View_Translate == 1)
                    {
                        // nếu là bản xem của thằng dịch
                        App_Translate_BL          _App_Translate_BL = new App_Translate_BL();
                        List <App_Translate_Info> _lst_translate    = _App_Translate_BL.App_Translate_GetBy_AppId(pAppHeaderId);

                        AppsCommon.Overwrite_DataSouce_Export(ref _ds_all, _lst_translate);
                    }

                    oRpt.Database.Tables["Table"].SetDataSource(_ds_all.Tables[0]);
                    //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 }));
            }
        }
Exemple #2
0
 void Get_AppHeaderbyId(decimal p_AppHeaderId = 0)
 {
     try
     {
         Application_Header_BL _Application_Header_BL = new Application_Header_BL();
         c_ApplicationHeaderInfo = _Application_Header_BL.GetApplicationHeader_ById(p_AppHeaderId, AppsCommon.GetCurrentLang());
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
     }
 }
Exemple #3
0
        public ActionResult Edit(ApplicationHeaderInfo pInfo, C07_Info pDetail,
            List<AppDocumentInfo> pAppDocumentInfo, List<AppFeeFixInfo> pFeeFixInfo, List<Other_MasterInfo> pOther_MasterInfo,
             List<AppDocumentOthersInfo> pAppDocOtherInfo, List<AppClassDetailInfo> pAppClassInfo)
        {
            try
            {
                Application_Header_BL objBL = new Application_Header_BL();
                AppFeeFixBL objFeeFixBL = new AppFeeFixBL();
                C07_BL objDetail = new C07_BL();
                AppClassDetailBL objClassDetail = new AppClassDetailBL();
                if (pInfo == null || pDetail == null) return Json(new { status = ErrorCode.Error });
                string language = AppsCommon.GetCurrentLang();
                decimal pReturn = ErrorCode.Success;
                int pAppHeaderID = (int)pInfo.Id;
                string p_case_code = pInfo.Case_Code;

                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    pInfo.Modify_By = SessionData.CurrentUser.Username;
                    pInfo.Modify_Date = SessionData.CurrentUser.CurrentDate;
                    pInfo.Send_Date = DateTime.Now;
                    pInfo.DDSHCN = "";
                    pInfo.MADDSHCN = "";
                    //TRA RA ID CUA BANG KHI INSERT
                    pReturn = objBL.AppHeaderUpdate(pInfo);
                    if (pReturn < 0)
                        goto Commit_Transaction;

                    // detail
                    if (pAppHeaderID >= 0)
                    {
                        pDetail.Appcode = pInfo.Appcode;
                        pDetail.Language_Code = language;
                        pDetail.App_Header_Id = pAppHeaderID;
                        pDetail.Case_Code = p_case_code;
                        if (pDetail.pfileLogo != null)
                        {
                            pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                        }
                        else
                        {
                            pDetail.LOGOURL = pDetail.IMG_URLOrg;
                        }
                        pReturn = objDetail.UpDate(pDetail);

                        if (pReturn < 0)
                            goto Commit_Transaction;

                        #region  Thêm thông tin class
                        if (pReturn >= 0 && pAppClassInfo != null)
                        {

                            //Xoa cac class cu di 
                            pReturn = objClassDetail.AppClassDetailDeleted(pInfo.Id, language);
                            if (pReturn < 0)
                                goto Commit_Transaction;

                            pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pInfo.Id, language);

                            if (pReturn < 0)
                                goto Commit_Transaction;
                        }
                        #endregion

                    }



                    // ok 
                    Other_Master_BL _Other_Master_BL = new Other_Master_BL();
                    _Other_Master_BL.Deleted(pInfo.Case_Code, language);
                    if (pOther_MasterInfo != null && pOther_MasterInfo.Count > 0)
                    {
                        foreach (var item in pOther_MasterInfo)
                        {
                            item.Case_Code = pInfo.Case_Code;
                            item.App_Header_Id = pAppHeaderID;
                        }

                        decimal _re = _Other_Master_BL.Insert(pOther_MasterInfo);
                        if (_re <= 0)
                            goto Commit_Transaction;
                    }




                    //tai lieu khac 
                    #region Tài liệu khác
                    AppDocumentBL objDoc = new AppDocumentBL();
                    List<AppDocumentOthersInfo> Lst_Doc_Others = objDoc.DocumentOthers_GetByAppHeader(pInfo.Id, language);
                    List<AppDocumentOthersInfo> Lst_Doc_Others_Old = Lst_Doc_Others.FindAll(m => m.FILETYPE == 1).ToList();
                    Dictionary<decimal, AppDocumentOthersInfo> _dic_doc_others = new Dictionary<decimal, AppDocumentOthersInfo>();
                    foreach (AppDocumentOthersInfo item in Lst_Doc_Others_Old)
                    {
                        _dic_doc_others[item.Id] = item;
                    }

                    // xóa đi trước insert lại sau
                    objDoc.AppDocumentOtherDeletedByApp_Type(pInfo.Id, language, 1);

                    if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0)
                    {
                        int check = 0;
                        foreach (var info in pAppDocOtherInfo)
                        {
                            if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                            {
                                string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                info.Filename = _url;
                                check = 1;
                            }
                            else if (_dic_doc_others.ContainsKey(info.Id))
                            {
                                info.Filename = _dic_doc_others[info.Id].Filename;
                                check = 1;
                            }
                            info.App_Header_Id = pAppHeaderID;
                            info.Language_Code = language;
                        }
                        if (check == 1)
                        {
                            pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo);
                        }
                    }
                    #endregion


                    #region tính phí
                    // xóa đi
                    AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                    _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language);

                    List<AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_C07(pDetail, pAppClassInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                            goto Commit_Transaction;
                    }
                    #endregion

                    #region Tai lieu dinh kem 
                    if (pReturn >= 0 && pAppDocumentInfo != null && pAppDocumentInfo.Count > 0)
                    {
                        // Get ra để map sau đó xóa đi để insert vào sau
                        AppDocumentBL _AppDocumentBL = new AppDocumentBL();
                        List<AppDocumentInfo> Lst_AppDoc = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.App_Header_Id, language);
                        Dictionary<string, AppDocumentInfo> dic_appDoc = new Dictionary<string, AppDocumentInfo>();
                        foreach (AppDocumentInfo item in Lst_AppDoc)
                        {
                            dic_appDoc[item.Document_Id] = item;
                        }

                        // xóa đi trước
                        _AppDocumentBL.AppDocumentDelByApp(pDetail.App_Header_Id, language);

                        foreach (var info in pAppDocumentInfo)
                        {
                            info.App_Header_Id = pDetail.App_Header_Id;
                            if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                            {
                                var _updateitem = SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                if (_updateitem.GetType() == typeof(string))
                                {
                                    string _url = (string)_updateitem;
                                    string[] _arr = _url.Split('/');
                                    string _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status = 0;
                                }
                            }
                            else
                            {
                                if (dic_appDoc.ContainsKey(info.Document_Id))
                                {
                                    info.Filename = dic_appDoc[info.Document_Id].Filename;
                                    info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy;
                                    info.Status = dic_appDoc[info.Document_Id].Status;
                                }
                            }

                            info.App_Header_Id = pAppHeaderID;
                            info.Document_Filing_Date = CommonFuc.CurrentDate();
                            info.Language_Code = language;
                        }
                        pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID);
                    }
                #endregion

                //end
                Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                        return Json(new { status = -1 });

                    }
                    else
                    {
                        scope.Complete();
                    }
                }
                return Json(new { status = pAppHeaderID });

            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return Json(new { status = ErrorCode.Error });
            }
        }
        public ActionResult Register_PLB_01_SDD(ApplicationHeaderInfo pInfo, App_Detail_PLB01_SDD_Info pDetail,
                                                List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL   objBL       = new Application_Header_BL();
                AppFeeFixBL             objFeeFixBL = new AppFeeFixBL();
                App_Detail_PLB01_SDD_BL objDetail   = new App_Detail_PLB01_SDD_BL();
                AppDocumentBL           objDoc      = new AppDocumentBL();
                if (pInfo == null || pDetail == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string language = AppsCommon.GetCurrentLang();

                var CreatedBy = SessionData.CurrentUser.Username;

                var     CreatedDate  = SessionData.CurrentUser.CurrentDate;
                decimal pReturn      = ErrorCode.Success;
                int     pAppHeaderID = 0;
                string  p_case_code  = "";

                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    if (pInfo.Created_By == null || pInfo.Created_By == "0" || pInfo.Created_By == "")
                    {
                        pInfo.Created_By = CreatedBy;
                    }

                    pInfo.Created_Date = CreatedDate;
                    pInfo.Send_Date    = DateTime.Now;
                    //pInfo.Status = (decimal)CommonEnums.App_Status.DaGui_ChoPhanLoai;

                    //TRA RA ID CUA BANG KHI INSERT
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    if (pAppHeaderID < 0)
                    {
                        goto Commit_Transaction;
                    }

                    // detail
                    if (pAppHeaderID >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.Language_Code = language;
                        pDetail.App_Header_Id = pAppHeaderID;
                        pDetail.Case_Code     = p_case_code;
                        pReturn = objDetail.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    #region Phí cố định
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_3B(pDetail);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                info.App_Header_Id        = pAppHeaderID;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID);
                        }
                    }
                    #endregion

                    //end
Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }
                return(Json(new { status = pAppHeaderID }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
        public ActionResult ExportData_IU(ApplicationHeaderInfo pInfo, App_Detail_PLB01_SDD_Info pDetail,
                                          List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                string language = AppsCommon.GetCurrentLang();
                //string language = pInfo.View_Language_Report;

                string        _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/AppForms/B01_VI.docx");
                DocumentModel document  = DocumentModel.Load(_fileTemp);

                // Fill export_header
                AppsCommon.Prepare_Data_Export_3B(ref pDetail, pInfo, pAppDocumentInfo);
                List <App_Detail_PLB01_SDD_Info> _lst = new List <App_Detail_PLB01_SDD_Info>();
                _lst.Add(pDetail);
                DataSet _ds_all = ConvertData.ConvertToDataSet <App_Detail_PLB01_SDD_Info>(_lst, false);
                //_ds_all.Tables[0].TableName = "Table";
                //_ds_all.WriteXml(@"C:\inetpub\B01.xml", XmlWriteMode.WriteSchema);

                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                string _tempfile    = "TM_PLB01SDD.rpt";
                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "B01_VN_" + _datetimenow + ".pdf");
                if (language == Language.LangVI)
                {
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "B01_VN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "B01_VN_" + _datetimenow + ".pdf";
                }
                else
                {
                    _tempfile    = "TM_PLB01SDD_EN.rpt"; // tiếng anh
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "B01_EN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "B01_EN_" + _datetimenow + ".pdf";
                }

                oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile));

                if (_ds_all != null)
                {
                    _ds_all.Tables[0].TableName = "Table";

                    oRpt.Database.Tables["Table"].SetDataSource(_ds_all.Tables[0]);
                    //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 }));
            }
        }
        public ActionResult Edit_PLB_01_SDD(ApplicationHeaderInfo pInfo, App_Detail_PLB01_SDD_Info pDetail,
                                            List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL   objBL       = new Application_Header_BL();
                AppFeeFixBL             objFeeFixBL = new AppFeeFixBL();
                App_Detail_PLB01_SDD_BL objDetail   = new App_Detail_PLB01_SDD_BL();
                AppDocumentBL           objDoc      = new AppDocumentBL();
                if (pInfo == null || pDetail == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string  language    = AppsCommon.GetCurrentLang();
                var     CreatedBy   = SessionData.CurrentUser.Username;
                var     CreatedDate = SessionData.CurrentUser.CurrentDate;
                decimal pReturn     = ErrorCode.Success;
                bool    _IsOk       = false;
                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    pInfo.Modify_By      = CreatedBy;
                    pInfo.Modify_Date    = CreatedDate;
                    pInfo.Send_Date      = DateTime.Now;
                    pInfo.DDSHCN         = "";
                    pInfo.MADDSHCN       = "";
                    //TRA RA ID CUA BANG KHI INSERT
                    pReturn = objBL.AppHeaderUpdate(pInfo);
                    if (pReturn < 0)
                    {
                        goto Commit_Transaction;
                    }

                    // detail
                    if (pReturn >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.Language_Code = language;
                        pDetail.App_Header_Id = pInfo.Id;
                        pDetail.Case_Code     = pInfo.Case_Code;
                        pReturn = objDetail.Update(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    #region Phí cố định

                    // xóa đi
                    AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                    _AppFeeFixBL.AppFeeFixDelete(pDetail.Case_Code, language);

                    // insert lại fee
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_3B(pDetail);
                    if (_lstFeeFix.Count > 0)
                    {
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, pInfo.Case_Code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            // Get ra để map sau đó xóa đi để insert vào sau
                            AppDocumentBL          _AppDocumentBL           = new AppDocumentBL();
                            List <AppDocumentInfo> Lst_AppDoc               = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.App_Header_Id, language);
                            Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>();
                            foreach (AppDocumentInfo item in Lst_AppDoc)
                            {
                                dic_appDoc[item.Document_Id] = item;
                            }

                            // xóa đi trước
                            _AppDocumentBL.AppDocumentDelByApp(pDetail.App_Header_Id, language);

                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                else
                                {
                                    if (dic_appDoc.ContainsKey(info.Document_Id))
                                    {
                                        info.Filename     = dic_appDoc[info.Document_Id].Filename;
                                        info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy;
                                        info.Status       = dic_appDoc[info.Document_Id].Status;
                                    }
                                }

                                info.App_Header_Id        = pInfo.Id;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id);
                        }
                    }
                    #endregion

                    //end
Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                        return(Json(new { status = pReturn }));
                    }
                    else
                    {
                        scope.Complete();
                        _IsOk = true;
                    }
                }

                // tự động update todo
                if (pInfo.UpdateToDo == 1 && _IsOk == true)
                {
                    if (pInfo.Status == (int)CommonEnums.App_Status.ChoKHConfirm)
                    {
                        Application_Header_BL _obj_bl = new Application_Header_BL();
                        decimal _status = (decimal)CommonEnums.App_Status.KhacHangDaConfirm;

                        string _note = "Xác nhận nộp đơn";
                        if (AppsCommon.GetCurrentLang() != "VI_VN")
                        {
                            _note = "confirmation for filing";
                        }
                        int _ck = _obj_bl.AppHeader_Update_Status(pInfo.Case_Code, _status, _note,
                                                                  SessionData.CurrentUser.Username, DateTime.Now, AppsCommon.GetCurrentLang());
                    }
                }


                return(Json(new { status = pInfo.Id }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
        public ActionResult AppDonDangKyInsert(ApplicationHeaderInfo pInfo, App_Detail_TM06DKQT_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo,
                                               List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppClassDetailInfo> pAppClassInfo)
        {
            try
            {
                //List<AppFeeFixInfo> pFeeFixInfo
                Application_Header_BL objBL          = new Application_Header_BL();
                AppDetail06DKQT_BL    objDetailBL    = new AppDetail06DKQT_BL();
                AppClassDetailBL      objClassDetail = new AppClassDetailBL();
                AppDocumentBL         objDoc         = new AppDocumentBL();
                AppFeeFixBL           objFeeFixBL    = new AppFeeFixBL();
                if (pInfo == null || pDetail == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string language     = AppsCommon.GetCurrentLang();
                var    CreatedBy    = SessionData.CurrentUser.Username;
                var    CreatedDate  = SessionData.CurrentUser.CurrentDate;
                int    pReturn      = ErrorCode.Success;
                int    pAppHeaderID = 0;
                string p_case_code  = "";


                List <AppFeeFixInfo> pFeeFixInfo = CommonFunction.Call_Fee.CallFee_C06(pDetail);
                pDetail.LEPHI = (pFeeFixInfo[0] as AppFeeFixInfo).Amount;
                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    if (pInfo.Created_By == null || pInfo.Created_By == "0" || pInfo.Created_By == "")
                    {
                        pInfo.Created_By = CreatedBy;
                    }
                    pInfo.Created_Date = CreatedDate;
                    //TRA RA ID CUA BANG KHI INSERT
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    //Gán lại khi lấy dl
                    if (pAppHeaderID >= 0)
                    {
                        pReturn = objFeeFixBL.AppFeeFixInsertBath(pFeeFixInfo, p_case_code);
                    }
                    else
                    {
                        Transaction.Current.Rollback();
                    }
                    if (pReturn >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.LANGUAGE_CODE = language;
                        pDetail.APP_HEADER_ID = pAppHeaderID;
                        if (pDetail.pfileLogo != null)
                        {
                            pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                        }
                        pReturn = objDetailBL.App_Detail_06TMDKQT_Insert(pDetail);
                        //Thêm thông tin class
                        if (pReturn >= 0)
                        {
                            pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pAppHeaderID, language);
                        }
                    }
                    //Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                info.App_Header_Id        = pAppHeaderID;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID);
                        }
                    }

                    //tai lieu khac
                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0)
                    {
                        #region Tài liệu khác
                        int check = 0;
                        foreach (var info in pAppDocOtherInfo)
                        {
                            string _keyfileupload = "";
                            if (info.keyFileUpload != null)
                            {
                                _keyfileupload = info.keyFileUpload;
                            }
                            if (SessionData.CurrentUser.chashFile.ContainsKey(_keyfileupload))
                            {
                                var _updateitem = SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                if (_updateitem.GetType() == typeof(string))
                                {
                                    string _url = (string)_updateitem;
                                    info.Filename = _url;
                                    check         = 1;
                                }
                            }
                            info.App_Header_Id = pAppHeaderID;
                            info.Language_Code = language;
                        }
                        if (check == 1)
                        {
                            pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo);
                        }
                        #endregion
                    }
                    //end
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }

                return(Json(new { status = pAppHeaderID }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
Exemple #8
0
        public ActionResult Register_PLB_02_CGD(ApplicationHeaderInfo pInfo, App_Detail_PLB02_CGD_Info pDetail,
                                                List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL   objBL        = new Application_Header_BL();
                AppFeeFixBL             objFeeFixBL  = new AppFeeFixBL();
                App_Detail_Plb02_CGD_BL objDetail_BL = new App_Detail_Plb02_CGD_BL();
                AppDocumentBL           objDoc       = new AppDocumentBL();
                if (pInfo == null || pDetail == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string  language     = AppsCommon.GetCurrentLang();
                var     CreatedBy    = SessionData.CurrentUser.Username;
                var     CreatedDate  = SessionData.CurrentUser.CurrentDate;
                decimal pReturn      = ErrorCode.Success;
                int     pAppHeaderID = 0;
                string  p_case_code  = "";

                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    if (pInfo.Created_By == null || pInfo.Created_By == "0" || pInfo.Created_By == "")
                    {
                        pInfo.Created_By = CreatedBy;
                    }
                    pInfo.Created_Date = CreatedDate;
                    pInfo.Send_Date    = DateTime.Now;
                    //pInfo.Status = (decimal)CommonEnums.App_Status.DaGui_ChoPhanLoai;

                    //TRA RA ID CUA BANG KHI INSERT
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);

                    // detail
                    if (pAppHeaderID >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.Language_Code = language;
                        pDetail.App_Header_Id = pAppHeaderID;
                        pDetail.Case_Code     = p_case_code;
                        pReturn = objDetail_BL.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    else
                    {
                        goto Commit_Transaction;
                    }

                    #region Phí cố định

                    #region Phí thẩm định yêu cầu sửa đổi đơn
                    List <AppFeeFixInfo> _lstFeeFix      = new List <AppFeeFixInfo>();
                    AppFeeFixInfo        _AppFeeFixInfo1 = new AppFeeFixInfo();
                    _AppFeeFixInfo1.Fee_Id = 1;
                    _AppFeeFixInfo1.Isuse  = 1;
                    //_AppFeeFixInfo1.App_Header_Id = pAppHeaderID;
                    _AppFeeFixInfo1.Number_Of_Patent = pDetail.Transfer_Appno.Split(',').Length;

                    string _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo1.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo1.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo1.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo1.Amount = 160000 * _AppFeeFixInfo1.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo1);
                    #endregion

                    #region Phí công bố thông tin đơn sửa đổi
                    AppFeeFixInfo _AppFeeFixInfo2 = new AppFeeFixInfo();
                    _AppFeeFixInfo2.Fee_Id = 2;
                    _AppFeeFixInfo2.Isuse  = 1;
                    //_AppFeeFixInfo2.App_Header_Id = pAppHeaderID;
                    _AppFeeFixInfo2.Number_Of_Patent = pDetail.Transfer_Appno.Split(',').Length;

                    _keyFee = pDetail.Appcode + "_" + _AppFeeFixInfo2.Fee_Id.ToString();
                    if (MemoryData.c_dic_FeeByApp_Fix.ContainsKey(_keyFee))
                    {
                        _AppFeeFixInfo2.Amount = MemoryData.c_dic_FeeByApp_Fix[_keyFee].Amount * _AppFeeFixInfo2.Number_Of_Patent;
                    }
                    else
                    {
                        _AppFeeFixInfo2.Amount = 160000 * _AppFeeFixInfo2.Number_Of_Patent;
                    }
                    _lstFeeFix.Add(_AppFeeFixInfo2);
                    #endregion

                    AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                    pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                info.App_Header_Id        = pAppHeaderID;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID);
                        }
                    }
                    else
                    {
                        goto Commit_Transaction;
                    }
                    #endregion

                    //end
Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }
                return(Json(new { status = pAppHeaderID }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
Exemple #9
0
        public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string language     = AppsCommon.GetCurrentLang();

                List <E01_Info_Export> _lst = new List <E01_Info_Export>();

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

                E01_Info_Export _E01_Info_Export = new E01_Info_Export();



                // Phí cố định
                List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_E01(pInfo);
                AppsCommon.Prepare_Data_Export_E01(ref _E01_Info_Export, pInfo, pAppDocumentInfo, _lstFeeFix);

                _lst.Add(_E01_Info_Export);
                DataSet _ds_all = ConvertData.ConvertToDataSet <E01_Info_Export>(_lst, false);
                //_ds_all.WriteXml(@"D:\E01.xml", XmlWriteMode.WriteSchema);
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _tempfile = "E01.rpt";
                if (language == Language.LangEN)
                {
                    _tempfile = "E01_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();

                //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 }));
            }
        }
Exemple #10
0
        public ActionResult Edit(ApplicationHeaderInfo pInfo,
                                 List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL objBL       = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL = new AppFeeFixBL();

                if (pInfo == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string  language    = AppsCommon.GetCurrentLang();
                var     CreatedBy   = SessionData.CurrentUser.Username;
                var     CreatedDate = SessionData.CurrentUser.CurrentDate;
                decimal pReturn     = ErrorCode.Success;

                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    pInfo.Modify_By      = CreatedBy;
                    pInfo.Modify_Date    = CreatedDate;
                    pInfo.Send_Date      = DateTime.Now;

                    //TRA RA ID CUA BANG KHI INSERT
                    pReturn = objBL.AppHeaderUpdate(pInfo);
                    if (pReturn < 0)
                    {
                        goto Commit_Transaction;
                    }


                    #region Phí cố định
                    // xóa đi
                    AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                    _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language);

                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_E01(pInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, pInfo.Case_Code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            // Get ra để map sau đó xóa đi để insert vào sau
                            AppDocumentBL          _AppDocumentBL           = new AppDocumentBL();
                            List <AppDocumentInfo> Lst_AppDoc               = _AppDocumentBL.AppDocument_Getby_AppHeader(pInfo.Id, language);
                            Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>();
                            foreach (AppDocumentInfo item in Lst_AppDoc)
                            {
                                dic_appDoc[item.Document_Id] = item;
                            }

                            // xóa đi trước
                            _AppDocumentBL.AppDocumentDelByApp(pInfo.Id, language);

                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                else
                                {
                                    if (dic_appDoc.ContainsKey(info.Document_Id))
                                    {
                                        info.Filename     = dic_appDoc[info.Document_Id].Filename;
                                        info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy;
                                        info.Status       = dic_appDoc[info.Document_Id].Status;
                                    }
                                }

                                info.App_Header_Id        = pInfo.Id;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = _AppDocumentBL.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id);
                        }
                    }
                    #endregion

                    //end
Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }
                return(Json(new { status = pReturn }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
Exemple #11
0
        public ActionResult Register(ApplicationHeaderInfo pInfo, B03_Info pDetail,
                                     List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL objBL       = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL = new AppFeeFixBL();
                B03_BL        objDetail           = new B03_BL();
                AppDocumentBL objDoc = new AppDocumentBL();
                if (pInfo == null || pDetail == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string language = AppsCommon.GetCurrentLang();

                var CreatedBy = SessionData.CurrentUser.Username;

                var     CreatedDate  = SessionData.CurrentUser.CurrentDate;
                decimal pReturn      = ErrorCode.Success;
                int     pAppHeaderID = 0;
                string  p_case_code  = "";

                using (var scope = new TransactionScope())
                {
                    pInfo.Languague_Code = language;
                    if (pInfo.Created_By == null || pInfo.Created_By == "0" || pInfo.Created_By == "")
                    {
                        pInfo.Created_By = CreatedBy;
                    }

                    pInfo.Created_Date = CreatedDate;
                    pInfo.Send_Date    = DateTime.Now;

                    // lấy dữ liệu được fill lên từ A01
                    // get dữ liệu A01 qua code
                    string casecode = pDetail.App_Detail_Number;
                    ApplicationHeaderInfo _applicationheaderinfo = objBL.GetApp_By_Case_Code(casecode);



                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    if (pReturn < 0)
                    {
                        goto Commit_Transaction;
                    }

                    // detail
                    if (pAppHeaderID >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.Language_Code = language;
                        pDetail.App_Header_Id = pAppHeaderID;
                        pDetail.Case_Code     = p_case_code;
                        // thiếu thông tin chủ đơn
                        // thiếu mã đơn

                        pReturn = objDetail.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    #region Phí cố định
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_B03(pDetail, pAppDocumentInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                info.App_Header_Id        = pAppHeaderID;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID);
                        }
                    }
                    #endregion


Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }

                return(Json(new { status = pReturn }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
Exemple #12
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 }));
            }
        }
Exemple #13
0
        public ActionResult ViewCata()
        {
            try
            {
                WikiCatalogue_BL _CatalogueBL = new WikiCatalogue_BL();
                string           _Cataid      = "";
                if (RouteData.Values["id"] != null)
                {
                    _Cataid = RouteData.Values["id"].ToString();
                }

                WikiCatalogues_Info        _parentinfo   = new WikiCatalogues_Info();
                List <WikiCatalogues_Info> _ListCataMenu = new List <WikiCatalogues_Info>();
                _ListCataMenu = _CatalogueBL.Portal_CataGetAll();
                List <WikiCatalogues_Info> _ListCata = new List <WikiCatalogues_Info>();
                foreach (var item in _ListCataMenu)
                {
                    if (item.ID != 0)
                    {
                        _parentinfo = item;
                        break;
                    }
                }
                if (_Cataid != "0")
                {
                    _parentinfo = _CatalogueBL.WikiCatalogue_GetByID(Convert.ToDecimal(_Cataid));
                }
                else
                {
                    ViewBag.DefaultPage = 1;
                    _Cataid             = _parentinfo.ID.ToString();
                }


                _ListCata          = _CatalogueBL.Portal_Catalogue_Search("ALL|ALL|" + _Cataid.ToString() + "|" + AppsCommon.GetCurrentLang());
                ViewBag.Paging     = _CatalogueBL.GetPagingHtml();
                ViewBag.ListObject = _ListCata;
                ViewBag.Parentinfo = _parentinfo;

                ViewBag.ListCatalogue = _ListCataMenu;
                // lấy thằng đầu tiên

                ViewBag.CurrCata = _parentinfo.ID;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            return(View("/Areas/Home/Views/Wiki/ViewCatalogue.cshtml"));
        }
Exemple #14
0
        public ActionResult ChildCatalogue()
        {
            try
            {
                WikiCatalogue_BL _CatalogueBL = new WikiCatalogue_BL();
                WikiDoc_BL       _WikiBL      = new WikiDoc_BL();
                decimal          _Cataid      = 0;
                if (RouteData.Values["id"] != null)
                {
                    _Cataid = Convert.ToDecimal(RouteData.Values["id"]);
                }
                List <WikiCatalogues_Info> _ListCata = new List <WikiCatalogues_Info>();
                _ListCata = _CatalogueBL.Portal_CataGetAll();
                List <WikiDoc_Info> _ListDocSearch = new List <WikiDoc_Info>();
                if (_Cataid > 0)
                {
                    // lấy ds tin theo danh mục
                    _ListDocSearch        = _WikiBL.PortalWikiDoc_Search("3|" + _Cataid.ToString() + "|ALL|" + AppsCommon.GetCurrentLang());
                    ViewBag.Paging        = _WikiBL.GetPagingHtml();
                    ViewBag.ListDocSearch = _ListDocSearch;
                    WikiCatalogue_BL    _Catabl   = new WikiCatalogue_BL();
                    WikiCatalogues_Info _Catainfo = new WikiCatalogues_Info();
                    _Catainfo             = _Catabl.WikiCatalogue_GetByID(_Cataid);
                    ViewBag.CatalogueInfo = _Catainfo;
                }
                else
                {
                    // lấy thằng đầu tiên
                    WikiCatalogues_Info _firstCata = new WikiCatalogues_Info();
                    foreach (var item in _ListCata)
                    {
                        if (item.PARENT_ID != 0)
                        {
                            _firstCata = item;
                            break;
                        }
                    }

                    _ListDocSearch        = _WikiBL.PortalWikiDoc_Search("3|" + _firstCata.ID.ToString() + "|ALL|" + AppsCommon.GetCurrentLang());
                    ViewBag.Paging        = _WikiBL.GetPagingHtml();
                    ViewBag.ListDocSearch = _ListDocSearch;
                    ViewBag.CatalogueInfo = _firstCata;
                }
                ViewBag.ListCatalogue = _ListCata;
                ViewBag.CurrCata      = _Cataid;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            return(View("~/Areas/Home/Views/Wiki/ChildCatalogue.cshtml"));
        }
Exemple #15
0
        public ActionResult CatalougeSearch(string keysSearch, string options)
        {
            var lstOjects = new List <WikiCatalogues_Info>();

            try
            {
                WikiCatalogue_BL _CatalogueBL = new WikiCatalogue_BL();
                lstOjects      = _CatalogueBL.Portal_Catalogue_Search(keysSearch + "|" + AppsCommon.GetCurrentLang(), options);
                ViewBag.Paging = _CatalogueBL.GetPagingHtml();
                string _Cataid = "";
                WikiCatalogues_Info _parentinfo = new WikiCatalogues_Info();
                if (keysSearch != "" && keysSearch.Split('|').Length > 1)
                {
                    _Cataid = keysSearch.Split('|')[2];
                }
                if (_Cataid != "0")
                {
                    _parentinfo = _CatalogueBL.WikiCatalogue_GetByID(Convert.ToDecimal(_Cataid));
                }
                else
                {
                    _Cataid = _parentinfo.ID.ToString();
                }
                ViewBag.Parentinfo = _parentinfo;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            ViewBag.ListObject = lstOjects;
            return(PartialView("/Areas/Home/Views/Wiki/_PartialListChilCataByParent.cshtml"));
        }
        string Export_Billing(string p_case_code)
        {
            try
            {
                Billing_BL _obj_bl = new Billing_BL();
                SearchObject_Header_Info   SearchObject_Header_Info = new SearchObject_Header_Info();
                List <Billing_Detail_Info> _lst_billing_detail      = new List <Billing_Detail_Info>();
                Billing_Header_Info        _Billing_Header_Info     = _obj_bl.Billing_Search_GetBy_Code(p_case_code, AppsCommon.GetCurrentLang(), ref SearchObject_Header_Info, ref _lst_billing_detail);
                foreach (Billing_Detail_Info item in _lst_billing_detail)
                {
                    item.Total_Fee = item.Nation_Fee + item.Represent_Fee + item.Service_Fee;
                }

                string _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/Report/Biling_Search_Report.doc");
                //if (_ApplicationHeaderInfo.Customer_Country != Common.Common.Country_VietNam_Id)
                //    _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/Report/Biling_Report_EN.doc");
                DocumentModel document = DocumentModel.Load(_fileTemp);

                // Fill export_header
                string fileName_exp     = "/Content/Export/" + "Biling_Search_Report" + p_case_code + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
                string fileName_exp_doc = "/Content/Export/" + "Biling_Search_Report" + p_case_code + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";

                string fileName     = System.Web.HttpContext.Current.Server.MapPath(fileName_exp);
                string fileName_doc = System.Web.HttpContext.Current.Server.MapPath(fileName_exp_doc);

                document.MailMerge.FieldMerging += (sender, e) =>
                {
                    if (e.IsValueFound)
                    {
                        if (e.FieldName == "Text")
                        {
                            ((Run)e.Inline).Text = e.Value.ToString();
                        }
                    }
                };

                document.MailMerge.Execute(new { DateNo = DateTime.Now.ToString("dd-MM-yyyy") });
                document.MailMerge.Execute(new { Case_Name = SearchObject_Header_Info.CASE_NAME });
                document.MailMerge.Execute(new { Client_Reference = SearchObject_Header_Info.CLIENT_REFERENCE });
                document.MailMerge.Execute(new { Case_Code = SearchObject_Header_Info.CASE_CODE });
                document.MailMerge.Execute(new { Master_Name = SearchObject_Header_Info.Customer_Name });
                //document.MailMerge.Execute(new { App_No = SearchObject_Header_Info.App_No });
                document.MailMerge.Execute(new { Customer_Country_Name = SearchObject_Header_Info.Customer_Country_Name });
                document.MailMerge.Execute(new { Bill_Code = _Billing_Header_Info.Case_Code });

                document.MailMerge.Execute(new { Total_Amount = _Billing_Header_Info.Total_Amount.ToString("#,##0.##") });
                document.MailMerge.Execute(new { Total_Pre_Tex = _Billing_Header_Info.Total_Pre_Tex.ToString("#,##0.##") });
                document.MailMerge.Execute(new { Tex_Fee = _Billing_Header_Info.Tex_Fee.ToString("#,##0.##") });
                document.MailMerge.Execute(new { Currency = _Billing_Header_Info.Currency });

                document.MailMerge.Execute(new { Deadline = _Billing_Header_Info.Deadline.ToString("dd/MM/yyyy") });
                document.MailMerge.Execute(new { Billing_Date = _Billing_Header_Info.Billing_Date.ToString("dd/MM/yyyy") });

                // lấy thông tin người dùng
                UserBL   _UserBL  = new UserBL();
                UserInfo userInfo = _UserBL.GetUserByUsername(SearchObject_Header_Info.CREATED_BY);
                if (userInfo != null)
                {
                    document.MailMerge.Execute(new { Contact_Person = userInfo.Contact_Person + " " + userInfo.FullName });
                    document.MailMerge.Execute(new { Address = userInfo.Address });
                    document.MailMerge.Execute(new { FullName = userInfo.FullName });
                }
                else
                {
                    document.MailMerge.Execute(new { Contact_Person = "" });
                    document.MailMerge.Execute(new { Address = "" });
                    document.MailMerge.Execute(new { FullName = "" });
                }

                DataTable dtDetail = new DataTable();
                dtDetail = ConvertData.ConvertToDatatable <Billing_Detail_Info>(_lst_billing_detail);
                document.MailMerge.Execute(dtDetail, "TEMP");

                document.Save(fileName, SaveOptions.PdfDefault);
                //document.Save(fileName_doc, SaveOptions.DocxDefault);

                byte[] fileContents;
                var    options = SaveOptions.PdfDefault;
                // Save document to DOCX format in byte array.
                using (var stream = new MemoryStream())
                {
                    document.Save(stream, options);
                    fileContents = stream.ToArray();
                }
                Convert.ToBase64String(fileContents);

                return(fileName_exp);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return("");
            }
        }
        public ActionResult GetInfoByCaseCode(string p_case_code)
        {
            try
            {
                SearchObject_BL            _bl = new SearchObject_BL();
                List <Billing_Detail_Info> _lst_billing_detail  = new List <Billing_Detail_Info>();
                SearchObject_Header_Info   objSearch_HeaderInfo = _bl.GetBilling_By_Case_Code(p_case_code, SessionData.CurrentUser.Username,
                                                                                              AppsCommon.GetCurrentLang(), ref _lst_billing_detail);
                ViewBag.objSearch_HeaderInfo = objSearch_HeaderInfo;

                if (objSearch_HeaderInfo == null)
                {
                    return(Json(new { success = -1 }));
                }

                // chỉ lấy những thằng nào mà > đã nộp đơn lên cục
                //if (objSearch_HeaderInfo != null && objSearch_HeaderInfo.Status < (decimal)Common.CommonData.CommonEnums.App_Status.DaNopDon)
                //{
                //    return Json(new { success = -2 });
                //}

                Billing_Detail_Info _ChiPhiKhac = new Billing_Detail_Info();
                _ChiPhiKhac.Nation_Fee            = 0;
                _ChiPhiKhac.Represent_Fee         = 0;
                _ChiPhiKhac.Service_Fee           = 0;
                _ChiPhiKhac.Biling_Detail_Name    = "Chi phí khác";
                _ChiPhiKhac.Biling_Detail_Name_EN = "Others";
                _ChiPhiKhac.Type = Convert.ToDecimal(Common.CommonData.CommonEnums.Billing_Detail_Type.Others);
                _lst_billing_detail.Add(_ChiPhiKhac);

                foreach (Billing_Detail_Info item in _lst_billing_detail)
                {
                    item.Total_Fee = item.Nation_Fee + item.Represent_Fee + item.Service_Fee;
                }

                SessionData.SetDataSession(p_case_code, _lst_billing_detail);
                SessionData.SetDataSession(p_case_code + "_CURRENCY_TYPE", objSearch_HeaderInfo.Currency_Type);

                ViewBag.List_Billing  = _lst_billing_detail;
                ViewBag.Operator_Type = Convert.ToDecimal(Common.CommonData.CommonEnums.Operator_Type.Insert);
                ViewBag.App_Case_Code = p_case_code;
                ViewBag.Currency_Type = objSearch_HeaderInfo.Currency_Type;
                ViewBag.ShowPopUp     = 0;

                var Partial_AppInfo = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/Manager/Views/Billing_Search/_Partial_SearchInfo.cshtml");
                var PartialDetail_Insert_Billing = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/Manager/Views/Billing_Search/_PartialDetail_Insert_Billing.cshtml");

                var json = Json(new { success = 1, Partial_AppInfo, PartialDetail_Insert_Billing });
                return(json);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(PartialView("~/Areas/TradeMark/Views/Shared/_PartialThongTinChuDon.cshtml"));
            }
        }
Exemple #18
0
        public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, decimal p_View_Translate)
        {
            try
            {
                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string language     = AppsCommon.GetCurrentLang();

                List <E01_Info_Export> _lst = new List <E01_Info_Export>();

                List <AppDocumentInfo> appDocumentInfos      = new List <AppDocumentInfo>();
                List <AppFeeFixInfo>   _lst_appFeeFixInfos   = new List <AppFeeFixInfo>();
                ApplicationHeaderInfo  applicationHeaderInfo = new ApplicationHeaderInfo();

                E01_Info_Export _E01_Info_Export = new E01_Info_Export();
                var             objBL            = new BussinessFacade.ModuleTrademark.Application_Header_BL();

                ApplicationHeaderInfo _app = objBL.GetAllByID(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref _lst_appFeeFixInfos);
                AppsCommon.Prepare_Data_Export_E01(ref _E01_Info_Export, applicationHeaderInfo, appDocumentInfos, _lst_appFeeFixInfos);

                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "E01" + _datetimenow + ".pdf");
                string _tempfile    = "E01.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 (applicationHeaderInfo.Languague_Code == Language.LangEN)
                    {
                        _tempfile    = "E01.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "E01" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "E01" + _datetimenow + ".pdf";
                    }
                    else
                    {
                        _tempfile    = "E01_EN.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "E01_EN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "E01_EN_" + _datetimenow + ".pdf";
                    }
                }
                else
                {
                    if (applicationHeaderInfo.Languague_Code == Language.LangVI)
                    {
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "E01" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "E01" + _datetimenow + ".pdf";
                    }
                    else
                    {
                        _tempfile    = "E01_EN.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "E01_EN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "E01_EN_" + _datetimenow + ".pdf";
                    }
                }
                _lst.Add(_E01_Info_Export);
                DataSet _ds_all = ConvertData.ConvertToDataSet <E01_Info_Export>(_lst, false);
                //_ds_all.WriteXml(@"D:\E01.xml", XmlWriteMode.WriteSchema);

                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();


                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 }));
            }
        }
Exemple #19
0
        public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, App_Detail_C02_Info pDetail,
                                               List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo)
        {
            try
            {
                string _datetimenow             = DateTime.Now.ToString("ddMMyyyyHHmm");
                string language                 = AppsCommon.GetCurrentLang();
                List <App_Detail_C02_Info> _lst = new List <App_Detail_C02_Info>();

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

                AppsCommon.Prepare_Data_Export_C02(ref pDetail, pInfo, pAppDocumentInfo);
                if (pAppDocOtherInfo != null)
                {
                    foreach (var item in pAppDocOtherInfo)
                    {
                        pDetail.Note += item.Documentname + " ; ";
                    }

                    if (pAppDocOtherInfo.Count > 0)
                    {
                        pDetail.Note = pDetail.Note.Substring(0, pDetail.Note.Length - 2);
                    }
                }
                if (pDetail.App_Change_Detail != null)
                {
                    pDetail.Number_Count_Detail = pDetail.App_Change_Detail.Split(',').Length;
                }
                if (pDetail.App_No_Change != null)
                {
                    pDetail.Number_Count_App_No_Change = pDetail.App_No_Change.Split(',').Length;
                }

                _lst.Add(pDetail);

                DataSet _ds_all = ConvertData.ConvertToDataSet <App_Detail_C02_Info>(_lst, false);
                //_ds_all.WriteXml(@"D:\C02.xml", XmlWriteMode.WriteSchema);
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _tempfile = "C02.rpt";
                if (language == Language.LangEN)
                {
                    _tempfile = "C02_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 }));
            }
        }
Exemple #20
0
        public ActionResult Register(ApplicationHeaderInfo pInfo,
                                     List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                Application_Header_BL objBL       = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL = new AppFeeFixBL();
                AppDocumentBL         objDoc      = new AppDocumentBL();
                string language = AppsCommon.GetCurrentLang();

                var CreatedBy = SessionData.CurrentUser.Username;

                var     CreatedDate  = SessionData.CurrentUser.CurrentDate;
                decimal pReturn      = ErrorCode.Success;
                int     pAppHeaderID = 0;
                string  p_case_code  = "";
                using (var scope = new TransactionScope())
                {
                    pInfo.Languague_Code = language;
                    if (pInfo.Created_By == null || pInfo.Created_By == "0" || pInfo.Created_By == "")
                    {
                        pInfo.Created_By = CreatedBy;
                    }

                    pInfo.Created_Date = CreatedDate;
                    pInfo.Send_Date    = DateTime.Now;

                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    if (pReturn < 0)
                    {
                        goto Commit_Transaction;
                    }

                    #region Phí cố định
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_E01(pInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                info.App_Header_Id        = pAppHeaderID;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID);
                        }
                    }
                    #endregion

Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }
            }

            catch (Exception ex)
            {
            }
            return(Json(new { status = 1 }));
        }
        public ActionResult Edit_TM06DKQT(ApplicationHeaderInfo pInfo, App_Detail_TM06DKQT_Info pDetail,
                                          List <AppDocumentInfo> pAppDocumentInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppClassDetailInfo> pAppClassInfo)
        {
            try
            {
                pDetail.Id            = pInfo.Id;
                pDetail.APP_HEADER_ID = pInfo.Id;
                pDetail.LANGUAGE_CODE = pInfo.Languague_Code;
                Application_Header_BL objBL          = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL    = new AppFeeFixBL();
                AppDetail06DKQT_BL    objDetail      = new AppDetail06DKQT_BL();
                AppDocumentBL         objDoc         = new AppDocumentBL();
                AppClassDetailBL      objClassDetail = new AppClassDetailBL();
                bool _IsOk = false;
                if (pInfo == null || pDetail == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string  language    = AppsCommon.GetCurrentLang();
                var     CreatedBy   = SessionData.CurrentUser.Username;
                var     CreatedDate = SessionData.CurrentUser.CurrentDate;
                decimal pReturn     = ErrorCode.Success;
                List <AppFeeFixInfo> pFeeFixInfo = CommonFunction.Call_Fee.CallFee_C06(pDetail);
                pDetail.LEPHI = (pFeeFixInfo[0] as AppFeeFixInfo).Amount;
                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    pInfo.Modify_By      = SessionData.CurrentUser.Username;
                    pInfo.Modify_Date    = SessionData.CurrentUser.CurrentDate;
                    pInfo.Send_Date      = DateTime.Now;
                    pInfo.DDSHCN         = "";
                    pInfo.MADDSHCN       = "";
                    pInfo.Master_Type    = "";
                    if (pDetail.pfileLogo != null)
                    {
                        pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                    }
                    //TRA RA ID CUA BANG KHI INSERT
                    int _re = objBL.AppHeaderUpdate(pInfo);

                    // detail
                    if (_re >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.LANGUAGE_CODE = language;
                        pDetail.APP_HEADER_ID = pInfo.Id;
                        pReturn = objDetail.App_Detail_06TMDKQT_Update(pDetail);
                    }

                    #region Phí cố định

                    // xóa đi
                    AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                    _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language);

                    // insert lại fee

                    pReturn = objFeeFixBL.AppFeeFixInsertBath(pFeeFixInfo, pInfo.Case_Code);
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                        return(Json(new { status = -1 }));
                    }
                    #endregion

                    //tai lieu khac
                    #region Tài liệu khác
                    objDoc = new AppDocumentBL();
                    List <AppDocumentOthersInfo> Lst_Doc_Others                 = objDoc.DocumentOthers_GetByAppHeader(pInfo.Id, language);
                    List <AppDocumentOthersInfo> Lst_Doc_Others_Old             = Lst_Doc_Others.FindAll(m => m.FILETYPE == 1).ToList();
                    Dictionary <decimal, AppDocumentOthersInfo> _dic_doc_others = new Dictionary <decimal, AppDocumentOthersInfo>();
                    foreach (AppDocumentOthersInfo item in Lst_Doc_Others_Old)
                    {
                        _dic_doc_others[item.Id] = item;
                    }

                    // xóa đi trước insert lại sau
                    objDoc.AppDocumentOtherDeletedByApp_Type(pInfo.Id, language, 1);

                    if (pReturn >= 0 && pAppDocOtherInfo != null && pAppDocOtherInfo.Count > 0)
                    {
                        int check = 0;
                        foreach (var info in pAppDocOtherInfo)
                        {
                            if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                            {
                                string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                info.Filename = _url;
                                check         = 1;
                            }
                            else if (_dic_doc_others.ContainsKey(info.Id))
                            {
                                info.Filename = _dic_doc_others[info.Id].Filename;
                                check         = 1;
                            }
                            info.App_Header_Id = pInfo.Id;
                            info.Language_Code = language;
                        }
                        if (check == 1)
                        {
                            pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo);
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            // Get ra để map sau đó xóa đi để insert vào sau
                            AppDocumentBL          _AppDocumentBL           = new AppDocumentBL();
                            List <AppDocumentInfo> Lst_AppDoc               = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.APP_HEADER_ID, language);
                            Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>();
                            foreach (AppDocumentInfo item in Lst_AppDoc)
                            {
                                dic_appDoc[item.Document_Id] = item;
                            }

                            // xóa đi trước
                            _AppDocumentBL.AppDocumentDelByApp(pDetail.APP_HEADER_ID, language);

                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                else
                                {
                                    if (dic_appDoc.ContainsKey(info.Document_Id))
                                    {
                                        info.Filename     = dic_appDoc[info.Document_Id].Filename;
                                        info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy;
                                        info.Status       = dic_appDoc[info.Document_Id].Status;
                                    }
                                }

                                info.App_Header_Id        = pInfo.Id;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id);
                        }
                    }
                    #endregion

                    #region  Thêm thông tin class
                    if (pReturn >= 0 && pAppClassInfo != null)
                    {
                        //Xoa cac class cu di
                        pReturn = objClassDetail.AppClassDetailDeleted(pInfo.Id, language);

                        pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pInfo.Id, language);
                    }

                    //end
                    #endregion
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                        return(Json(new { status = -1 }));
                    }
                    else
                    {
                        scope.Complete();
                        _IsOk = true;
                    }
                }

                // tự động update todo

                return(Json(new { status = pInfo.Id }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
        public ActionResult GetView2View(decimal id)
        {
            try
            {
                if (SessionData.CurrentUser == null)
                {
                    return(Redirect("/"));
                }

                Email_BL            _obj_bl = new Email_BL();
                Template_Email_Info _Template_Email_Info = _obj_bl.Template_Email_GetBy_Id(id, AppsCommon.GetCurrentLang());
                ViewBag.Template_Email_Info = _Template_Email_Info;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(PartialView("~/Areas/Manager/Views/TemplateEmail/_PartialView.cshtml"));
        }
Exemple #23
0
        public ActionResult Register(ApplicationHeaderInfo pInfo, Pattent_Lao_Info pDetail,
                                     List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo,
                                     List <Other_MasterInfo> pOther_MasterInfo,
                                     List <Inventor_Info> pInventor_Info,
                                     List <AppClassDetailInfo> pAppClassInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo,
                                     List <UTienInfo> pUTienInfo, List <AppDocumentOthersInfo> pLstImagePublic)
        {
            try
            {
                Application_Header_BL objBL            = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL      = new AppFeeFixBL();
                Pattent_Lao_BL        objDetail        = new Pattent_Lao_BL();
                AppDocumentBL         objDoc           = new AppDocumentBL();
                Other_Master_BL       _Other_Master_BL = new Other_Master_BL();
                Inventor_BL           _Inventor_BL     = new Inventor_BL();

                if (pInfo == null || pDetail == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string language = AppsCommon.GetCurrentLang();

                var CreatedBy = SessionData.CurrentUser.Username;

                var     CreatedDate  = SessionData.CurrentUser.CurrentDate;
                decimal pReturn      = ErrorCode.Success;
                int     pAppHeaderID = 0;
                string  p_case_code  = "";

                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    if (pInfo.Created_By == null || pInfo.Created_By == "0" || pInfo.Created_By == "")
                    {
                        pInfo.Created_By = CreatedBy;
                    }

                    pInfo.Created_Date = CreatedDate;
                    pInfo.Send_Date    = DateTime.Now;

                    //TRA RA ID CUA BANG KHI INSERT
                    pAppHeaderID = objBL.AppHeaderInsert(pInfo, ref p_case_code);
                    if (pAppHeaderID < 0)
                    {
                        goto Commit_Transaction;
                    }

                    // detail
                    if (pAppHeaderID >= 0)
                    {
                        pDetail.Appcode       = pInfo.Appcode;
                        pDetail.Language_Code = language;
                        pDetail.App_Header_Id = pAppHeaderID;
                        pDetail.Case_Code     = p_case_code;

                        pReturn = objDetail.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    if (pOther_MasterInfo != null && pOther_MasterInfo.Count > 0)
                    {
                        foreach (var item in pOther_MasterInfo)
                        {
                            item.Case_Code     = p_case_code;
                            item.App_Header_Id = pAppHeaderID;
                        }

                        decimal _re = _Other_Master_BL.Insert(pOther_MasterInfo);
                        if (_re <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    if (pInventor_Info != null && pInventor_Info.Count > 0)
                    {
                        foreach (var item in pInventor_Info)
                        {
                            item.Case_Code     = p_case_code;
                            item.App_Header_Id = pAppHeaderID;
                        }
                        decimal _re = _Inventor_BL.Insert(pInventor_Info);
                        if (_re <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    if (pUTienInfo != null && pUTienInfo.Count > 0)
                    {
                        foreach (var item in pUTienInfo)
                        {
                            item.Case_Code     = p_case_code;
                            item.App_Header_Id = pAppHeaderID;
                        }

                        Uu_Tien_BL _Uu_Tien_BL = new Uu_Tien_BL();
                        decimal    _re         = _Uu_Tien_BL.Insert(pUTienInfo);
                        if (_re <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null)
                    {
                        if (pAppDocOtherInfo.Count > 0)
                        {
                            int check = 0;
                            foreach (var info in pAppDocOtherInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    info.Filename = _url;
                                    check         = 1;
                                }
                                info.App_Header_Id = pAppHeaderID;
                                info.Language_Code = language;
                            }
                            if (check == 1)
                            {
                                pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo);
                            }
                        }
                    }

                    // hình công bố
                    if (pReturn >= 0 && pLstImagePublic != null)
                    {
                        if (pLstImagePublic.Count > 0)
                        {
                            int check = 0;
                            foreach (var info in pLstImagePublic)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    info.Filename = _url;
                                    check         = 1;
                                }
                                info.App_Header_Id = pAppHeaderID;
                                info.Language_Code = language;
                            }
                            if (check == 1)
                            {
                                AppImageBL _AppImageBL = new AppImageBL();
                                pReturn = _AppImageBL.AppImageInsertBatch(pLstImagePublic);
                            }
                        }
                    }

                    #region Phí cố định
                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_PT_Lao(pDetail, pAppDocumentInfo, pUTienInfo, pLstImagePublic, pAppDocOtherInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, p_case_code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                info.App_Header_Id        = pAppHeaderID;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = objDoc.AppDocumentInsertBath(pAppDocumentInfo, pAppHeaderID);
                        }
                    }
                    #endregion

                    //end
Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }
                return(Json(new { status = pReturn }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
Exemple #24
0
        public ActionResult Edit(ApplicationHeaderInfo pInfo, Pattent_Lao_Info pDetail,
                                 List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo,
                                 List <AuthorsInfo> pAppAuthorsInfo, List <Other_MasterInfo> pOther_MasterInfo,
                                 List <Inventor_Info> pInventor_Info,
                                 List <AppClassDetailInfo> pAppClassInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo,
                                 List <UTienInfo> pUTienInfo, List <AppDocumentOthersInfo> pLstImagePublic)
        {
            try
            {
                Application_Header_BL objBL       = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL = new AppFeeFixBL();
                Pattent_Lao_BL        objDetail   = new Pattent_Lao_BL();
                if (pInfo == null || pDetail == null)
                {
                    return(Json(new { status = ErrorCode.Error }));
                }
                string language = AppsCommon.GetCurrentLang();

                var CreatedBy = SessionData.CurrentUser.Username;

                var     CreatedDate = SessionData.CurrentUser.CurrentDate;
                decimal pReturn     = ErrorCode.Success;

                using (var scope = new TransactionScope())
                {
                    //
                    pInfo.Languague_Code = language;
                    pInfo.Modify_By      = CreatedBy;
                    pInfo.Modify_Date    = CreatedDate;
                    pInfo.Send_Date      = DateTime.Now;

                    //TRA RA ID CUA BANG KHI INSERT
                    pReturn = objBL.AppHeaderUpdate(pInfo);
                    if (pReturn < 0)
                    {
                        goto Commit_Transaction;
                    }

                    // detail
                    if (pReturn >= 0)
                    {
                        pDetail.App_Header_Id = pInfo.Id;
                        pReturn = objDetail.UpDate(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    Inventor_BL _Inventor_BL = new Inventor_BL();
                    _Inventor_BL.Deleted(pInfo.Case_Code, language);
                    if (pInventor_Info != null && pInventor_Info.Count > 0)
                    {
                        foreach (var item in pInventor_Info)
                        {
                            item.Case_Code     = pInfo.Case_Code;
                            item.App_Header_Id = pInfo.Id;
                        }
                        decimal _re = _Inventor_BL.Insert(pInventor_Info);
                        if (_re <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    Other_Master_BL _Other_Master_BL = new Other_Master_BL();
                    _Other_Master_BL.Deleted(pInfo.Case_Code, language);
                    if (pOther_MasterInfo != null && pOther_MasterInfo.Count > 0)
                    {
                        foreach (var item in pOther_MasterInfo)
                        {
                            item.Case_Code     = pInfo.Case_Code;
                            item.App_Header_Id = pInfo.Id;
                        }

                        decimal _re = _Other_Master_BL.Insert(pOther_MasterInfo);
                        if (_re <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    // xóa đi trước insert lại sau
                    Uu_Tien_BL _Uu_Tien_BL = new Uu_Tien_BL();
                    _Uu_Tien_BL.Deleted(pInfo.Case_Code, language);

                    if (pUTienInfo != null && pUTienInfo.Count > 0)
                    {
                        foreach (var item in pUTienInfo)
                        {
                            item.Case_Code     = pInfo.Case_Code;
                            item.App_Header_Id = pInfo.Id;
                        }

                        decimal _re = _Uu_Tien_BL.Insert(pUTienInfo);
                        if (_re <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null)
                    {
                        AppDocumentBL objDoc = new AppDocumentBL();
                        List <AppDocumentOthersInfo> Lst_Doc_Others_Old             = objDoc.DocumentOthers_GetByAppHeader(pInfo.Id, language);
                        Dictionary <decimal, AppDocumentOthersInfo> _dic_doc_others = new Dictionary <decimal, AppDocumentOthersInfo>();
                        foreach (AppDocumentOthersInfo item in Lst_Doc_Others_Old)
                        {
                            _dic_doc_others[item.Id] = item;
                        }

                        // xóa đi trước insert lại sau
                        objDoc.AppDocumentOtherDeletedByApp(pInfo.Id, language);

                        if (pAppDocOtherInfo.Count > 0)
                        {
                            int check = 0;
                            foreach (var info in pAppDocOtherInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    info.Filename = _url;
                                    check         = 1;
                                }
                                else if (_dic_doc_others.ContainsKey(info.Id))
                                {
                                    info.Filename = _dic_doc_others[info.Id].Filename;
                                    check         = 1;
                                }

                                info.App_Header_Id = pInfo.Id;
                                info.Language_Code = language;
                            }
                            if (check == 1)
                            {
                                pReturn = objDoc.AppDocumentOtherInsertBatch(pAppDocOtherInfo);
                            }
                        }
                    }

                    // hình công bố
                    if (pReturn >= 0 && pLstImagePublic != null)
                    {
                        if (pLstImagePublic.Count > 0)
                        {
                            AppImageBL _AppImageBL = new AppImageBL();

                            List <AppDocumentOthersInfo> Lst_ImagePublic_Old       = _AppImageBL.GetByAppHeader(pInfo.Id, language);
                            Dictionary <decimal, AppDocumentOthersInfo> _dic_image = new Dictionary <decimal, AppDocumentOthersInfo>();
                            foreach (AppDocumentOthersInfo item in Lst_ImagePublic_Old)
                            {
                                _dic_image[item.Id] = item;
                            }

                            // xóa đi trước insert lại sau
                            _AppImageBL.AppImageDeletedByApp(pInfo.Id, language);

                            int check = 0;
                            foreach (AppDocumentOthersInfo info in pLstImagePublic)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string _url = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    info.Filename = _url;
                                    check         = 1;
                                }
                                else if (_dic_image.ContainsKey(info.Id))
                                {
                                    info.Filename = _dic_image[info.Id].Filename;
                                    check         = 1;
                                }

                                info.App_Header_Id = pInfo.Id;
                                info.Language_Code = language;
                            }

                            if (check == 1)
                            {
                                pReturn = _AppImageBL.AppImageInsertBatch(pLstImagePublic);
                            }
                        }
                    }

                    #region Phí cố định
                    // xóa đi
                    AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                    _AppFeeFixBL.AppFeeFixDelete(pInfo.Case_Code, language);

                    List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_PT_Lao(pDetail, pAppDocumentInfo, pUTienInfo, pLstImagePublic, pAppDocOtherInfo);
                    if (_lstFeeFix.Count > 0)
                    {
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, pInfo.Case_Code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }
                    #endregion

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            // Get ra để map sau đó xóa đi để insert vào sau
                            AppDocumentBL          _AppDocumentBL           = new AppDocumentBL();
                            List <AppDocumentInfo> Lst_AppDoc               = _AppDocumentBL.AppDocument_Getby_AppHeader(pDetail.App_Header_Id, language);
                            Dictionary <string, AppDocumentInfo> dic_appDoc = new Dictionary <string, AppDocumentInfo>();
                            foreach (AppDocumentInfo item in Lst_AppDoc)
                            {
                                dic_appDoc[item.Document_Id] = item;
                            }

                            // xóa đi trước
                            _AppDocumentBL.AppDocumentDelByApp(pDetail.App_Header_Id, language);

                            foreach (var info in pAppDocumentInfo)
                            {
                                if (SessionData.CurrentUser.chashFile.ContainsKey(info.keyFileUpload))
                                {
                                    string   _url      = (string)SessionData.CurrentUser.chashFile[info.keyFileUpload];
                                    string[] _arr      = _url.Split('/');
                                    string   _filename = WebApps.Resources.Resource.FileDinhKem;
                                    if (_arr.Length > 0)
                                    {
                                        _filename = _arr[_arr.Length - 1];
                                    }

                                    info.Filename     = _filename;
                                    info.Url_Hardcopy = _url;
                                    info.Status       = 0;
                                }
                                else
                                {
                                    if (dic_appDoc.ContainsKey(info.Document_Id))
                                    {
                                        info.Filename     = dic_appDoc[info.Document_Id].Filename;
                                        info.Url_Hardcopy = dic_appDoc[info.Document_Id].Url_Hardcopy;
                                        info.Status       = dic_appDoc[info.Document_Id].Status;
                                    }
                                }

                                info.App_Header_Id        = pInfo.Id;
                                info.Document_Filing_Date = CommonFuc.CurrentDate();
                                info.Language_Code        = language;
                            }
                            pReturn = _AppDocumentBL.AppDocumentInsertBath(pAppDocumentInfo, pInfo.Id);
                        }
                    }
                    #endregion

                    //end
Commit_Transaction:
                    if (pReturn < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        scope.Complete();
                    }
                }
                return(Json(new { status = pReturn }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { status = ErrorCode.Error }));
            }
        }
        public ActionResult getMasterByAppNo(string p_appNo)
        {
            try
            {
                Application_Header_BL _bl = new Application_Header_BL();
                ApplicationHeaderInfo objAppHeaderInfo = _bl.GetMasterByAppNo(p_appNo, SessionData.CurrentUser.Username, AppsCommon.GetCurrentLang());
                ViewBag.objAppHeaderInfo = objAppHeaderInfo;

                var PartialThongTinChuDon        = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/TradeMark/Views/Shared/_PartialThongTinChuDon.cshtml", "1");
                var PartialThongTinDaiDienChuDon = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/TradeMark/Views/Shared/_PartialThongTinDaiDienChuDon.cshtml", "2");

                var json = Json(new { PartialThongTinChuDon, PartialThongTinDaiDienChuDon });
                return(json);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(PartialView("~/Areas/TradeMark/Views/Shared/_PartialThongTinChuDon.cshtml"));
            }
        }
Exemple #26
0
        public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, Pattent_Lao_Info pDetail,
                                               List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo,
                                               List <Other_MasterInfo> pOther_MasterInfo,
                                               List <Inventor_Info> pInventor_Info,
                                               List <AppClassDetailInfo> pAppClassInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo,
                                               List <UTienInfo> pUTienInfo, List <AppDocumentOthersInfo> pLstImagePublic)
        {
            try
            {
                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string language     = AppsCommon.GetCurrentLang();
                //var objBL = new A01_BL();
                List <Pattent_Lao_Info_Export> _lst = new List <Pattent_Lao_Info_Export>();

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

                Pattent_Lao_Info_Export _A01_Info_Export = new Pattent_Lao_Info_Export();
                Pattent_Lao_Info_Export.CopyA01_Info(ref _A01_Info_Export, pDetail);

                foreach (var item in MemoryData.c_lst_Country)
                {
                    if (item.Country_Id == pInfo.Master_Country_Nationality)
                    {
                        pInfo.Master_Country_Nationality_Name = item.Name;
                    }
                    if (item.Country_Id == pInfo.Master_Country_Incorporation)
                    {
                        pInfo.Master_Country_Incorporation_Name = item.Name;
                    }
                    if (item.Country_Id == pInfo.Master_Country_Residence)
                    {
                        pInfo.Master_Country_Residence_Name = item.Name;
                    }
                }


                // Phí cố định
                List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_PT_Lao(pDetail, pAppDocumentInfo, pUTienInfo, pLstImagePublic, pAppDocOtherInfo);

                Call_Fee.Prepare_Data_Export_PT_Lao(ref _A01_Info_Export, pInfo, pAppDocumentInfo, _lstFeeFix, pInventor_Info, pOther_MasterInfo,
                                                    pAppClassInfo, pAppDocOtherInfo, pUTienInfo, pLstImagePublic);

                _lst.Add(_A01_Info_Export);
                DataSet _ds_all = ConvertData.ConvertToDataSet <Pattent_Lao_Info_Export>(_lst, false);
                //_ds_all.WriteXml(@"D:\A01.xml", XmlWriteMode.WriteSchema);
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

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

                if (_ds_all != null)
                {
                    _ds_all.Tables[0].TableName = "Table1";
                    oRpt.Database.Tables["Table"].SetDataSource(_ds_all.Tables[0]);
                    //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 }));
            }
        }
Exemple #27
0
 public ActionResult do_Remind(decimal p_type, string p_case_code, decimal p_ref_id)
 {
     try
     {
         B_Todos_BL _obj_bl    = new B_Todos_BL();
         var        modifiedBy = SessionData.CurrentUser.Username;
         bool       _result    = _obj_bl.Remind_Insert_ByTodo(p_type, p_case_code, p_ref_id, SessionData.CurrentUser.Username, AppsCommon.GetCurrentLang());
         if (_result)
         {
             return(Json(new { success = 1 }));
         }
         else
         {
             return(Json(new { success = -1 }));
         }
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return(Json(new { success = -1 }));
     }
 }
        public ActionResult DoInsert(Billing_Header_Info p_Billing_Header_Info)
        {
            try
            {
                List <Billing_Detail_Info> _lst_billing_detail = Get_LstFee_Detail(p_Billing_Header_Info.App_Case_Code);

                if (p_Billing_Header_Info.Total_Amount == 0)
                {
                    return(Json(new { success = "-2" }));
                }

                Billing_BL _obj_bl = new Billing_BL();
                p_Billing_Header_Info.Created_By    = SessionData.CurrentUser.Username;
                p_Billing_Header_Info.Created_Date  = DateTime.Now;
                p_Billing_Header_Info.Language_Code = AppsCommon.GetCurrentLang();
                p_Billing_Header_Info.Status        = (decimal)CommonEnums.Billing_Status.New_Wait_Approve;
                p_Billing_Header_Info.Billing_Type  = (decimal)CommonEnums.Billing_Type.Search;
                p_Billing_Header_Info.Currency_Rate = AppsCommon.Get_Currentcy_VCB();
                decimal _ck         = 0;
                decimal _billing_id = 0;
                using (var scope = new TransactionScope())
                {
                    _billing_id = _obj_bl.Billing_Insert(p_Billing_Header_Info);

                    if (_billing_id > 0 && _lst_billing_detail.Count > 0)
                    {
                        _ck = _obj_bl.Billing_Detail_InsertBatch(_lst_billing_detail, _billing_id);
                    }

                    if (_ck > 0 && p_Billing_Header_Info.Insert_Type == (decimal)Common.CommonData.CommonEnums.Billing_Insert_Type.Search)
                    {
                        //string _fileExport = Export_Billing(p_Billing_Header_Info.Case_Code);

                        string _mapPath_Report = Server.MapPath("~/Report/");
                        string _mapPath        = Server.MapPath("~/");

                        // bỏ đi để lúc nào gửi email thì lấy ra
                        //string _fileExport = AppsCommon.Export_Billing_Crytal_View(p_Billing_Header_Info.Case_Code, _mapPath_Report, _mapPath);

                        string          _fileExport = "";
                        SearchObject_BL _bl         = new SearchObject_BL();
                        _ck = _bl.Update_Url_Billing(p_Billing_Header_Info.App_Case_Code, _billing_id, _fileExport);

                        // insert vào docking
                        AppsCommon.Insert_Docketing(p_Billing_Header_Info.Case_Code, "Report Billing", _fileExport, true);
                    }

                    //end
                    if (_ck < 0)
                    {
                        Transaction.Current.Rollback();
                    }
                    else
                    {
                        SessionData.RemoveDataSession(p_Billing_Header_Info.App_Case_Code);
                        scope.Complete();
                    }
                }
                return(Json(new { success = _ck }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { success = "-1" }));
            }
        }
Exemple #29
0
        public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, C07_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 C07_BL();
                List<C07_Info_Export> _lst = new List<C07_Info_Export>();

                string p_appCode = "C07_Preview";

                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C07_VN_" + _datetimenow + ".pdf");
                if (language == Language.LangVI)
                {
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C07_VN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "C07_VN_" + _datetimenow + ".pdf";
                }
                else
                {
                    fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C07_EN_" + _datetimenow + ".pdf");
                    SessionData.CurrentUser.FilePreview = "/Content/Export/" + "C07_EN_" + _datetimenow + ".pdf";
                }
                // đẩy file lên server
                if (pDetail.pfileLogo != null)
                {
                    pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                }
                C07_Info_Export _C07_Info_Export = new C07_Info_Export();

                C07_Info_Export.CopyC07_Info(ref _C07_Info_Export, pDetail);

                _C07_Info_Export.LOGOURL = Server.MapPath(_C07_Info_Export.LOGOURL);

                // Phí cố định

                List<AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_C07(pDetail, pAppClassInfo);
                Prepare_Data_Export_C07(ref _C07_Info_Export, pInfo, pAppDocumentInfo, _lstFeeFix, pOther_MasterInfo,
                       pAppDocOtherInfo, pAppClassInfo);

                _lst.Add(_C07_Info_Export);
                DataSet _ds_all = ConvertData.ConvertToDataSet<C07_Info_Export>(_lst, false);
                try
                {
                    _ds_all.WriteXml(@"C:\inetpub\C07.xml", XmlWriteMode.WriteSchema);
                }
                catch (Exception ex)
                {
                    Logger.LogException(ex);
                }

                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _tempfile = "C07.rpt";
                if (pInfo.View_Language_Report == Language.LangEN)
                {
                    _tempfile = "C07_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.LOGOURL = Server.MapPath(pDetail.LOGOURL);
                    Bitmap img = new Bitmap(pDetail.LOGOURL);
                    try
                    {

                        double _Const = 6.666666666666/2;
                        int _left = 0, _top = 0, _marginleft = 225, _margintop = 5580;
                        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.LOGOURL);

                #endregion
                if (_ds_all != null)
                {
                    _ds_all.Tables[0].TableName = "Table";
                    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 });
            }
        }
        public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, decimal p_View_Translate)
        {
            try
            {
                string language = AppsCommon.GetCurrentLang();
                ApplicationHeaderInfo      applicationHeaderInfo = new ApplicationHeaderInfo();
                App_Detail_PLD01_HDCN_Info app_Detail            = new App_Detail_PLD01_HDCN_Info();
                List <AppFeeFixInfo>       appFeeFixInfos        = new List <AppFeeFixInfo>();
                List <AppDocumentInfo>     appDocumentInfos      = new List <AppDocumentInfo>();

                App_Detail_PLD01_HDCN_BL objBL = new App_Detail_PLD01_HDCN_BL();
                app_Detail = objBL.GetByID(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref appFeeFixInfos);

                string        _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/AppForms/D01_VI.docx");
                DocumentModel document  = DocumentModel.Load(_fileTemp);

                AppsCommon.Prepare_Data_Export_D01(ref app_Detail, applicationHeaderInfo, appDocumentInfos, appFeeFixInfos);

                List <App_Detail_PLD01_HDCN_Info> _lst = new List <App_Detail_PLD01_HDCN_Info>();
                _lst.Add(app_Detail);

                DataSet _ds_all = ConvertData.ConvertToDataSet <App_Detail_PLD01_HDCN_Info>(_lst, false);
                _ds_all.Tables[0].TableName = "Table_4c2";
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string _tempfile    = "TM_PLD01_HDCN.rpt";
                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                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 (applicationHeaderInfo.Languague_Code == Language.LangVI)
                    {
                        _tempfile    = "TM_PLD01_HDCN_EN.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf";
                    }
                    else
                    {
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf";
                    }
                }
                else
                {
                    if (applicationHeaderInfo.Languague_Code == Language.LangVI)
                    {
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf";
                    }
                    else
                    {
                        _tempfile    = "TM_PLD01_HDCN_EN.rpt"; // tiếng anh
                        fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf");
                        SessionData.CurrentUser.FilePreview = "/Content/Export/" + "D01_EN_" + _datetimenow + ".pdf";
                    }
                }
                oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), _tempfile));
                if (_ds_all != null)
                {
                    oRpt.SetDataSource(_ds_all);
                }
                oRpt.Refresh();

                Response.Buffer = false;
                Response.ClearContent();
                Response.ClearHeaders();

                System.IO.Stream oStream   = oRpt.ExportToStream(CrystalDecisions.Shared.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 }));
            }
        }