/// <summary> /// Opens bboardDR /// </summary> public WSWrapper(String bbHostCode) { bboardDR = PtaUtil.GetBBoardDataReaderByCode(bbHostCode); contextWS = new ContextWS(); this.initializedFlag = false; }
/// <summary> /// Made as static for simplicity of registration XML preview (pta_proxy\Admin\Register.aspx). /// </summary> static public String GetRegistrationXML(String bbCode) { log4net.ILog log = PtaUtil.getLog4netLogger(typeof(RegisterToolWSCall).FullName + ".getRegistrationXML: "); String desc; //method is static because can be called for preview, i.e. WSCall.wsWrapper.GetBBoardDR() is unavailvable SqlDataReader bboardDR = PtaUtil.GetBBoardDataReaderByCode(bbCode); try { if ("Y".Equals(PtaUtil.GetDBReaderStringField(bboardDR, "IsRegistered"))) { //??probably some logic on preliminary handling of this can be placed here, //but capability to reregister even with this flag set is necessary //because it is possible proxy to be unregistered at Blackboard but not updated at proxy //(if proxy is not accessibel at the moment of unregistration), //i.e. IsRegistered (as well as ProxyState) can be out of sync with Blackboard } String proxy_http_url = WebConfigurationManager.AppSettings["PtaProxyHttpUrl"]; String proxy_https_url = WebConfigurationManager.AppSettings["PtaProxyHttpsURL"]; String proxy_s2s_url = WebConfigurationManager.AppSettings["PtaProxyServerToServerURL"]; String base_urls = ""; if ("Y".Equals(PtaUtil.GetDBReaderStringField(bboardDR, "RegisterHttpsURL"))) { base_urls += "<base-url type=\"https\">" + proxy_https_url + "</base-url>\n"; } if ("Y".Equals(PtaUtil.GetDBReaderStringField(bboardDR, "RegisterHttpURL"))) { base_urls += "<base-url type=\"http\">" + proxy_http_url + "</base-url>\n"; } if ("Y".Equals(PtaUtil.GetDBReaderStringField(bboardDR, "RegisterS2SURL"))) { base_urls += "<base-url type=\"server-to-server\">" + proxy_s2s_url + "</base-url>\n"; } desc = Regex.Replace(REG_XML, "{BASE_URLS}", base_urls); if ("Y".Equals(PtaUtil.GetDBReaderStringField(bboardDR, "RegisterActions"))) { desc = Regex.Replace(desc, "{HTTP_ACTIONS}", HTTP_ACTIONS_XML); } String proxy_code = PtaUtil.GetDBReaderStringField(bboardDR, "BBoardProxyCode"); desc = Regex.Replace(desc, "{PROXY_CODE}", proxy_code); //String desc = Regex.Replace(REG_XML, "{BASE_HTTP_URL}", proxy_http_url); //desc = Regex.Replace(desc, "{BASE_HTTPS_URL}", proxy_https_url); desc = Regex.Replace(desc, "{PROXY_WEB_FOLDER}", PtaUtil.GetProxyWebFolder()); String sql = "SELECT BBLinkPath, BBLinkType, BBLinkName, BBLinkIconPath FROM BBMenuLink WHERE BBoardCode = @BBoardCode AND Enabled = 'Y'"; log.Info("sql: " + sql); SqlConnection con = PtaUtil.GetSqlConnection(); System.Data.SqlClient.SqlParameter param = new System.Data.SqlClient.SqlParameter("BBoardCode", PtaUtil.GetDBReaderStringField(bboardDR, "BBoardCode")); SqlDataReader drMenuLink = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(con, System.Data.CommandType.Text, sql, param); String xml_links = ""; while (drMenuLink.Read()) { String xml_part = MENU_LINK_XML; String link_path = PtaUtil.GetProxyWebFolder() + PtaUtil.PTA_SUBFOLDER + PtaUtil.GetDBReaderStringField(drMenuLink, "BBLinkPath"); String link_type = PtaUtil.GetDBReaderStringField(drMenuLink, "BBLinkType"); String link_name = PtaUtil.GetDBReaderStringField(drMenuLink, "BBLinkName"); String icon_path = PtaUtil.GetDBReaderStringField(drMenuLink, "BBLinkIconPath"); xml_part = Regex.Replace(xml_part, "{LINK_PATH}", link_path); xml_part = Regex.Replace(xml_part, "{MENU_LINK_TYPE}", link_type); xml_part = Regex.Replace(xml_part, "{LINK_NAME}", "<name locale:key=\"" + link_name + "\"></name>"); if (icon_path != null) { xml_part = Regex.Replace(xml_part, "{LINK_ICON}", "<icon platform=\"blackboard\" style=\"listitem\" >" + icon_path + "</icon>"); } else { xml_part = Regex.Replace(xml_part, "{LINK_ICON}", ""); } xml_links = xml_links + xml_part; } desc = Regex.Replace(desc, "{MENU_LINKS}", xml_links); } finally { PtaUtil.CloseDataReader(bboardDR); } return(desc); }