Пример #1
0
        private string GetDocHTML(int docId, bool isPdf)
        {
            CourtAct courtAct = CourtActBL.GetCourtAct(
                docId,
                this.Language.Id,
                UserData.UserId,
                new DocHighlightSearchParams(null, null, false, null, null),
                ProductId,
                this.UserData.ShowFreeDocuments);

            var content = GetViewString("~/Views/Doc/Act.cshtml", courtAct, true);

            StringBuilder html = new StringBuilder();

            html.Append("<html><head><meta charset=\"UTF-8\">");

            if (isPdf == true)
            {
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/doc.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/eurocases.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/layout.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/doc-list.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/doc-top-bar.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/search.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/spritecrops.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/xslt/styleActGeneral.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/xslt/styleActEuroLexJudgment.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/xslt/styleGeneral.css\">");
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/xslt/styleJudgmentGeneral.css\">");
            }
            else
            {
                html.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../Content/Styles/export-rtf.css\">");
            }

            html.Append("</head><body>");
            content = content.Replace("section", "div");
            content = content.Replace("header", "div");
            html.Append(content);
            html.Append("</body></html>");

            html = html.Replace("/DocImages", ConfigurationManager.AppSettings["BaseDocImagesPath"]);

            return(html.ToString());
        }
        public ActionResult Index(string firstDocument, string secondDocument)
        {
            int firstDocLangId  = int.Parse(firstDocument);
            int secondDocLangId = int.Parse(secondDocument);

            var highlightParams = new DocHighlightSearchParams(null, null, true, null, null);

            var firstContentArray =
                CourtActBL.GetCourtAct(firstDocLangId,
                                       this.Language.Id,
                                       UserData.UserId,
                                       highlightParams,
                                       ProductId,
                                       this.UserData.ShowFreeDocuments)
                .HtmlModel
                .Body
                .Content;

            var secondContentArray =
                CourtActBL.GetCourtAct(
                    secondDocLangId,
                    this.Language.Id,
                    UserData.UserId,
                    highlightParams,
                    ProductId,
                    this.UserData.ShowFreeDocuments)
                .HtmlModel
                .Body
                .Content;

            var firstContent  = String.Join(String.Empty, firstContentArray);
            var secondContent = String.Join(String.Empty, secondContentArray);

            Merger merger = new Merger(firstContent, secondContent);
            string result = merger.Merge();

            ViewBag.Html = result;

            return(View());
        }
Пример #3
0
        public ActionResult Vat32006L0112(int?id, string docNum)
        {
            var  userData           = this.Session["UserData"] as UserData;
            bool hasFinancesProduct = userData.Products.Select(x => x.ProductId == 2).ToList().Count > 0 ? true : false;

            if (!hasFinancesProduct)
            {
                return(this.RedirectToAction("Index", "Home"));
            }

            if (this.ProductId == 1)
            {
                this.Session["SelectedProductId"] = "2";

                var updatedCookie = new System.Web.HttpCookie("SelectedProductId")
                {
                    HttpOnly = false,
                    Secure   = false,
                    Expires  = DateTime.Now.AddDays(365)
                };
                updatedCookie.Value = "2";
                this.Response.Cookies.Set(updatedCookie);
            }

            Document courtAct = null;

            if (id == null)
            {
                string docNumber = docNum ?? "32006L0112";
                var    document  = Doc.GetDocByDocNumber(docNumber, this.Language.Id, this.UserData.UserId);
                id = document.DocLangId;
            }

            bool showFreeDocs = this.UserData.ShowFreeDocuments;

            //if (Session["local-search-" + id + "-" + siteSearchId] != null && Session["local-search-" + id + "-" + siteSearchId].ToString() != "")
            //{
            //    var highLightParams = new DocHighlightSearchParams();
            //    highLightParams.SearchText = Session["local-search-" + id + "-" + siteSearchId].ToString();
            //    highLightParams.ExactMatch = Convert.ToBoolean(Session["local-search-exactmatch-" + id + "-" + siteSearchId]);

            //    courtAct = CourtActBL.GetCourtAct(
            //        docLangId,
            //        this.Language.Id,
            //        Languages.GetXsltRubrics(typeof(Resources.Resources)),
            //        c => Languages.GetXsltRubricsByCulture<Resources.Resources>(c),
            //        UserData.UserId,
            //        highLightParams,
            //        ProductId,
            //        showFreeDocs);
            //}
            if (this.Session["local-search-" + id] != null && this.Session["local-search-exactmatch-" + id] != null)
            {
                var highLightParams = new DocHighlightSearchParams();
                highLightParams.SearchText = this.Session["local-search-" + id].ToString();
                highLightParams.ExactMatch = false;

                courtAct = CourtActBL.GetCourtAct(
                    id.Value,
                    this.Language.Id,
                    this.UserData.UserId,
                    highLightParams,
                    this.ProductId,
                    showFreeDocs);
            }

            if (courtAct == null)
            {
                courtAct = CourtActBL.GetCourtAct(
                    id.Value,
                    this.Language.Id,
                    this.UserData.UserId,
                    new DocHighlightSearchParams(),
                    this.ProductId,
                    showFreeDocs);
            }

            var docConts = Doc.GetDocContents(courtAct.DocLangId);
            var vm       = new Vat32006L0112(courtAct, docConts);

            return(this.View("~/Views/Doc/Vat32006L0112.cshtml", vm));
        }
Пример #4
0
        public ActionResult CourtAct(int id, int?siteSearchId)
        {
            CourtAct courtAct = null;

            if (this.CheckRights)
            {
                int[]             productIds = Doc.GetDocProducts(id);
                IEnumerable <int> prod       = this.UserData.Products.Select(p => p.ProductId).ToArray().Intersect(productIds);
                if (prod.Count() == 0)
                {
                    string[] products = ((List <Product>) this.Session["ProductsList"]).Where(p => productIds.Contains(p.ProductId) == true).Select(p => p.ProductName).ToArray();
                    string   errorMsg = "To open this document you need valid license for '" + String.Join("' or '", products) + "'";

                    this.ViewBag.DocError = errorMsg;
                    return(this.View(new CourtAct()));
                }
            }

            bool showFreeDocs = this.UserData.ShowFreeDocuments;

            #region Search and stats creatings
            if (siteSearchId.HasValue)
            {
                ViewBag.SiteSearchId = siteSearchId.Value;
                //int searchId = int.Parse(siteSearchId.Substring(siteSearchId.LastIndexOf('-') + 1));

                SearchResult sr = SearchResult.FindSearchResult(siteSearchId.Value, this.Session["SearchResults"]);

                if (sr != null)
                {
                    // if text is searched - add to statistic
                    if (sr.StatSearchId.HasValue)
                    {
                        Stat.SetStatSearchDoc(sr.StatSearchId.Value, id);
                    }

                    if (sr.SearchSource == SearchSources.Search)
                    {
                        if (this.Session["local-search-" + id + "-" + siteSearchId] != null && this.Session["local-search-" + id + "-" + siteSearchId].ToString() != "")
                        {
                            var highLightParams = new DocHighlightSearchParams(
                                this.Session["local-search-" + id + "-" + siteSearchId].ToString(),
                                null,
                                Convert.ToBoolean(this.Session["local-search-exactmatch-" + id + "-" + siteSearchId]),
                                null,
                                null);

                            courtAct = CourtActBL.GetCourtAct(
                                id,
                                this.Language.Id,
                                this.UserData.UserId,
                                highLightParams,
                                this.ProductId,
                                showFreeDocs);
                        }
                        else
                        {
                            var complexSearchText = sr.SearchBoxFilters.SearchText;
                            if (sr.SearchBoxFilters.Cases != null && !String.IsNullOrEmpty(sr.SearchBoxFilters.Cases.MultiDict.Text))
                            {
                                if (!String.IsNullOrEmpty(sr.SearchBoxFilters.SearchText))
                                {
                                    complexSearchText = complexSearchText + " AND (";
                                }
                                else
                                {
                                    complexSearchText = "(";
                                }

                                complexSearchText = complexSearchText + sr.SearchBoxFilters.Cases.MultiDict.Text;    // combining search text with multilingial dictionary if present
                                complexSearchText = complexSearchText.Replace("OR", "[OR]").Replace("AND", "[AND]"); // trimming logical operators
                                complexSearchText = complexSearchText + ")";
                            }
                            else if (sr.SearchBoxFilters.Law != null && !String.IsNullOrEmpty(sr.SearchBoxFilters.Law.MultiDict.Text))
                            {
                                if (!String.IsNullOrEmpty(sr.SearchBoxFilters.SearchText))
                                {
                                    complexSearchText = complexSearchText + " AND (";
                                }
                                else
                                {
                                    complexSearchText = "(";
                                }

                                complexSearchText = complexSearchText + sr.SearchBoxFilters.Law.MultiDict.Text;      // combining search text with multilingial dictionary if present
                                complexSearchText = complexSearchText.Replace("OR", "[OR]").Replace("AND", "[AND]"); // trimming logical operators
                                complexSearchText = complexSearchText + ")";
                            }
                            else if (sr.SearchBoxFilters.MultiDict != null && !String.IsNullOrEmpty(sr.SearchBoxFilters.MultiDict.Text))
                            {
                                if (!String.IsNullOrEmpty(sr.SearchBoxFilters.SearchText))
                                {
                                    complexSearchText = complexSearchText + " AND (";
                                }
                                else
                                {
                                    complexSearchText = "(";
                                }

                                complexSearchText = complexSearchText + sr.SearchBoxFilters.MultiDict.Text;          // combining search text with multilingial dictionary if present
                                complexSearchText = complexSearchText.Replace("OR", "[OR]").Replace("AND", "[AND]"); // trimming logical operators
                                complexSearchText = complexSearchText + ")";
                            }

                            var highLightParams = new DocHighlightSearchParams();

                            if (!String.IsNullOrEmpty(sr.SearchBoxFilters.SearchTextMultiLingual))
                            {
                                highLightParams.SearchText = complexSearchText;
                                highLightParams.MultilingualSearchedText = sr.SearchBoxFilters.SearchTextMultiLingual;
                                highLightParams.ExactMatch = sr.SearchBoxFilters.ExactMatch;

                                if (sr.SearchBoxFilters.Cases != null && !String.IsNullOrEmpty(sr.SearchBoxFilters.Cases.NatID_ECLI))
                                {
                                    highLightParams.SearchedCelex = sr.SearchBoxFilters.Cases.NatID_ECLI;
                                }
                                else
                                {
                                    courtAct = CourtActBL.GetCourtAct(
                                        id,
                                        this.Language.Id,
                                        this.UserData.UserId,
                                        highLightParams,
                                        this.ProductId,
                                        showFreeDocs);
                                }
                            }
                            else
                            {
                                highLightParams.SearchText = complexSearchText;
                                highLightParams.ExactMatch = sr.SearchBoxFilters.ExactMatch;

                                if (sr.SearchBoxFilters.Cases != null)
                                {
                                    if (!String.IsNullOrEmpty(sr.SearchBoxFilters.Cases.EnactmentCelex))
                                    {
                                        highLightParams.SearchedCelex = sr.SearchBoxFilters.Cases.EnactmentCelex;
                                    }

                                    if (!String.IsNullOrEmpty(sr.SearchBoxFilters.Cases.ProvisionParOriginal))
                                    {
                                        var searchedPars = new List <string>();
                                        searchedPars.Add(sr.SearchBoxFilters.Cases.ProvisionParOriginal);
                                        highLightParams.SearchedPars = searchedPars;
                                    }
                                }

                                courtAct = CourtActBL.GetCourtAct(
                                    id,
                                    this.Language.Id,
                                    this.UserData.UserId,
                                    highLightParams,
                                    this.ProductId,
                                    showFreeDocs);
                            }
                        }
                    }
                    else if (sr.SearchSource == SearchSources.InLinks)
                    {
                        var highlightParams = new DocHighlightSearchParams();
                        if (!String.IsNullOrEmpty(sr.SearchBoxFilters.DocInLinks.ToDocNumber))
                        {
                            highlightParams.SearchedCelex = sr.SearchBoxFilters.DocInLinks.ToDocNumber;
                        }

                        if (sr.SearchBoxFilters.DocInLinks.ToPars != null && sr.SearchBoxFilters.DocInLinks.ToPars.Count > 0)
                        {
                            highlightParams.SearchedPars = sr.SearchBoxFilters.DocInLinks.ToPars;
                        }

                        /* Highlight for inlinks should go here */

                        courtAct = CourtActBL.GetCourtAct(
                            id,
                            this.Language.Id,
                            this.UserData.UserId,
                            highlightParams,
                            this.ProductId,
                            showFreeDocs);
                    }
                }
            }
            else if (this.Session["local-search-" + id + "-" + siteSearchId] != null && this.Session["local-search-" + id + "-" + siteSearchId].ToString() != "")
            {
                var highLightParams = new DocHighlightSearchParams();
                highLightParams.SearchText = this.Session["local-search-" + id + "-" + siteSearchId].ToString();
                highLightParams.ExactMatch = Convert.ToBoolean(this.Session["local-search-exactmatch-" + id + "-" + siteSearchId]);

                courtAct = CourtActBL.GetCourtAct(
                    id,
                    this.Language.Id,
                    this.UserData.UserId,
                    highLightParams,
                    this.ProductId,
                    showFreeDocs);
            }
            else if (this.Session["local-search-" + id] != null && this.Session["local-search-exactmatch-" + id] != null)
            {
                var highLightParams = new DocHighlightSearchParams();
                highLightParams.SearchText = this.Session["local-search-" + id].ToString();
                highLightParams.ExactMatch = Convert.ToBoolean(this.Session["local-search-exactmatch-" + id + "-" + siteSearchId]);

                courtAct = CourtActBL.GetCourtAct(
                    id,
                    this.Language.Id,
                    this.UserData.UserId,
                    highLightParams,
                    this.ProductId,
                    showFreeDocs);
            }

            if (courtAct == null)
            {
                var highLightParams = new DocHighlightSearchParams(null, null, false, null, null);

                courtAct = CourtActBL.GetCourtAct(
                    id,
                    this.Language.Id,
                    this.UserData.UserId,
                    highLightParams,
                    this.ProductId,
                    showFreeDocs);
            }

            #endregion

            if (courtAct != null)
            {
                // Rewriting inline links before visualization
                var linkRewriter = new DocLinksRewriter(courtAct.LangId, WebAppHelper.AppRootFolder, this.UserData.OpenDocumentsInNewTab, this.NationalLegislationMapPath);
                courtAct.RewriteInLineLinks(linkRewriter);

                this.ViewBag.Title = courtAct.HtmlModel.Title.Value.ToString();
                //only limited number of docs are avaiable in sysdemo
                //List<string> avaiableDocsCelexes = ConfigurationManager.AppSettings["SysDemoDocumentsCelex"].ToString().Split(',').ToList();
                //if (this.UserData.Username.ToLower() == "sysdemo")
                //{
                //    Regex reglamentsAndDirectivesRegex = new Regex("3.{4}[RrLl](.*)");

                //    if (!((courtAct.DocType == 2 && !courtAct.DocNumber.StartsWith("7")) ||
                //        avaiableDocsCelexes.Any(c => c == courtAct.DocNumber) ||
                //        (courtAct.DocType == 1 && courtAct.DocNumber.Substring(0, 1) == "6" && courtAct.Country.ToLower() == "eu") ||
                //        reglamentsAndDirectivesRegex.IsMatch(courtAct.DocNumber) ||
                //        Doc.IsInternationalStandartDoc(courtAct.DocLangId) ||
                //        Doc.IsDemoDoc(courtAct.DocLangId)))
                //    {
                //        if (Common.CheckRequestOriginIsBotSoft(this.Request.UserAgent) || this.DemoBonusDocumentsCheck(courtAct.DocNumber) == false)
                //        {
                //            var productFeaturesInfo = new ProductFeaturesInfo(FunctionalityTypes.DocumentOpen, courtAct);
                //            string viewName = this.ProductId == 1 ? "~/Views/Shared/_ProductFeaturesInfo_Wrapper.cshtml" : "~/Views/Shared/_ProductFeaturesInfo_Finances.cshtml";
                //            this.ViewBag.UseLayout = true;
                //            return this.View(viewName, productFeaturesInfo);
                //        }
                //        else
                //        {
                //            // refresh bonus docs cookie
                //            var currentBonusDocsCookie = this.Request.Cookies["dmbnsdcs"];
                //            var newCookie = this.ComputeDemoBonusDocsCookie(currentBonusDocsCookie, courtAct.DocNumber);
                //            this.Response.Cookies.Set(newCookie);
                //        }
                //    }
                //}

                // add ro recent documents
                int maxCount     = Convert.ToInt32(ConfigurationManager.AppSettings["RecentDocumentsCount"]);
                int curProductId = 1;
                if (this.Session["SelectedProductId"] != null)
                {
                    curProductId = int.Parse(this.Session["SelectedProductId"].ToString());
                }

                if (this.UserData.Username.ToLower() != "sysdemo" ||
                    (this.UserData.Username.ToLower() == "sysdemo" && !Common.CheckRequestOriginIsBotSoft(this.Request.UserAgent)))
                {
                    Doc.AddRecentDoc(this.UserData.UserId, id, maxCount, curProductId); // add to recent documents
                    Doc.AddOpenedDoc(this.UserData.UserId, id, curProductId);           // add to stat
                }

                if (courtAct.BloblInfo.IsBlob)
                {
                    var contentType = MimeMapping.GetMimeMapping(courtAct.BloblInfo.Path);

                    return(this.File(fileName: courtAct.BloblInfo.Path, contentType: contentType));
                }
                else
                {
                    return(this.View(courtAct));
                }
            }
            else
            {
                return(this.RedirectToAction("Index", "Home"));
            }
        }