Ejemplo n.º 1
0
    public string ShareSearchResult(string requestParam)
    {
        string RetVal;
        string[] Params;
        string DivHtml, TemplateHtml;
        string hdsby, hdbnid, hselarea, hselind, hlngcode, hlngcodedb, hselindo, hselareao;
        string Area, Indicator, GalleryParams;
        string AdaptationURL = "";
        string UserNId = "-1";
        string GalleryXML = "";

        RetVal = string.Empty;

        try
        {
            Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter);
            DivHtml = Params[0].Trim();
            hdsby = Params[1].Trim();
            if (AdaptationURL == "")
            {
                hdbnid = Global.GetDefaultDbNId();//Params[2].Trim();
            }
            else
                hdbnid = Params[2].Trim();
            hselarea = Params[3].Trim();
            hselind = Params[4].Trim();
            hlngcode = Params[5].Trim();
            hlngcodedb = Params[6].Trim();
            //hselindo = ""; // Params[7].Trim();
            //hselareao = ""; // Params[8].Trim();
            //Commented above and added below two lines to resolve bug in sharing
            hselindo = Params[7].Trim();
            hselareao = Params[8].Trim();
            Area = Params[9].Trim();
            Indicator = Params[10].Trim();
            if (Params.Length >= 12)
            AdaptationURL = Params[11].Trim();
            if (AdaptationURL != "")
            {
                try
                {
                    CatalogQdsResults.QdsResults objResults = new CatalogQdsResults.QdsResults();
                    objResults.Url = AdaptationURL + @"/libraries/ws/QdsResults.asmx";
                    string CatalogParams = "";
                    CatalogParams = DivHtml + Constants.Delimiters.ParamDelimiter + hdsby + Constants.Delimiters.ParamDelimiter + hdbnid + Constants.Delimiters.ParamDelimiter + hselarea + Constants.Delimiters.ParamDelimiter + hselind + Constants.Delimiters.ParamDelimiter + hlngcode + Constants.Delimiters.ParamDelimiter + hlngcodedb + Constants.Delimiters.ParamDelimiter + hselindo + Constants.Delimiters.ParamDelimiter + hselareao + Constants.Delimiters.ParamDelimiter + Area+ Constants.Delimiters.ParamDelimiter + Indicator + Constants.Delimiters.ParamDelimiter + "";
                    Params = Global.SplitString(CatalogParams, Constants.Delimiters.ParamDelimiter);
                    RetVal = objResults.getShareCatalogResults(CatalogParams);
                }
                catch (Exception ex) {
                    Global.CreateExceptionString(ex, null);
                }

                return RetVal;

            }

            GalleryParams = Indicator + Constants.Delimiters.ParamDelimiter + Area + Constants.Delimiters.ParamDelimiter + hlngcode + Constants.Delimiters.ParamDelimiter + hdbnid + Constants.Delimiters.ParamDelimiter + UserNId;
            GalleryXML = GetGalleryThumbnails(GalleryParams);
            RetVal = Guid.NewGuid().ToString();

            Global.GetAppSetting();
            //For Language Handling
            XmlDocument LangSharedPageGal, LangSharedPageHome;
            LangSharedPageGal = null;
            LangSharedPageHome = null;
            //string langResultsCloudView = "Cloud View";
            //string langResultsVisualize = "Visualize";
            //string langResultsDimensions = "Dimensions";
            //string langResultsDataValues = "Data values";
            string langResultsCloudView = "";
            string langResultsVisualize = "";
            string langResultsDimensions = "";
            string langResultsDataValues = "";
            string lang_ppup_Next = "Next";
            string lang_ppup_Prev = "Previous";
            string langAreas = "Areas";
            string langIndicators = "Indicators";
            string langUDKs = "Keywords";
            string langkeywords = "Keywords";
            string langGalleryModifiedOn = "Modified On  ";
            string langGalleryDescription = "Description  ";
            string langGalleryMore = "more";
            string langGalleryView = "";
            string langGalleryDownload = "";
            string langGalleryShare = "";
            string langGalleryDelete = "";
            string langMRDFor = "";
            string setShowCloud = Global.show_cloud;
            try
            {
                LangSharedPageGal = new XmlDocument();
                LangSharedPageGal.Load(Server.MapPath(@"~\stock\language\" + hlngcode.ToString() + @"\Gallery.xml"));
                foreach (XmlNode Keyword in LangSharedPageGal.GetElementsByTagName("lng"))
                {
                    if (Keyword.Attributes["id"].Value.ToUpper() == "LANGMOREAREAS")
                    {
                        langAreas = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToUpper() == "LANGMOREINDICATORS")
                    {
                        langIndicators = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToUpper() == "LANGMOREUDKS")
                    {
                        langUDKs = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "lang_ppup_next")
                    {
                        lang_ppup_Next = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "lang_ppup_prev")
                    {
                        lang_ppup_Prev = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "langkeywords ")
                    {
                        langkeywords = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "langgallerymodifiedon")
                    {
                        langGalleryModifiedOn = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "langgallerydescription")
                    {
                        langGalleryDescription = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "langgallerymore")
                    {
                        langGalleryMore = Keyword.Attributes["val"].Value;
                    }
                }
                LangSharedPageHome = new XmlDocument();
                LangSharedPageHome.Load(Server.MapPath(@"~\stock\language\" + hlngcode.ToString() + @"\Home.xml"));
                foreach (XmlNode Keyword in LangSharedPageHome.GetElementsByTagName("lng"))
                {
                    if (Keyword.Attributes["id"].Value.ToLower() == "langresultscloudview")
                    {
                        langResultsCloudView = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "langresultsvisualize")
                    {
                        langResultsVisualize = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "langresultsdimensions")
                    {
                        langResultsDimensions = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "langresultsdatavalues")
                    {
                        langResultsDataValues = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "home_view")
                    {
                        langGalleryView = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "home_download")
                    {
                        langGalleryDownload = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "home_share")
                    {
                        langGalleryShare = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "home_delete")
                    {
                        langGalleryDelete = Keyword.Attributes["val"].Value;
                    }
                    if (Keyword.Attributes["id"].Value.ToLower() == "langmrdfor")
                    {
                        langMRDFor = Keyword.Attributes["val"].Value;
                    }
                }
            }
            catch (Exception ex)
            {
                Global.CreateExceptionString(ex, null);
            }
            //Till Here
            // Json structure fixes for single quote issues
            DivHtml = DivHtml.Replace("'", @"\'");

            TemplateHtml = File.ReadAllText(Server.MapPath("../../stock/shared/qds/QDS_Template.htm"));
            TemplateHtml = TemplateHtml.Replace("QDS_DIV", DivHtml);
            TemplateHtml = TemplateHtml.Replace("QDS_TITLE", Global.adaptation_name + " - Search");
            TemplateHtml = TemplateHtml.Replace("DI_DIUILIB_URL", Global.diuilib_url);
            TemplateHtml = TemplateHtml.Replace("DI_COMPONENT_VERSION", Global.diuilib_version);
            TemplateHtml = TemplateHtml.Replace("DI_THEME_CSS", Global.diuilib_theme_css);

            TemplateHtml = TemplateHtml.Replace("src=\"..\\..\\", "src=\"..\\..\\..\\");
            TemplateHtml = TemplateHtml.Replace("..%5C..%5C", "..%5C..%5C..%5C");

            TemplateHtml = TemplateHtml.Replace("<u>share</u>", "");
            TemplateHtml = TemplateHtml.Replace(" | ", "&nbsp;&nbsp;");
            TemplateHtml = TemplateHtml.Replace("<img style=\"cursor: pointer;\" id=\"ATDV_", "<img style=\"cursor: pointer; display:none;\" id=\"ATDV_");
            TemplateHtml = TemplateHtml.Replace("QDS_hdsby", "'" + hdsby + "'");
            TemplateHtml = TemplateHtml.Replace("QDS_hdbnid", "'" + hdbnid + "'");
            TemplateHtml = TemplateHtml.Replace("QDS_hselarea", "'" + hselarea + "'");
            TemplateHtml = TemplateHtml.Replace("QDS_hselind", "'" + hselind + "'");
            TemplateHtml = TemplateHtml.Replace("QDS_hlngcode", "'" + hlngcode + "'");
            TemplateHtml = TemplateHtml.Replace("QDS_db_hlngcode", "'" + hlngcodedb + "'");
            TemplateHtml = TemplateHtml.Replace("QDS_o_hselind", "'" + Global.formatQuoteString(hselindo) + "'");
            TemplateHtml = TemplateHtml.Replace("QDS_o_hselarea", "'" + Global.formatQuoteString(hselareao) + "'");
            TemplateHtml = TemplateHtml.Replace("GALLERY_XML_DATA",GalleryXML.Replace('"', '\''));
            TemplateHtml = TemplateHtml.Replace("langHomeDimensions", langResultsDimensions);
            TemplateHtml = TemplateHtml.Replace("langHomedatavalues", langResultsDataValues);
            TemplateHtml = TemplateHtml.Replace("langHomeCloudview",langResultsCloudView);
            TemplateHtml = TemplateHtml.Replace("langHomeVisualize",langResultsVisualize);
            TemplateHtml = TemplateHtml.Replace("langGalleryIndicators",langIndicators);
            TemplateHtml = TemplateHtml.Replace("langGalleryKeywords",langUDKs);
            TemplateHtml = TemplateHtml.Replace("morelangGallery",langGalleryMore);
            TemplateHtml = TemplateHtml.Replace("ModOnlangGallery",langGalleryModifiedOn);
            TemplateHtml = TemplateHtml.Replace("DeslangGallery",langGalleryDescription);
            TemplateHtml = TemplateHtml.Replace("langGalleryAreas",langAreas);
            TemplateHtml = TemplateHtml.Replace("langGalleryPrevious",lang_ppup_Prev);
            TemplateHtml = TemplateHtml.Replace("langGalleryNext",lang_ppup_Next);
            TemplateHtml = TemplateHtml.Replace("langPopUpGalleryKeyword",langkeywords);
            TemplateHtml = TemplateHtml.Replace("langGalleryView", langGalleryView);
            TemplateHtml = TemplateHtml.Replace("langGalleryDownload", langGalleryDownload);
            TemplateHtml = TemplateHtml.Replace("langGalleryShare", langGalleryShare);
            TemplateHtml = TemplateHtml.Replace("langGalleryDelete", langGalleryDelete);
            TemplateHtml = TemplateHtml.Replace("langHomeMRDFor", langMRDFor);
            TemplateHtml = TemplateHtml.Replace("setShowCloud", setShowCloud);

            //TemplateHtml = TemplateHtml.Replace("onPageLoadOfQDS(QDS_hdsby, QDS_hdbnid, QDS_hselarea, QDS_hselind, QDS_hlngcode, QDS_hlngcodedb, QDS_hselindo, QDS_hselareao, );",
                                                //"onPageLoadOfQDS('" + hdsby + "','" + hdbnid + "','" + hselarea + "','" + hselind + "','" + hlngcode +
                                               // "','" + hlngcodedb + "','" + hselindo + "','" + hselareao + "');");

            File.WriteAllText(Server.MapPath("../../stock/shared/qds/") + RetVal + ".htm", TemplateHtml);
        }
        catch (Exception ex)
        {
            RetVal = ex.Message;
            Global.CreateExceptionString(ex, null);
        }

        return RetVal;
    }
Ejemplo n.º 2
0
    private string getQdsResultsFromAdaptationWebService(string AdaptationURL, string SearchIndicators, string SearchAreas, string SearchLanguage, bool isBlock)
    {
        string RetVal = string.Empty;
        try
        {
            CatalogQdsResults.QdsResults objResults = new CatalogQdsResults.QdsResults();
            objResults.Url = AdaptationURL + @"/libraries/ws/QdsResults.asmx";
            RetVal = objResults.getQdsResults(SearchIndicators, SearchAreas, SearchLanguage, isBlock);
        }
        catch (Exception ex) {
            Global.CreateExceptionString(ex, null);
        }

        return RetVal;
    }