Exemple #1
0
        public App_Detail_PLD01_HDCN_Info GetByID(decimal p_app_header_id, string p_language_code,
                                                  ref ApplicationHeaderInfo applicationHeaderInfo,
                                                  ref List <AppDocumentInfo> appDocumentInfos, ref List <AppFeeFixInfo> appFeeFixInfos)
        {
            try
            {
                var     objData = new App_Detail_PLD01_HDCN_DA();
                DataSet dataSet = objData.GetByID(p_app_header_id, p_language_code);
                App_Detail_PLD01_HDCN_Info _App_Detail_PLB02_CGD_Info = CBO <App_Detail_PLD01_HDCN_Info> .FillObjectFromDataSet(dataSet);

                if (dataSet != null && dataSet.Tables.Count == 4)
                {
                    applicationHeaderInfo = CBO <ApplicationHeaderInfo> .FillObjectFromDataTable(dataSet.Tables[1]);

                    appDocumentInfos = CBO <AppDocumentInfo> .FillCollectionFromDataTable(dataSet.Tables[2]);

                    appFeeFixInfos = CBO <AppFeeFixInfo> .FillCollectionFromDataTable(dataSet.Tables[3]);
                }

                return(_App_Detail_PLB02_CGD_Info);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new App_Detail_PLD01_HDCN_Info());
            }
        }
        public ActionResult ExportData_IU(ApplicationHeaderInfo pInfo, App_Detail_PLD01_HDCN_Info pDetail,
                                          List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                string language = AppsCommon.GetCurrentLang();

                // Fill export_header
                string fileName_docx = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VI_" + TradeMarkAppCode.AppCode_TM_4C2_PLD_01_HDCN + ".docx");

                AppsCommon.Prepare_Data_Export_D01(ref pDetail, pInfo, pAppDocumentInfo, pFeeFixInfo);

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

                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 _tempfile    = "TM_PLD01_HDCN.rpt";
                string _datetimenow = DateTime.Now.ToString("ddMMyyyyHHmm");
                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "D01_VN_" + _datetimenow + ".pdf");
                if (language == 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));
                //oRpt.Load(Path.Combine(Server.MapPath("~/Report/"), "TM_PLD01_HDCN.rpt"));

                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 }));
            }
        }
Exemple #3
0
        public C08_Info_Export GetByID_Exp(decimal p_app_header_id, string p_language_code,
                                           ref ApplicationHeaderInfo applicationHeaderInfo,
                                           ref List <AppDocumentInfo> appDocumentInfos,
                                           ref List <AppFeeFixInfo> appFeeFixInfos,
                                           ref List <Other_MasterInfo> pOther_MasterInfo,
                                           ref List <AppDocumentOthersInfo> pAppDocOtherInfo)
        {
            try
            {
                C08_DA          _obj_da   = new C08_DA();
                DataSet         dataSet   = _obj_da.GetByID(p_app_header_id, p_language_code);
                C08_Info_Export _C08_Info = CBO <C08_Info_Export> .FillObjectFromDataSet(dataSet);

                if (dataSet != null && dataSet.Tables.Count == 6)
                {
                    applicationHeaderInfo = CBO <ApplicationHeaderInfo> .FillObjectFromDataTable(dataSet.Tables[1]);

                    appDocumentInfos = CBO <AppDocumentInfo> .FillCollectionFromDataTable(dataSet.Tables[2]);

                    appFeeFixInfos = CBO <AppFeeFixInfo> .FillCollectionFromDataTable(dataSet.Tables[3]);

                    pOther_MasterInfo = CBO <Other_MasterInfo> .FillCollectionFromDataTable(dataSet.Tables[4]);

                    pAppDocOtherInfo = CBO <AppDocumentOthersInfo> .FillCollectionFromDataTable(dataSet.Tables[5]);
                }
                return(_C08_Info);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new C08_Info_Export());
            }
        }
        public ApplicationHeaderInfo Get_Info_After_Filling(string p_case_code, string p_user_name, string p_language_code,
                                                            ref List <B_Todos_Info> b_Todos_Infos, ref List <Billing_Header_Info> billing_Header_Infos,
                                                            ref List <Docking_Info> docking_Infos, ref List <App_Notice_Info> app_Notice_Infos, ref List <B_Remind_Info> b_Remind_Infos)
        {
            try
            {
                Application_Header_DA _da = new Application_Header_DA();
                DataSet _ds = _da.Get_Info_After_Filling(p_case_code, p_user_name, p_language_code);
                ApplicationHeaderInfo _ApplicationHeaderInfo = CBO <ApplicationHeaderInfo> .FillObjectFromDataTable(_ds.Tables[0]);

                b_Todos_Infos = CBO <B_Todos_Info> .FillCollectionFromDataTable(_ds.Tables[1]);

                billing_Header_Infos = CBO <Billing_Header_Info> .FillCollectionFromDataTable(_ds.Tables[2]);

                docking_Infos = CBO <Docking_Info> .FillCollectionFromDataTable(_ds.Tables[3]);

                app_Notice_Infos = CBO <App_Notice_Info> .FillCollectionFromDataTable(_ds.Tables[4]);

                b_Remind_Infos = CBO <B_Remind_Info> .FillCollectionFromDataTable(_ds.Tables[5]);


                return(_ApplicationHeaderInfo);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new ApplicationHeaderInfo());
            }
        }
Exemple #5
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);
     }
 }
 public int AppHeaderUpdate(ApplicationHeaderInfo pInfo)
 {
     try
     {
         Application_Header_DA objData = new Application_Header_DA();
         return(objData.AppHeaderUpdate(pInfo));
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return(ErrorCode.Error);
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="pInfo"></param>
 /// <returns>TRA RA ID CUA BANG KHI INSERT THANH CONG</returns>
 public int AppHeaderInsert(ApplicationHeaderInfo pInfo, ref string p_case_code)
 {
     try
     {
         Application_Header_DA objData = new Application_Header_DA();
         return(objData.AppHeaderInsert(pInfo, ref p_case_code));
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return(ErrorCode.Error);
     }
 }
Exemple #8
0
 public ActionResult FillTT_Header(string appno)
 {
     try
     {
         Application_Header_BL objBL = new Application_Header_BL();
         ApplicationHeaderInfo _applicationheaderinfo = objBL.GetMasterByAppNo(appno, "", "");
         ViewBag.objAppHeaderInfo = _applicationheaderinfo;
         return(PartialView("~/Areas/TradeMark/Views/Shared/_PartialThongTinDaiDienChuDon.cshtml", "2"));
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
         return(PartialView("~/Areas/TradeMark/Views/Shared/_PartialThongTinDaiDienChuDon.cshtml", "2"));
     }
 }
        public ActionResult GetFee(ApplicationHeaderInfo pInfo, App_Detail_PLD01_HDCN_Info pDetail, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_D01(pDetail, pFeeFixInfo);
                ViewBag.LstFeeFix = _lstFeeFix;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            var PartialTableListFees = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/Patent/Views/Shared/_PartialTableListFees.cshtml");
            var json = Json(new { success = 1, PartialTableListFees });

            return(json);
        }
Exemple #10
0
        public ActionResult GetFee_View(ApplicationHeaderInfo pInfo)
        {
            try
            {
                AppFeeFixBL _AppFeeFixBL = new AppFeeFixBL();
                List<AppFeeFixInfo> _lstFeeFix = _AppFeeFixBL.GetByCaseCode(pInfo.Case_Code);
                ViewBag.LstFeeFix = _lstFeeFix;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            var PartialTableListFees = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/Patent/Views/Shared/_PartialTableListFees.cshtml");
            var json = Json(new { success = 1, PartialTableListFees });
            return json;
        }
Exemple #11
0
        public A01_Info_Export GetByID_Exp(decimal p_app_header_id, string p_language_code,
                                           ref ApplicationHeaderInfo applicationHeaderInfo,
                                           ref List <AppDocumentInfo> appDocumentInfos, ref List <AppFeeFixInfo> appFeeFixInfos,
                                           ref List <AuthorsInfo> pAppAuthorsInfo, ref List <Other_MasterInfo> pOther_MasterInfo,
                                           ref List <AppClassDetailInfo> appClassDetailInfos, ref List <AppDocumentOthersInfo> pAppDocOtherInfo,
                                           ref List <UTienInfo> pUTienInfo, ref List <AppDocumentOthersInfo> pLstImagePublic)
        {
            try
            {
                A01_DA          _obj_da   = new A01_DA();
                DataSet         dataSet   = _obj_da.GetByID(p_app_header_id, p_language_code);
                A01_Info_Export _A01_Info = CBO <A01_Info_Export> .FillObjectFromDataSet(dataSet);

                if (dataSet != null && dataSet.Tables.Count == 10)
                {
                    applicationHeaderInfo = CBO <ApplicationHeaderInfo> .FillObjectFromDataTable(dataSet.Tables[1]);

                    appDocumentInfos = CBO <AppDocumentInfo> .FillCollectionFromDataTable(dataSet.Tables[2]);

                    appFeeFixInfos = CBO <AppFeeFixInfo> .FillCollectionFromDataTable(dataSet.Tables[3]);

                    pOther_MasterInfo = CBO <Other_MasterInfo> .FillCollectionFromDataTable(dataSet.Tables[4]);

                    pAppAuthorsInfo = CBO <AuthorsInfo> .FillCollectionFromDataTable(dataSet.Tables[5]);

                    appClassDetailInfos = CBO <AppClassDetailInfo> .FillCollectionFromDataTable(dataSet.Tables[6]);

                    pAppDocOtherInfo = CBO <AppDocumentOthersInfo> .FillCollectionFromDataTable(dataSet.Tables[7]);

                    pUTienInfo = CBO <UTienInfo> .FillCollectionFromDataTable(dataSet.Tables[8]);

                    pLstImagePublic = CBO <AppDocumentOthersInfo> .FillCollectionFromDataTable(dataSet.Tables[9]);
                }

                return(_A01_Info);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new A01_Info_Export());
            }
        }
        public ActionResult GetFee(ApplicationHeaderInfo pInfo, App_Detail_PLB01_SDD_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo, List <UTienInfo> pUTienInfo, List <AppDocumentOthersInfo> pLstImagePublic)
        {
            try
            {
                //AppsCommon.Prepare_Data_Export_3B(ref pDetail, pInfo, pAppDocumentInfo);
                List <AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_3B(pDetail);
                ViewBag.LstFeeFix = _lstFeeFix;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            var PartialTableListFees = AppsCommon.RenderRazorViewToString(this.ControllerContext, "~/Areas/Patent/Views/Shared/_PartialTableListFees.cshtml");
            var json = Json(new { success = 1, PartialTableListFees });

            return(json);

            //return PartialView("~/Areas/Patent/Views/A01/_PartialTableListFees.cshtml");
        }
Exemple #13
0
        public Billing_Header_Info Billing_GetBy_Code(string p_case_code, string p_language_code,
                                                      ref ApplicationHeaderInfo applicationHeaderInfo, ref List <Billing_Detail_Info> p_lst_billing_detail)
        {
            try
            {
                Billing_DA _da = new Billing_DA();
                DataSet    _ds = _da.Billing_GetBy_Code(p_case_code, p_language_code);

                p_lst_billing_detail = CBO <Billing_Detail_Info> .FillCollectionFromDataTable(_ds.Tables[1]);

                applicationHeaderInfo = CBO <ApplicationHeaderInfo> .FillObjectFromDataTable(_ds.Tables[2]);

                return(CBO <Billing_Header_Info> .FillObjectFromDataTable(_ds.Tables[0]));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new Billing_Header_Info());
            }
        }
        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 #15
0
        public A02_Info GetByID(decimal p_app_header_id, string p_language_code,
                                ref ApplicationHeaderInfo applicationHeaderInfo,
                                ref List <AppDocumentInfo> appDocumentInfos, ref List <AppFeeFixInfo> appFeeFixInfos,
                                ref List <AuthorsInfo> pAppAuthorsInfo, ref List <Other_MasterInfo> pOther_MasterInfo,
                                ref List <AppDocumentOthersInfo> pAppDocOtherInfo,
                                ref List <AppDocumentOthersInfo> pAppDocDesign)
        {
            try
            {
                A02_DA   _obj_da   = new A02_DA();
                DataSet  dataSet   = _obj_da.GetByID(p_app_header_id, p_language_code);
                A02_Info _A02_Info = CBO <A02_Info> .FillObjectFromDataSet(dataSet);

                if (dataSet != null && dataSet.Tables.Count == 8)
                {
                    applicationHeaderInfo = CBO <ApplicationHeaderInfo> .FillObjectFromDataTable(dataSet.Tables[1]);

                    appDocumentInfos = CBO <AppDocumentInfo> .FillCollectionFromDataTable(dataSet.Tables[2]);

                    appFeeFixInfos = CBO <AppFeeFixInfo> .FillCollectionFromDataTable(dataSet.Tables[3]);

                    pOther_MasterInfo = CBO <Other_MasterInfo> .FillCollectionFromDataTable(dataSet.Tables[4]);

                    pAppAuthorsInfo = CBO <AuthorsInfo> .FillCollectionFromDataTable(dataSet.Tables[5]);

                    pAppDocOtherInfo = CBO <AppDocumentOthersInfo> .FillCollectionFromDataTable(dataSet.Tables[6]);

                    pAppDocDesign = CBO <AppDocumentOthersInfo> .FillCollectionFromDataTable(dataSet.Tables[7]);
                }

                return(_A02_Info);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(new A02_Info());
            }
        }
        public ActionResult ExportDataNew(ApplicationHeaderInfo pInfo, AppTM06DKQTInfoExport pDetail, List <AppDocumentInfo> pAppDocumentInfo,
                                          List <AppClassDetailInfo> pAppClassInfo)
        {
            try
            {
                //  AppTM06DKQTInfoExport pDetail= new AppTM06DKQTInfoExport();
                string _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/AppForms/C06_Request for_international_trademark_registration_vi_exp.doc");

                // Fill export_header
                string fileName = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C06_Request_for_international_trademark_registration_vi_exp_" + pInfo.Appcode + ".pdf");
                // Fill export_detail
                pDetail.Status        = 254;
                pDetail.Status_Form   = 252;
                pDetail.Relationship  = "11";
                pDetail.strNgayNopDon = pDetail.NGAYNOPDON.ToDateStringN0();
                if (pDetail.REF_APPNO_TEXT != null)
                {
                    pDetail.REF_APPNO_TEXT = pDetail.REF_APPNO_TEXT.Trim();
                }
                pDetail = CreateInstanceTM06DKQT.CopyAppHeaderInfo(pDetail, pInfo);

                if (pAppClassInfo != null)
                {
                    Hashtable _hsGroupclass = new Hashtable();
                    foreach (var item in pAppClassInfo)
                    {
                        AppClassDetailInfo _newinfo = new AppClassDetailInfo();
                        _newinfo.CloneObj();
                        if (_hsGroupclass.ContainsKey(item.Code.Substring(0, 2)))
                        {
                            _newinfo = (AppClassDetailInfo)_hsGroupclass[item.Code.Substring(0, 2)];
                        }
                        _newinfo.Code       = item.Code;
                        _newinfo.Textinput += item.Textinput + ", ";
                        _newinfo.IntTongSanPham++;
                        _hsGroupclass[item.Code.Substring(0, 2)] = _newinfo;
                    }
                    List <AppClassDetailInfo> _listApp = new List <AppClassDetailInfo>();
                    foreach (DictionaryEntry item in _hsGroupclass)
                    {
                        _listApp.Add((AppClassDetailInfo)item.Value);
                    }
                    foreach (AppClassDetailInfo item in _listApp.OrderBy(m => m.Code))
                    {
                        pDetail.strListClass += "Nhóm " + item.Code.Substring(0, 2) + ": " + item.Textinput.Trim().Trim(',') + " (" + (item.IntTongSanPham < 10 ? "0" + item.IntTongSanPham.ToString() : item.IntTongSanPham.ToString()) + " sản phẩm)" + "\n";
                    }
                }

                // đẩy file lên server
                if (pDetail.pfileLogo != null)
                {
                    pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                }

                if (!string.IsNullOrEmpty(pDetail.LOGOURL))
                {
                    //Kết xuất ảnh
                }

                #region hiển thị tài liệu đính kèm
                if (pAppDocumentInfo == null)
                {
                    pAppDocumentInfo = new List <AppDocumentInfo>();
                }
                foreach (AppDocumentInfo item in pAppDocumentInfo)
                {
                    if (item.Document_Id == "C06DKQT_D_01")
                    {
                        pDetail.TOKHAI_USED    = item.Isuse.ToString();
                        pDetail.TOKHAI_SOTRANG = item.CHAR01;
                        pDetail.TOKHAI_SOBAN   = item.CHAR02;
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_02")
                    {
                        pDetail.MAUDK_VPQT_USED    = item.Isuse.ToString();
                        pDetail.MAUDK_VPQT_SO      = item.CHAR01;
                        pDetail.MAUDK_VPQT_NGONNGU = item.CHAR02;
                        pDetail.MAUDK_VPQT_SOTRANG = item.CHAR03;
                        pDetail.MAUDK_VPQT_SOBAN   = item.CHAR04;
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_03")
                    {
                        pDetail.MAUNDH_USED  = item.Isuse.ToString();
                        pDetail.MAUNDH_SOMAU = item.CHAR01;
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_04")
                    {
                        pDetail.BANSAO_TOKHAI_USED = item.Isuse.ToString();
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_05")
                    {
                        pDetail.BANSAO_GIAYDK_NHCS_USED = item.Isuse.ToString();
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_06")
                    {
                        pDetail.BAN_CK_SD_NGANHANG_USED = item.Isuse.ToString();
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_07")
                    {
                        pDetail.GIAY_UQ_USED    = item.Isuse.ToString();
                        pDetail.GIAY_UQ_NGONNGU = item.CHAR01;
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_08")
                    {
                        pDetail.GIAY_UQ_BANDICH_USED    = item.Isuse.ToString();
                        pDetail.GIAY_UQ_BANDICH_SOTRANG = item.CHAR01;
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_09")
                    {
                        pDetail.GIAY_UQ_BANDICH_BANGOC_USED = item.Isuse.ToString();
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_010")
                    {
                        pDetail.GIAY_UQ_BANDICH_BANSAO_USED = item.Isuse.ToString();
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_011")
                    {
                        pDetail.GIAY_UQ_BANGOCNOPSAU_USED = item.Isuse.ToString();
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_012")
                    {
                        pDetail.GIAY_UQ_BANGOCNOP_THEOSO_USED = item.Isuse.ToString();
                        pDetail.GIAY_UQ_BANGOCNOP_THEOSO      = item.CHAR01;
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_013")
                    {
                        pDetail.CHUNGTU_LEPHI_USED = item.Isuse.ToString();
                        continue;
                    }
                    if (item.Document_Id == "C06DKQT_D_014")
                    {
                        pDetail.TAILIEUBOSUNG_USED = item.Isuse.ToString();
                        pDetail.TAILIEUBOSUNG      = item.CHAR01;
                        continue;
                    }
                }

                #endregion
                List <AppFeeFixInfo> pFeeFixInfo = CommonFunction.Call_Fee.CallFee_C06(pDetail);
                pDetail.LEPHI = (pFeeFixInfo[0] as AppFeeFixInfo).Amount;
                if (pInfo.Languague_Code == Language.LangEN)
                {
                    pDetail.LEPHI = (pFeeFixInfo[0] as AppFeeFixInfo).Amount_Usd;
                }
                List <AppTM06DKQTInfoExport> _lst = new List <AppTM06DKQTInfoExport>();
                pDetail.LOGOURL = Server.MapPath(pDetail.LOGOURL);
                _lst.Add(pDetail);
                DataSet _ds_all = ConvertData.ConvertToDataSet <AppTM06DKQTInfoExport>(_lst, false);

                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                string _tempfile = "C06.rpt";
                //if(AppsCommon.GetCurrentLang() == Language.LangEN)
                if (pInfo.Languague_Code != Language.LangVI)
                {
                    _tempfile = "C06.rpt";
                }

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

                //   _ds_all.WriteXmlSchema(@"C:\Users\user\Desktop\LEGALTECH\XMLFILE\TM06DKQT.xml");
                //Logger.LogInfo("b3: ");
                CrystalDecisions.CrystalReports.Engine.PictureObject _pic01;
                _pic01        = (CrystalDecisions.CrystalReports.Engine.PictureObject)oRpt.ReportDefinition.Sections[0].ReportObjects["Picture1"];
                _pic01.Width  = 200;
                _pic01.Height = 200;

                System.IO.FileInfo file = new System.IO.FileInfo(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)
                {
                }
                finally
                {
                    img.Dispose();
                }

                if (_ds_all != null)
                {
                    _ds_all.Tables[0].TableName = "Table1";
                    oRpt.SetDataSource(_ds_all);
                }
                oRpt.Refresh();

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

                System.IO.Stream oStream   = oRpt.ExportToStream(ExportFormatType.PortableDocFormat);
                byte[]           byteArray = new byte[oStream.Length];
                oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1));
                System.IO.File.WriteAllBytes(fileName, byteArray.ToArray()); // Requires System.Linq


                return(Json(new { success = 0 }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { success = 0 }));
            }
        }
        public ActionResult App_Re_Grant2Lawer()
        {
            try
            {
                if (SessionData.CurrentUser == null)
                {
                    return(Redirect("/"));
                }

                string p_case_code = "";
                if (RouteData.Values.ContainsKey("id"))
                {
                    p_case_code = RouteData.Values["id"].ToString();
                }

                // action là view hay sửa
                decimal _operator_type = Convert.ToDecimal(Common.CommonData.CommonEnums.Operator_Type.Update);
                if (RouteData.Values.ContainsKey("id1"))
                {
                    _operator_type = Convert.ToDecimal(RouteData.Values["id1"].ToString());
                }
                ViewBag.Operator_Type = _operator_type;

                Application_Header_BL _objBl = new Application_Header_BL();
                ApplicationHeaderInfo _ApplicationHeaderInfo = _objBl.GetApp_By_Case_Code_Todo(p_case_code, SessionData.CurrentUser.Username, AppsCommon.GetCurrentLang());

                string pAppCode = _ApplicationHeaderInfo.Appcode;
                SessionData.CurrentUser.chashFile.Clear();

                ViewBag.Appcode          = pAppCode;
                ViewBag.Currstatus       = (int)_ApplicationHeaderInfo.Status;
                ViewBag.objAppHeaderInfo = _ApplicationHeaderInfo;

                // ép cứng đến 1 trạng thái
                ViewBag.Re_Grant = 1;
                if (RouteData.Values.ContainsKey("id2"))
                {
                    ViewBag.Hard_Status = Convert.ToDecimal(RouteData.Values["id2"].ToString());
                }

                //  lấy dữ liệu lịch sử giao dịch
                B_Todos_BL           _B_Todos_BL = new B_Todos_BL();
                List <B_Remind_Info> _ListRemind = new List <B_Remind_Info>();
                List <B_Todos_Info>  _Listtodo   = _B_Todos_BL.NotifiGetByCasecode(p_case_code, ref _ListRemind);
                ViewBag.ListTodo   = _Listtodo;
                ViewBag.ListRemind = _ListRemind;

                // sau advise filing
                if (_ApplicationHeaderInfo.Status >= (decimal)CommonEnums.App_Status.AdminGuiKetQuaNopDon && _ApplicationHeaderInfo.Status != (decimal)CommonEnums.App_Status.AdminTuChoiKetQuaNopDon)
                {
                    // LẤY THÔNG TIN CỦA THẰNG NOTICE APP
                    App_Notice_Info_BL _notice_BL       = new App_Notice_Info_BL();
                    App_Notice_Info    _App_Notice_Info = _notice_BL.App_Notice_GetBy_CaseCode(p_case_code);
                    ViewBag.App_Notice_Info = _App_Notice_Info;

                    return(View("/Areas/TradeMark/Views/Shared/AppDetail/AppDetails_After_Filing.cshtml"));
                }
                else
                {
                    return(View("/Areas/TradeMark/Views/Shared/AppDetail/AppDetails.cshtml"));
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(View("/Areas/TradeMark/Views/Shared/AppDetail/AppDetails.cshtml"));
            }
        }
Exemple #18
0
        public static void Prepare_Data_Export_C07(ref C07_Info_Export app_Detail, ApplicationHeaderInfo applicationHeaderInfo,
           List<AppDocumentInfo> appDocumentInfos, List<AppFeeFixInfo> _lst_appFeeFixInfos, List<Other_MasterInfo> _lst_Other_MasterInfo,
             List<AppDocumentOthersInfo> _LstDocumentOthersInfo, List<AppClassDetailInfo> appClassDetailInfos)
        {
            try
            {
                // copy Header
                C07_Info_Export.CopyAppHeaderInfo(ref app_Detail, applicationHeaderInfo);


                // copy class

                // copy tác giả





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

                if (_lst_Other_MasterInfo != null && _lst_Other_MasterInfo.Count > 2)
                {
                    C07_Info_Export.CopyOther_MasterInfo(ref app_Detail, _lst_Other_MasterInfo[1], 1);
                }
                else
                {
                    C07_Info_Export.CopyOther_MasterInfo(ref app_Detail, null, 1);
                }


                #region Tài liệu có trong đơn

                if (_LstDocumentOthersInfo != null)
                {
                    foreach (var item in _LstDocumentOthersInfo)
                    {
                        if (!string.IsNullOrEmpty(item.Documentname))
                        {
                            app_Detail.strDanhSachFileDinhKem += item.Documentname + " ; ";
                        }
                    }
                    if (!string.IsNullOrEmpty(app_Detail.strDanhSachFileDinhKem))
                    {
                        app_Detail.strDanhSachFileDinhKem = app_Detail.strDanhSachFileDinhKem.Substring(0, app_Detail.strDanhSachFileDinhKem.Length - 2);
                    }

                }

                if (appDocumentInfos != null)
                {
                    foreach (AppDocumentInfo item in appDocumentInfos)
                    {
                        if (item.Document_Id == "C07_00")
                        {
                            app_Detail.Doc_Id_0 = item.CHAR01;
                            app_Detail.Doc_Id_002 = item.CHAR02;
                            app_Detail.Doc_Id_0_Check = item.Isuse;
                        }
                        if (item.Document_Id == "C07_01")
                        {
                            app_Detail.Doc_Id_1 = item.CHAR01;
                            app_Detail.Doc_Id_102 = item.CHAR02;
                            app_Detail.Doc_Id_1_Check = item.Isuse;
                        }
                        else if (item.Document_Id == "C07_02")
                        {
                            app_Detail.Doc_Id_2 = item.CHAR01;
                            app_Detail.Doc_Id_202 = item.CHAR02;

                            app_Detail.Doc_Id_2_Check = item.Isuse;
                        }
                        else if (item.Document_Id == "C07_03")
                        {
                            app_Detail.Doc_Id_3_Check = item.Isuse;
                            app_Detail.Doc_Id_3 = item.CHAR01;
                            app_Detail.Doc_Id_302 = item.CHAR02;
                        }
                        else if (item.Document_Id == "C07_04")
                        {
                            app_Detail.Doc_Id_4 = item.CHAR01;
                            app_Detail.Doc_Id_4_Check = item.Isuse;
                            app_Detail.Doc_Id_402 = item.CHAR02;
                        }
                        else if (item.Document_Id == "C07_05")
                        {
                            app_Detail.Doc_Id_5_Check = item.Isuse;
                            app_Detail.Doc_Id_5 = item.CHAR01;
                        }

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


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

                        else if (item.Document_Id == "C07_09")
                        {
                            app_Detail.Doc_Id_9 = item.CHAR01;
                            app_Detail.Doc_Id_9_Check = item.Isuse;
                        }
                        else if (item.Document_Id == "C07_10")
                        {
                            app_Detail.Doc_Id_10_Check = item.Isuse;
                            app_Detail.Doc_Id_10 = item.CHAR01;
                        }
                        else if (item.Document_Id == "C07_11")
                        {
                            app_Detail.Doc_Id_11_Check = item.Isuse;
                            app_Detail.Doc_Id_11 = item.CHAR01;
                        }


                    }

                }

                #endregion

                #region Fee
      
              
                 
                if (_lst_appFeeFixInfos.Count > 0)
                {
                    foreach (var item in _lst_appFeeFixInfos)
                    {
                        if (item.Fee_Id == 1)
                        {
                            app_Detail.Fee_Id_1 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_1_Check = item.Isuse;

                            app_Detail.Fee_Id_1_Val = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 2)
                        {
                            app_Detail.Fee_Id_2 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_2_Check = item.Isuse;
                            app_Detail.Fee_Id_2_Val = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 21)
                        {
                            app_Detail.Fee_Id_21 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_21_Check = item.Isuse;
                            app_Detail.Fee_Id_21_Val = item.Amount.ToString("#,##0.##");
                        }


                        else if (item.Fee_Id == 3)
                        {
                            app_Detail.Fee_Id_3 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_3_Check = item.Isuse;
                            app_Detail.Fee_Id_3_Val = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 4)
                        {
                            app_Detail.Fee_Id_4 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_4_Check = item.Isuse;
                            app_Detail.Fee_Id_4_Val = item.Amount.ToString("#,##0.##");
                        }

                        else if (item.Fee_Id == 41)
                        {
                            app_Detail.Fee_Id_41 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_41_Check = item.Isuse;
                            app_Detail.Fee_Id_41_Val = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 5)
                        {
                            app_Detail.Fee_Id_5 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_5_Check = item.Isuse;
                            app_Detail.Fee_Id_5_Val = item.Amount.ToString("#,##0.##");
                        }
                        else if (item.Fee_Id == 51)
                        {
                            app_Detail.Fee_Id_51 = item.Isuse == 0 ? "" : item.Number_Of_Patent.ToString();
                            app_Detail.Fee_Id_51_Check = item.Isuse;
                            app_Detail.Fee_Id_51_Val = item.Amount.ToString("#,##0.##");
                        }
                        app_Detail.Total_Fee = app_Detail.Total_Fee + item.Amount;
                        app_Detail.Total_Fee_Str = app_Detail.Total_Fee.ToString("#,##0.##");
                    }
                }
                #endregion

                #region class


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

                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }
Exemple #19
0
        public ActionResult Register(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();
                AppDocumentBL objDoc = new AppDocumentBL();
                Other_Master_BL _Other_Master_BL = new Other_Master_BL();
                Author_BL _Author_BL = new Author_BL();
                AppClassDetailBL objClassDetail = new AppClassDetailBL();
                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;
                        if (pDetail.pfileLogo != null)
                        {
                            pDetail.LOGOURL = AppLoadHelpers.PushFileToServer(pDetail.pfileLogo, AppUpload.Logo);
                        }
                        pReturn = objDetail.Insert(pDetail);


                        if (pReturn < 0)
                            goto Commit_Transaction;
                        // thêm thông tin class
                        pReturn = objClassDetail.AppClassDetailInsertBatch(pAppClassInfo, pAppHeaderID, language);
                        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;
                    }


                    //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
                    }



                    #region tính phí
                    List<AppFeeFixInfo> _lstFeeFix = Call_Fee.CallFee_C07(pDetail, pAppClassInfo);
                    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))
                                {
                                    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;
                                    }
                                }
                                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 });
            }
        }
Exemple #20
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 C07_BL();
                List<C07_Info_Export> _lst = new List<C07_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>();
                List<AppClassDetailInfo> appClassDetailInfos = new List<AppClassDetailInfo>();
                C07_Info_Export pDetail = objBL.GetByID_Exp(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref _lst_appFeeFixInfos,
                    ref _lst_Other_MasterInfo, ref _LstDocumentOthersInfo, ref appClassDetailInfos);
                pDetail.LOGOURL = Server.MapPath(pDetail.LOGOURL);
                string fileName_pdf = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "C07_VN_" + _datetimenow + ".pdf");
                if (pDetail.Languague_Code == 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";
                }

                Prepare_Data_Export_C07(ref pDetail, applicationHeaderInfo, appDocumentInfos, _lst_appFeeFixInfos, _lst_Other_MasterInfo,
                      _LstDocumentOthersInfo, appClassDetailInfos);

                _lst.Add(pDetail);
                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 (p_Language == 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
                {

                    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 ex)
                {


                }

                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();

                //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 #21
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 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 }));
            }
        }
Exemple #23
0
        public ActionResult Register_C01(ApplicationHeaderInfo pInfo, App_Detail_C01_Info pDetail,
                                         List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo,
                                         List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppDocumentOthersInfo> pLstImagePublic)
        {
            try
            {
                Application_Header_BL objBL       = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL = new AppFeeFixBL();
                App_Detail_C01_BL     objDetail   = new App_Detail_C01_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;

                    //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;
                        }
                    }

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

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

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

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

                    #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_C01(ApplicationHeaderInfo pInfo, App_Detail_C01_Info pDetail,
                                     List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo,
                                     List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppDocumentOthersInfo> pLstImagePublic)
        {
            try
            {
                Application_Header_BL objBL       = new Application_Header_BL();
                AppFeeFixBL           objFeeFixBL = new AppFeeFixBL();
                App_Detail_C01_BL     objDetail   = new App_Detail_C01_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 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);
                            }
                        }
                    }
                    #endregion

                    #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_C01(pDetail, pAppDocumentInfo, pLstImagePublic);
                    if (_lstFeeFix.Count > 0)
                    {
                        pReturn = _AppFeeFixBL.AppFeeFixInsertBath(_lstFeeFix, pInfo.Case_Code);
                        if (pReturn < 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    #endregion

                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null)
                    {
                        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);
                            }
                        }
                    }

                    #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();
                        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 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 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 #27
0
        public ActionResult ExportData_View(decimal pAppHeaderId, string p_appCode, decimal p_View_Translate)
        {
            try
            {
                string language = AppsCommon.GetCurrentLang();

                App_Detail_C01_BL            objBL = new App_Detail_C01_BL();
                ApplicationHeaderInfo        applicationHeaderInfo  = new ApplicationHeaderInfo();
                App_Detail_C01_Info          app_Detail             = new App_Detail_C01_Info();
                List <AppFeeFixInfo>         appFeeFixInfos         = new List <AppFeeFixInfo>();
                List <AppDocumentInfo>       appDocumentInfos       = new List <AppDocumentInfo>();
                List <AppDocumentOthersInfo> _LstDocumentOthersInfo = new List <AppDocumentOthersInfo>();
                List <AppDocumentOthersInfo> pLstImagePublic        = new List <AppDocumentOthersInfo>();

                app_Detail = objBL.GetByID(pAppHeaderId, language, ref applicationHeaderInfo, ref appDocumentInfos, ref appFeeFixInfos, ref _LstDocumentOthersInfo, ref pLstImagePublic);

                AppsCommon.Prepare_Data_Export_C01(ref app_Detail, applicationHeaderInfo, appDocumentInfos, pLstImagePublic);

                if (_LstDocumentOthersInfo != null)
                {
                    foreach (var item in _LstDocumentOthersInfo)
                    {
                        app_Detail.Note += item.Documentname + " ; ";
                    }

                    if (_LstDocumentOthersInfo.Count > 0)
                    {
                        app_Detail.Note = app_Detail.Note.Substring(0, app_Detail.Note.Length - 2);
                    }
                }

                List <App_Detail_C01_Info> _lst = new List <App_Detail_C01_Info>();
                _lst.Add(app_Detail);
                DataSet _ds_all = ConvertData.ConvertToDataSet <App_Detail_C01_Info>(_lst, false);
                CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

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

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

                if (_ds_all != null)
                {
                    _ds_all.Tables[0].TableName = "Table";
                    //_ds_all.WriteXml(@"C:\inetpub\C01.xml", XmlWriteMode.WriteSchema);

                    // đè 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.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 DichDonDangKy(ApplicationHeaderInfo pInfo, App_Detail_TM06DKQT_Info pDetail, List <AppDocumentInfo> pAppDocumentInfo,
                                          List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppClassDetailInfo> pAppClassInfo, List <AppFeeFixInfo> pFeeFixInfo)
        {
            try
            {
                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 = "";
                if (pInfo.Languague_Code == Language.LangVI)
                {
                    language = Language.LangEN;
                }
                else
                {
                    language = Language.LangVI;
                }
                var     CreatedBy    = SessionData.CurrentUser.Username;
                var     CreatedDate  = SessionData.CurrentUser.CurrentDate;
                int     pReturn      = ErrorCode.Success;
                int     pAppHeaderID = 0;
                decimal pIDHeaderoot = pInfo.Id;
                string  prefCaseCode = "";
                foreach (AppFeeFixInfo item in pFeeFixInfo)
                {
                    if (item.Amount == 0)
                    {
                        // fix là 2 củ
                        item.Amount = 2000000;
                    }
                }

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

                    //kiểm tra có rồi thì update, chưa có thì insert
                    if (pInfo.Id_Vi > 0)
                    {
                        pInfo.Modify_By   = CreatedBy;
                        pInfo.Modify_Date = CreatedDate;
                        pAppHeaderID      = objBL.AppHeaderUpdate(pInfo);
                    }
                    else
                    {
                        //TRA RA ID CUA BANG KHI INSERT
                        pInfo.Created_By   = CreatedBy;
                        pInfo.Created_Date = CreatedDate;
                        pAppHeaderID       = objBL.AppHeaderInsert(pInfo, ref prefCaseCode);
                    }


                    //Gán lại khi lấy dl
                    if (pAppHeaderID >= 0)
                    {
                        pReturn = objFeeFixBL.AppFeeFixInsertBath(pFeeFixInfo, prefCaseCode);
                    }
                    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)
                        {
                            pReturn = objDoc.AppDocumentTranslate(language, pIDHeaderoot, pAppHeaderID);
                        }
                    }
                    //tai lieu khac
                    if (pReturn >= 0 && pAppDocOtherInfo != null)
                    {
                        if (pAppDocOtherInfo.Count > 0)
                        {
                            var listDocument = new List <AppDocumentOthersInfo>();
                            int check        = 0;
                            foreach (var info in pAppDocOtherInfo)
                            {
                                if (!string.IsNullOrEmpty(info.Documentname))
                                {
                                    check = 1;
                                    info.App_Header_Id = pInfo.Id;
                                    info.Language_Code = language;
                                    info.IdRef         = Convert.ToDecimal(info.keyFileUpload);
                                    listDocument.Add(info);
                                }
                            }
                            if (check == 1)
                            {
                                if (pInfo.Id_Vi > 0)
                                {
                                    pReturn = objDoc.AppDocumentOtherDeletedByApp(pInfo.Id_Vi, language);
                                }
                                pReturn = objDoc.AppDocumentOtherInsertBatch(listDocument);
                            }
                        }
                    }
                    //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 #29
0
        public ActionResult ExportData_View_IU(ApplicationHeaderInfo pInfo, App_Detail_C01_Info pDetail,
                                               List <AppDocumentInfo> pAppDocumentInfo, List <AppFeeFixInfo> pFeeFixInfo, List <AppDocumentOthersInfo> pAppDocOtherInfo, List <AppDocumentOthersInfo> pLstImagePublic)
        {
            try
            {
                string _datetimenow             = DateTime.Now.ToString("ddMMyyyyHHmm");
                string language                 = AppsCommon.GetCurrentLang();
                List <App_Detail_C01_Info> _lst = new List <App_Detail_C01_Info>();

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

                AppsCommon.Prepare_Data_Export_C01(ref pDetail, pInfo, pAppDocumentInfo, pLstImagePublic);
                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);
                    }
                }
                _lst.Add(pDetail);

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

                string _tempfile = "C01.rpt";
                if (language == Language.LangEN)
                {
                    _tempfile = "C01_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 }));
            }
        }
        public ActionResult Translate_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 = "";
                if (pInfo.Languague_Code == Language.LangVI)
                {
                    language = Language.LangEN;
                }
                else
                {
                    language = Language.LangVI;
                }

                var CreatedBy = SessionData.CurrentUser.Username;

                var     CreatedDate       = SessionData.CurrentUser.CurrentDate;
                decimal pReturn           = ErrorCode.Success;
                int     pAppHeaderID      = 0;
                string  prefCaseCode      = "";
                decimal pIDHeaderRootLang = pInfo.Id;
                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
                    //kiểm tra có rồi thì update, chưa có thì insert
                    if (pInfo.Id_Vi > 0)
                    {
                        pInfo.Modify_By   = CreatedBy;
                        pInfo.Modify_Date = CreatedDate;
                        pAppHeaderID      = objBL.AppHeaderUpdate(pInfo);
                    }
                    else
                    {
                        //TRA RA ID CUA BANG KHI INSERT
                        pInfo.Created_By   = CreatedBy;
                        pInfo.Created_Date = CreatedDate;
                        pAppHeaderID       = objBL.AppHeaderInsert(pInfo, ref prefCaseCode);
                    }

                    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     = prefCaseCode;
                        pReturn = objDetail.Insert(pDetail);
                        if (pReturn <= 0)
                        {
                            goto Commit_Transaction;
                        }
                    }

                    #region Phí cố định

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

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

                    #region Tai lieu dinh kem
                    if (pReturn >= 0 && pAppDocumentInfo != null)
                    {
                        if (pAppDocumentInfo.Count > 0)
                        {
                            pReturn = objDoc.AppDocumentTranslate(language, pIDHeaderRootLang, 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 }));
            }
        }