public string AdminGetAdaptationVersions() { string RetVal = string.Empty; try { DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; RetVal = CatalogService.GetAdaptationVersions(); } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
public XmlNode GetDBMetaData() { XmlNode RetVal; //DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); //XmlNode xmlNode = CatalogService.GetDBMetaData(gUID); //XmlDocument XMLDoc = new XmlDocument(); //XmlNode declaration = XMLDoc.CreateNode(XmlNodeType.XmlDeclaration, null, null); //XMLDoc.AppendChild(declaration); //XmlElement DBDetail = XMLDoc.CreateElement("DBDetail"); //DBDetail.AppendChild(xmlNode); //XMLDoc.AppendChild(DBDetail); //RetVal = XMLDoc; DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; RetVal = CatalogService.GetDBMetaData(Global.GetAdaptationGUID()); return RetVal; }
public string AdminDeleteCatalog(string requestParam) { string RetVal = string.Empty; int AdaptationNId = -1; try { AdaptationNId = Convert.ToInt32(requestParam); DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; if(CatalogService.DeleteCatalog(AdaptationNId)) { RetVal = "true"; } } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
/// <summary> /// Update configuration setting in appsettings.xml file /// </summary> /// <param name="requestParam"></param> /// <returns></returns> public string AdminUpdateConfiguration(string requestParam) { string RetVal = string.Empty; ; string[] Params; string AdapatationName = string.Empty; string DefaultLng = string.Empty; string ShowDbSelection = string.Empty; string Version = string.Empty; string DiUiLibUrl = string.Empty; string DiUiLibThemCss = string.Empty; string FBAppID = string.Empty; string FBAppSecret = string.Empty; string TwAppID = string.Empty; string TwAppSecret = string.Empty; string ShowSliders = string.Empty; string MrdThreshold = string.Empty; string HideSourceColumn = string.Empty; string DSDSelection = string.Empty; string QDSCache = string.Empty; string ShowDIB = string.Empty; string StandaloneRegistry = string.Empty; string ApplicationVersion = string.Empty; string AdaptedFor = string.Empty; string AreaNId = string.Empty; string SubNation = string.Empty; string SlideCount = string.Empty; string QDSGallery = string.Empty; string RegistryAreaLevel = string.Empty; string RegistryMSDAreaId = string.Empty; string RegistryNotifyViaEmail = string.Empty; string RegistryMappingAgeDefaultValue = string.Empty; string RegistryMappingSexDefaultValue = string.Empty; string RegistryMappingLocationDefaultValue = string.Empty; string RegistryMappingFrequencyDefaultValue = string.Empty; string RegistryMappingSourceDefaultValue = string.Empty; string RegistryMappingNatureDefaultValue = string.Empty; string RegistryMappingUnitMultDefaultValue = string.Empty; string AdaptationYear = string.Empty; string UnicefRegion = string.Empty; string IsDesktopVersionAvailable = string.Empty; string DbAdmName = string.Empty; string DbAdmInstitution = string.Empty; string DbAdmEmail = string.Empty; string NewsMenuEnabled = string.Empty; string InnovationsMenuEnabled = string.Empty; string QDSCloud = string.Empty; string SupportEnabled = string.Empty; string ContactUsEnabled = string.Empty; string AppSettingFile = string.Empty; string JSVersion = string.Empty; string DownloadsLinkEnabled = string.Empty; string TrainingLinkEnabled = string.Empty; string MapLibraryLinkEnabled = string.Empty; string RSSFeedsLinkEnabled = string.Empty; string DiWorldWideLinkEnabled = string.Empty; string GoogleAnalyticsId = string.Empty; string Country = string.Empty; string typeOfEmail = string.Empty; string DateCreated = string.Empty; string CategoryScheme = string.Empty; string SliderAnimationSpeed = string.Empty; string FAQ = string.Empty; string SiteMap = string.Empty; string HowToVideos = string.Empty; XmlDocument XmlDoc; bool IsCMSDatabaseCreated = false; string XLSFileMsg = string.Empty; string HowToVideo = string.Empty; string[] HowToVideoArr = null; string[] HowToVideoIndivisualArr = null; string HowToVideoJSONString = string.Empty; string OutCmsDatabaseName = string.Empty;// This variable is used for storing Name of database created for CMS string MetaTag_Desc = string.Empty; string MetaTag_Kw = string.Empty; string KB = string.Empty; try { Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter); AdapatationName = Params[0]; DefaultLng = Params[1]; Version = Params[2]; DiUiLibUrl = Params[3]; DiUiLibThemCss = Params[4]; FBAppID = Params[5]; FBAppSecret = Params[6]; TwAppID = Params[7]; TwAppSecret = Params[8]; ShowSliders = Params[9]; MrdThreshold = Params[10]; HideSourceColumn = Params[11]; DSDSelection = Params[12]; QDSCache = Params[13]; ShowDIB = Params[14]; StandaloneRegistry = Params[15]; JSVersion = Params[16]; AdaptedFor = Params[17]; AreaNId = Params[18]; SubNation = Params[19]; SlideCount = Params[20]; AdaptationYear = Params[21]; UnicefRegion = Params[22]; IsDesktopVersionAvailable = Params[23]; DbAdmName = Params[24]; DbAdmInstitution = Params[25]; DbAdmEmail = Params[26]; QDSGallery = Params[27]; RegistryAreaLevel = Params[28]; RegistryMSDAreaId = Params[29]; RegistryNotifyViaEmail = Params[30]; RegistryMappingAgeDefaultValue = Params[31]; RegistryMappingSexDefaultValue = Params[32]; RegistryMappingLocationDefaultValue = Params[33]; RegistryMappingFrequencyDefaultValue = Params[34]; RegistryMappingSourceDefaultValue = Params[35]; RegistryMappingNatureDefaultValue = Params[36]; RegistryMappingUnitMultDefaultValue = Params[37]; NewsMenuEnabled = Params[38]; InnovationsMenuEnabled = Params[39]; QDSCloud = Params[40]; ContactUsEnabled = Params[41]; SupportEnabled = Params[42]; ApplicationVersion = Params[43]; DownloadsLinkEnabled = Params[44]; TrainingLinkEnabled = Params[45]; MapLibraryLinkEnabled = Params[46]; RSSFeedsLinkEnabled = Params[47]; DiWorldWideLinkEnabled = Params[48]; GoogleAnalyticsId = Params[49]; Country = Params[50]; CategoryScheme = Params[51]; SliderAnimationSpeed = Params[52]; FAQ = Params[53]; SiteMap = Params[54]; MetaTag_Desc = Params[55]; MetaTag_Kw = Params[56]; KB = Params[57]; HowToVideos = Params[58]; try { HowToVideo = Params[59]; HowToVideoArr = HowToVideo.Split(new string[] { "[**]" }, StringSplitOptions.RemoveEmptyEntries); } catch (Exception ex) { Global.CreateExceptionString(ex, null); } // If user enables news menu then call method to geneate database for news if CMS databese is not already existing if (NewsMenuEnabled == "true") { IsCMSDatabaseCreated = CheckNCreateCMSDatabase(out OutCmsDatabaseName); // IF CMS database created successfull call method to add entry in csv log file if (IsCMSDatabaseCreated) { // If name op creted CMS database is not null or empty if (!string.IsNullOrEmpty(OutCmsDatabaseName)) { // Create Message to write in CSV file XLSFileMsg = string.Format(Constants.CSVLogMessage.CmsDatabaseCreated, AdapatationName, OutCmsDatabaseName); // Call method to write CSV log For CMS databse creation WriteLogInXLSFile(Constants.AdminModules.AppSettings.ToString(), XLSFileMsg); } } } AppSettingFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, ConfigurationManager.AppSettings[Constants.WebConfigKey.AppSettingFile]); XmlDoc = new XmlDocument(); XmlDoc.Load(AppSettingFile); Global.CheckAppSetting(XmlDoc, Constants.AppSettingKeys.Country, string.Empty); Global.CheckAppSetting(XmlDoc, Constants.AppSettingKeys.CategoryScheme, "SC"); // check if key islangFAQVisible exist in appsetting.xml file, else create key Global.CheckAppSetting(XmlDoc, Constants.AppSettingKeys.islangFAQVisible, string.Empty); XmlDoc.Load(AppSettingFile); //Application this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.adaptation_name, AdapatationName); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.adapted_for, AdaptedFor); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.area_nid, AreaNId); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.sub_nation, SubNation); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.default_lng, DefaultLng); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.diuilib_theme_css, DiUiLibThemCss); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.show_sliders, ShowSliders); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.slider_count, SlideCount); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.dvMrdThreshold, MrdThreshold); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.dvHideSource, HideSourceColumn); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isQdsGeneratedForDensedQS_Areas, QDSCache); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.showdisputed, ShowDIB); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.adaptation_mode, StandaloneRegistry); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.js_version, JSVersion); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.adaptation_year, AdaptationYear); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.unicef_region, UnicefRegion); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isDesktopVersionAvailable, IsDesktopVersionAvailable); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.enableQDSGallery, QDSGallery); //Database Administrator this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.ContactDbAdmName, DbAdmName); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.ContactDbAdmInstitution, DbAdmInstitution); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.ContactDbAdmEmail, DbAdmEmail); //Web Components this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.diuilib_version, Version); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.diuilib_url, DiUiLibUrl); //Share this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.fbAppID, FBAppID); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.fbAppSecret, FBAppSecret); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.twAppID, TwAppID); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.twAppSecret, TwAppSecret); //Registry this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.enableDSDSelection, DSDSelection); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryAreaLevel, RegistryAreaLevel); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryMSDAreaId, RegistryMSDAreaId); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryNotifyViaEmail, RegistryNotifyViaEmail); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryMappingAgeDefaultValue, RegistryMappingAgeDefaultValue); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryMappingSexDefaultValue, RegistryMappingSexDefaultValue); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryMappingLocationDefaultValue, RegistryMappingLocationDefaultValue); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryMappingFrequencyDefaultValue, RegistryMappingFrequencyDefaultValue); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryMappingSourceTypeDefaultValue, RegistryMappingSourceDefaultValue); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryMappingNatureDefaultValue, RegistryMappingNatureDefaultValue); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.registryMappingUnitMultDefaultValue, RegistryMappingUnitMultDefaultValue); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isNewsMenuVisible, NewsMenuEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isInnovationsMenuVisible, InnovationsMenuEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.show_cloud, QDSCloud); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isContactUsMenuVisible, ContactUsEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isSupportMenuVisible, SupportEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.app_version, ApplicationVersion); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isDownloadsLinkVisible, DownloadsLinkEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isTrainingLinkVisible, TrainingLinkEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isMapLibraryLinkVisible, MapLibraryLinkEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isRSSFeedsLinkVisible, RSSFeedsLinkEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isDiWorldWideLinkVisible, DiWorldWideLinkEnabled); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.gaUniqueID, GoogleAnalyticsId); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.Country, Country); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.CategoryScheme, CategoryScheme); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.SliderAnimationSpeed, SliderAnimationSpeed); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.islangFAQVisible, FAQ); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isSitemapVisible, SiteMap); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.isHowToVideoVisible, HowToVideos); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.MetaTag_Desc, MetaTag_Desc); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.MetaTag_Kw, MetaTag_Kw); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.islangKBVisible, KB); //Save How to Video if (HowToVideoArr != null) { dynamic dynObj = JsonConvert.DeserializeObject(Global.GetNodeValue(XmlDoc, Constants.AppSettingKeys.HowToVideoData).ToString()); for (int i = 0; i < HowToVideoArr.Length; i++) { foreach (var data in dynObj) { if ((data).Name == HowToVideoArr[i].ToString().Substring(0, 2)) { HowToVideoIndivisualArr = HowToVideoArr[i].ToString().Split(new string[] { "[*]" }, StringSplitOptions.None); foreach (JArray item in data) { foreach (JToken dataItem in item.Children()) { dataItem["HomeVisible"] = HowToVideoIndivisualArr[1]; dataItem["VisualizerVisible"] = HowToVideoIndivisualArr[2]; dataItem["Homelink"] = HowToVideoIndivisualArr[3]; dataItem["Visualizerlink"] = HowToVideoIndivisualArr[4]; } } } } } HowToVideoJSONString = JsonConvert.SerializeObject(dynObj); HowToVideoJSONString = HowToVideoJSONString.Replace("\"", "'"); this.SaveAppSettingValue(XmlDoc, Constants.AppSettingKeys.HowToVideoData, HowToVideoJSONString); } File.SetAttributes(AppSettingFile, FileAttributes.Normal); XmlDoc.Save(AppSettingFile); DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; CatalogService.UpdateCatalogInfo(AdapatationName, "", Global.GetAdaptationUrl(), DateTime.Now.ToString(), Convert.ToInt32(AreaNId), SubNation, DbAdmName, DbAdmInstitution, DbAdmEmail, UnicefRegion, AdaptationYear, AdaptedFor, Country, Global.GetAdaptationGUID()); DataSet dsCatalogAdaptation = new DataSet(); dsCatalogAdaptation = CatalogService.CatalogExists(Global.GetAdaptationGUID()); string Visible = string.Empty; if (dsCatalogAdaptation.Tables[0].Rows.Count == 0) { typeOfEmail = "New"; DateCreated = String.Format("{0:r}", DateTime.Now); } else { typeOfEmail = "Updated"; if (!string.IsNullOrEmpty(dsCatalogAdaptation.Tables[0].Rows[0][1].ToString())) { DateCreated = String.Format("{0:r}", Convert.ToDateTime(dsCatalogAdaptation.Tables[0].Rows[0][1])); } Visible = dsCatalogAdaptation.Tables[0].Rows[0][2].ToString(); } Frame_Message_And_Send_Catalog_Mail(AdapatationName, Global.GetAdaptationUrl(), Visible, DbAdmName, DbAdmInstitution, DbAdmEmail, AdaptedFor, Country, SubNation, DateCreated, String.Format("{0:r}", DateTime.Now), typeOfEmail); RetVal = "true"; } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
//Check If enrty does not exist in Global Catalog for this adaptation, then insert an entry and make Master Account as Admin public string EntryIntoGlobalCatalog(string requestParam) { string RetVal = string.Empty; string CatalogImageURL = requestParam; DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; DataSet dsCatalogAdaptation = new DataSet(); //dsCatalogAdaptation = CatalogService.CatalogExists(Global.GetAdaptationUrl()); dsCatalogAdaptation = CatalogService.CatalogExists(Global.GetAdaptationGUID()); if (dsCatalogAdaptation.Tables[0].Rows.Count == 0) { string AdaptationName; string DbAdmName; string DbAdmInstitution; string DbAdmEmail; string Subnational; string AdaptedFor; string AreaNId; string Version; XmlDocument XmlDoc; string AppSettingFile = string.Empty; AdaptationName = Global.adaptation_name; DbAdmName = Global.DbAdmName; DbAdmInstitution = Global.DbAdmInstitution; DbAdmEmail = Global.DbAdmEmail; AdaptedFor = Global.adapted_for; Subnational = Global.sub_nation; AreaNId = Global.area_nid; Version = Global.application_version; AppSettingFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, ConfigurationManager.AppSettings[Constants.WebConfigKey.AppSettingFile]); XmlDoc = new XmlDocument(); XmlDoc.Load(AppSettingFile); Global.CheckAppSetting(XmlDoc, Constants.AppSettingKeys.Country, string.Empty); string Country = Global.Country; GlobalUserWebService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService; //DataSet GlobalUserDetail = GlobalUserWebService.GetMasterAccountDetail(Global.GetAdaptationUrl()); DataSet GlobalUserDetail = GlobalUserWebService.GetMasterAccountDetail(Global.GetAdaptationGUID()); string UserNId = GlobalUserDetail.Tables[0].Rows[0][0].ToString(); string FirstName = GlobalUserDetail.Tables[0].Rows[0][2].ToString(); Create_MaintenanceAgency_ForAdmin(UserNId, FirstName, Global.GetDefaultLanguageCode()); //GlobalUserWebService.IsAdminRegistered(Global.GetAdaptationUrl(), AdaptationName, DbAdmName, DbAdmInstitution, DbAdmEmail, AdaptedFor, Country, Subnational, AreaNId, CatalogImageURL, "5"); GlobalUserWebService.IsAdminRegistered(Global.GetAdaptationUrl(), AdaptationName, DbAdmName, DbAdmInstitution, DbAdmEmail, AdaptedFor, Country, Subnational, AreaNId, CatalogImageURL, "5", Global.GetAdaptationGUID()); Frame_Message_And_Send_Catalog_Mail(AdaptationName, Global.GetAdaptationUrl(), "False", DbAdmName, DbAdmInstitution, DbAdmEmail, AdaptedFor, Country, Subnational, String.Format("{0:r}", DateTime.Now), String.Format("{0:r}", DateTime.Now), "New"); } return RetVal; }
private void SetMasterSiteUrl() { string GlobalMasterWebUrl = string.Empty; try { DIWorldwide.Catalog catalog = new DIWorldwide.Catalog(); catalog.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; GlobalMasterWebUrl = catalog.GetGlobalMasterWebUrl(); mastersiteurl.HRef = GlobalMasterWebUrl; //aGoto.HRef = GlobalMasterWebUrl; //aGlobalNews.HRef = GlobalMasterWebUrl + "/articles/news"; //aGlobalInnovations.HRef = GlobalMasterWebUrl + "/articles/Innovations"; //aGlobalCatalog.HRef = GlobalMasterWebUrl + "/libraries/aspx/Catalog.aspx"; } catch (Exception ex) { Global.CreateExceptionString(ex, null); } }
private string[] GetDisclaimerText() { string[] RetVal = null; string DisclaimerText = string.Empty; try { DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; DisclaimerText = CatalogService.GetDisclaimerText(); if (!string.IsNullOrEmpty(DisclaimerText)) { RetVal = Global.SplitString(DisclaimerText, "|"); } } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
/// <summary> /// This perticular method is used for adding created CSV files names entry in database /// </summary> /// <param name="CsvFileNames">name of all csv files present in CSV_DataFiles folers seperated from ','</param> private void AddCsv_EntryTo_WebService(string CsvFileNames) { //string AdaptationURL = Global.GetAdaptationUrl(); DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; CatalogService.Update_LangCode_CSVFiles_Catalog(Global.GetAdaptationGUID(), CsvFileNames); }
public static Boolean CheckIsDI7ORGAdaptation() { Boolean RetVal = false; //string AdaptationUrl = string.Empty; try { DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; if (CatalogService.CheckIsDI7ORGAdaptation(Global.GetAdaptationGUID())) { RetVal = true; } } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
private bool InsertIntoCatalog() { string WebURL = Global.GetAdaptationUrl(); string AdaptationName = Global.adaptation_name; string AdaptedFor = Global.adapted_for; string SubNation = Global.sub_nation; string DbAdmName = Global.DbAdmName; string DbAdmInstitution = Global.DbAdmInstitution; string DbAdmEmail = Global.DbAdmEmail; string UnicefRegion = Global.UnicefRegion; string AdaptationYear = Global.AdaptationYear; //Check for newly added App Setting Key -Country XmlDocument XmlDoc; string AppSettingFile = string.Empty; AppSettingFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, ConfigurationManager.AppSettings[Constants.WebConfigKey.AppSettingFile]); XmlDoc = new XmlDocument(); XmlDoc.Load(AppSettingFile); Global.CheckAppSetting(XmlDoc, Constants.AppSettingKeys.Country, string.Empty); string Country = Global.Country; bool RetVal = false; string typeOfEmail = string.Empty; string DateCreated = string.Empty; string Visible = string.Empty; try { DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; DataSet dsCatalogAdaptation = new DataSet(); dsCatalogAdaptation = CatalogService.CatalogExists(Global.GetAdaptationGUID()); if (dsCatalogAdaptation.Tables[0].Rows.Count == 0) { typeOfEmail = "New"; DateCreated = String.Format("{0:r}", DateTime.Now); } else { typeOfEmail = "Updated"; DateCreated = String.Format("{0:r}", Convert.ToDateTime(dsCatalogAdaptation.Tables[0].Rows[0][1])); Visible = dsCatalogAdaptation.Tables[0].Rows[0][2].ToString(); } if (CatalogService.SetCatalog(AdaptationName, "", "", false, true, WebURL, 0, 0, 0, 0, "", "", DateTime.Now.ToString(), 0, SubNation, "", DbAdmName, DbAdmInstitution, DbAdmEmail, UnicefRegion, AdaptationYear, "", "", AdaptedFor, Country, DateTime.Now.ToString(), Global.GetAdaptationGUID())) { RetVal = true; Frame_Message_And_Send_Catalog_Mail(AdaptationName, WebURL, Visible, DbAdmName, DbAdmInstitution, DbAdmEmail, AdaptedFor, Country, SubNation, DateCreated, String.Format("{0:r}", DateTime.Now), typeOfEmail); } } catch (Exception ex) { RetVal = false; Global.CreateExceptionString(ex, null); } return RetVal; }
public string AdminSaveAdaptation(string requestParam) { string RetVal = string.Empty; string[] Params; string AdaptationName = string.Empty; string Description = string.Empty; string Version = string.Empty; bool IsDesktop; bool IsWeb; string WebURL = string.Empty; int AreaCount; int IUSCount; int TimePeriodsCount; int DataValuesCount; string StartYear = string.Empty; string EndYear = string.Empty; string LastModifiedOn = string.Empty; int AreaNId; string SubNation = string.Empty; string CatalogImage = string.Empty; string DbAdmName = string.Empty; string DbAdmInstitution = string.Empty; string DbAdmEmail = string.Empty; string UnicefRegion = string.Empty; string AdaptationYear = string.Empty; string DbLanguages = string.Empty; string LangCode_CSVFiles = string.Empty; try { Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter); AdaptationName = Params[0]; Description = Params[1]; Version = Params[2]; IsDesktop = Convert.ToBoolean(Params[3]); IsWeb = Convert.ToBoolean(Params[4]); WebURL = Params[5]; AreaCount = Convert.ToInt32(Params[6]); IUSCount = Convert.ToInt32(Params[7]); TimePeriodsCount = Convert.ToInt32(Params[8]); DataValuesCount = Convert.ToInt32(Params[9]); StartYear = Params[10]; EndYear = Params[11]; LastModifiedOn = Params[12]; AreaNId = Convert.ToInt32(Params[13]); SubNation = Params[14]; CatalogImage = Params[15]; DbAdmName = Params[16]; DbAdmInstitution = Params[17]; DbAdmEmail = Params[18]; UnicefRegion = Params[19]; AdaptationYear = Params[20]; DbLanguages = Params[21]; if(Params.Length > 22) LangCode_CSVFiles = Params[22]; string AdaptedFor = Global.adapted_for; XmlDocument XmlDoc; string AppSettingFile = string.Empty; AppSettingFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, ConfigurationManager.AppSettings[Constants.WebConfigKey.AppSettingFile]); XmlDoc = new XmlDocument(); XmlDoc.Load(AppSettingFile); Global.CheckAppSetting(XmlDoc, Constants.AppSettingKeys.Country, string.Empty); string Country = Global.Country; string typeOfEmail = string.Empty; DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; DataSet dsCatalogAdaptation = new DataSet(); dsCatalogAdaptation = CatalogService.CatalogExists(Global.GetAdaptationGUID()); string DateCreated = string.Empty; string Visible = string.Empty; if (dsCatalogAdaptation.Tables[0].Rows.Count == 0) { typeOfEmail = "New"; DateCreated = String.Format("{0:r}", DateTime.Now); } else { typeOfEmail = "Updated"; DateCreated = String.Format("{0:r}", Convert.ToDateTime(dsCatalogAdaptation.Tables[0].Rows[0][1])); Visible = dsCatalogAdaptation.Tables[0].Rows[0][2].ToString(); } if (CatalogService.SetCatalog(AdaptationName, Description, Version, IsDesktop, IsWeb, WebURL, AreaCount, IUSCount, TimePeriodsCount, DataValuesCount, StartYear, EndYear, LastModifiedOn, AreaNId, SubNation, CatalogImage, DbAdmName, DbAdmInstitution, DbAdmEmail, UnicefRegion, AdaptationYear, DbLanguages, LangCode_CSVFiles, AdaptedFor, Country, DateTime.Now.ToString(), Global.GetAdaptationGUID())) { RetVal = "true"; Frame_Message_And_Send_Catalog_Mail(AdaptationName, WebURL, Visible, DbAdmName, DbAdmInstitution, DbAdmEmail, AdaptedFor, Country, SubNation, DateCreated, String.Format("{0:r}", DateTime.Now), typeOfEmail); } } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
public string GetJsonAdaptationFile() { string RetVal = string.Empty; //string WebURL = string.Empty; try { //WebURL = Global.GetAdaptationUrl(); DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; RetVal = CatalogService.GetJsonAdaptations(Global.GetAdaptationGUID()); } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
public string GetGlobalAdaptationURL() { string GlobalMasterWebUrl = string.Empty; string RetVal = string.Empty; try { DIWorldwide.Catalog catalog = new DIWorldwide.Catalog(); catalog.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; GlobalMasterWebUrl = catalog.GetGlobalMasterWebUrl(); RetVal = GlobalMasterWebUrl + "/libraries/aspx/"; } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
public string GetCatalogCacheResults(string requestParam) { string RetVal = string.Empty; string[] Params; string SearchAreas = string.Empty; string SearchIndicators = string.Empty; string LangCodeDb = string.Empty; try { Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter); SearchAreas = Params[0]; SearchIndicators = Params[1]; LangCodeDb = Params[2]; DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; //RetVal = CatalogService.GetCatalogCacheResults(SearchAreas, SearchIndicators); RetVal = CatalogService.GetCatalogMatchedResults(SearchAreas, SearchIndicators, LangCodeDb); } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
public string CheckIsDI7ORGAdaptation() { string RetVal = string.Empty; try { if (Global.CheckIsDI7ORGAdaptation()) { RetVal = "false"; } else { DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; RetVal = CatalogService.GetGlobalMasterWebUrl() + "/libraries/aspx/Catalog.aspx"; } } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
private bool GetAndUpdateIndexedIndicators(string[] dbAvailableLanguage, DIConnection objDIConnection) { bool RetVal = false; List<System.Data.Common.DbParameter> DbParams = new List<System.Data.Common.DbParameter>(); DataSet DSIndicators = new DataSet(); string TableName = string.Empty; //string AdaptationURL = string.Empty; try { //Get all area tables from db foreach (string LanguageCode in dbAvailableLanguage) { TableName = "ut_indicator_" + LanguageCode; DbParams.Clear(); System.Data.Common.DbParameter Param1 = objDIConnection.CreateDBParameter(); Param1.ParameterName = "TAB_NAME"; Param1.DbType = DbType.String; Param1.Value = TableName; DbParams.Add(Param1); DataTable DtIndicator = objDIConnection.ExecuteDataTable("SP_GET_TABLE_DATA", CommandType.StoredProcedure, DbParams); DtIndicator.TableName = TableName; DtIndicator.Columns.Remove("Indicator_Info"); DSIndicators.Tables.Add(DtIndicator); } if (DSIndicators.Tables.Count > 0) { //AdaptationURL = Global.GetAdaptationUrl(); //call webservice method UpdateIndexedIndicators DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; RetVal = CatalogService.UpdateIndexedIndicators(DSIndicators, Global.GetAdaptationGUID()); RetVal = true; } } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }
public string GetM49Countries() { string AreaData = string.Empty; try { DIWorldwide.Catalog catalog = new DIWorldwide.Catalog(); catalog.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; /*string Url = Request.Url.AbsoluteUri; int index = Url.IndexOf("libraries"); string BaseUrl = Url.Substring(0, index - 1); string AdaptationData = catalog.GetJsonAdaptations(this.Page.Server.UrlDecode(BaseUrl.ToLower()));*/ AreaData = catalog.GetM49Countries(); } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return AreaData; }
public string IsAdminRegistered() { string RetVal = "False"; string BaseUrl; string AdaptationName; string DbAdmName; string DbAdmInstitution; string DbAdmEmail; string AdaptedFor; string Subnational; DataTable DtTable; string EmailId = string.Empty; string UserNId = string.Empty; string FirstName = string.Empty; string Language = string.Empty; string typeOfEmail = string.Empty; DIConnection DIConnection = null; XmlDocument XmlDoc; string AppSettingFile = string.Empty; AppSettingFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, ConfigurationManager.AppSettings[Constants.WebConfigKey.AppSettingFile]); XmlDoc = new XmlDocument(); XmlDoc.Load(AppSettingFile); Global.CheckAppSetting(XmlDoc, Constants.AppSettingKeys.Country, string.Empty); string Country = Global.Country; if (ConfigurationManager.AppSettings[Constants.WebConfigKey.IsGlobalAllow].ToLower() == "true") { BaseUrl = Global.GetAdaptationUrl(); AdaptationName = Global.adaptation_name; DbAdmName = Global.DbAdmName; DbAdmInstitution = Global.DbAdmInstitution; DbAdmEmail = Global.DbAdmEmail; AdaptedFor = Global.adapted_for; Subnational = Global.sub_nation; DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; GlobalUserWebService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.UserLoginService; DataSet dsCatalogAdaptation = new DataSet(); dsCatalogAdaptation = CatalogService.CatalogExists(Global.GetAdaptationGUID()); string DateCreated = string.Empty; string AreaNId = Global.area_nid; string Visible = string.Empty; if (dsCatalogAdaptation.Tables[0].Rows.Count == 0) { typeOfEmail = "New"; DateCreated = String.Format("{0:r}", DateTime.Now); } else { typeOfEmail = "Updated"; DateCreated = String.Format("{0:r}", Convert.ToDateTime(dsCatalogAdaptation.Tables[0].Rows[0][1])); Visible = dsCatalogAdaptation.Tables[0].Rows[0][2].ToString(); } RetVal = GlobalUserWebService.IsAdminRegistered(BaseUrl, AdaptationName, DbAdmName, DbAdmInstitution, DbAdmEmail, AdaptedFor, Country, Subnational, AreaNId, "", "", Global.GetAdaptationGUID()); if (typeOfEmail == "New") { Frame_Message_And_Send_Catalog_Mail(AdaptationName, BaseUrl, Visible, DbAdmName, DbAdmInstitution, DbAdmEmail, AdaptedFor, Country, Subnational, DateCreated, String.Format("{0:r}", DateTime.Now), typeOfEmail); } if (RetVal == "TrueMA") { DataSet GlobalUserDetail = GlobalUserWebService.GetMasterAccountDetail(Global.GetAdaptationGUID()); UserNId = GlobalUserDetail.Tables[0].Rows[0][0].ToString(); EmailId = GlobalUserDetail.Tables[0].Rows[0][1].ToString(); FirstName = GlobalUserDetail.Tables[0].Rows[0][2].ToString(); Language = "en"; if (typeOfEmail == "New") { Frame_Message_And_Send_Mail(FirstName, EmailId, UserNId.ToString(), true, true, Language); } RetVal = "True"; } } else { DIConnection = new DIConnection(DIServerType.MsAccess, string.Empty, string.Empty, Server.MapPath("~//stock//Database.mdb"), string.Empty, string.Empty); string Query = "SELECT * FROM Users WHERE USER_IS_ADMIN='True'"; DtTable = DIConnection.ExecuteDataTable(Query); if (DtTable != null && DtTable.Rows.Count > 0) { RetVal = "True"; } } return RetVal; }
public static Boolean CheckIsGlobalAdaptation() { Boolean RetVal = false; //string AdaptationUrl = string.Empty; try { DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; //AdaptationUrl = Global.GetAdaptationUrl(); if (CatalogService.CheckIsGlobalAdaptation(Global.GetAdaptationGUID())) { RetVal = true; } } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; //Boolean RetVal = false; //string AppSettingFile = string.Empty; //XmlDocument XmlDoc; //try //{ // AppSettingFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, ConfigurationManager.AppSettings[Constants.WebConfigKey.AppSettingFile]); // XmlDoc = new XmlDocument(); // XmlDoc.Load(AppSettingFile); // if (GetNodeValue(XmlDoc, Constants.AppSettingKeys.area_nid) == "-1") // { // RetVal = true; // } //} //catch (Exception ex) //{ //} //return RetVal; }
public string AdminUpdateAdaptation(string requestParam) { string RetVal = string.Empty; string[] Params; string AdaptationName = string.Empty; string Description = string.Empty; string Version = string.Empty; bool IsDesktop; bool IsWeb; string WebURL = string.Empty; int AreaCount; int IUSCount; int TimePeriodsCount; int DataValuesCount; string StartYear = string.Empty; string EndYear = string.Empty; string LastModifiedOn = string.Empty; int AreaNId; string SubNation = string.Empty; string CatalogImage = string.Empty; int AdaptationNId = -1; string DbAdmName = string.Empty; string DbAdmInstitution = string.Empty; string DbAdmEmail = string.Empty; string UnicefRegion = string.Empty; string AdaptationYear = string.Empty; string DbLanguages = string.Empty; try { Params = Global.SplitString(requestParam, Constants.Delimiters.ParamDelimiter); AdaptationName = Params[0]; Description = Params[1]; Version = Params[2]; IsDesktop = Convert.ToBoolean(Params[3]); IsWeb = Convert.ToBoolean(Params[4]); WebURL = Params[5]; AreaCount = Convert.ToInt32(Params[6]); IUSCount = Convert.ToInt32(Params[7]); TimePeriodsCount = Convert.ToInt32(Params[8]); DataValuesCount = Convert.ToInt32(Params[9]); StartYear = Params[10]; EndYear = Params[11]; LastModifiedOn = Params[12]; AreaNId = Convert.ToInt32(Params[13]); SubNation = Params[14]; CatalogImage = Params[15]; AdaptationNId = Convert.ToInt32(Params[16]); DbAdmName = Params[17]; DbAdmInstitution = Params[18]; DbAdmEmail = Params[19]; UnicefRegion = Params[20]; AdaptationYear = Params[21]; DbLanguages = Params[22]; DIWorldwide.Catalog CatalogService = new DIWorldwide.Catalog(); CatalogService.Url = ConfigurationManager.AppSettings[Constants.WebConfigKey.DiWorldWide4] + Constants.WSQueryStrings.CatalogWebService; if (CatalogService.UpdateCatalog(AdaptationNId, AdaptationName, Description, Version, IsDesktop, IsWeb, WebURL, AreaCount, IUSCount, TimePeriodsCount, DataValuesCount, StartYear, EndYear, LastModifiedOn, AreaNId, SubNation, CatalogImage, DbAdmName, DbAdmInstitution, DbAdmEmail, UnicefRegion, AdaptationYear, DbLanguages)) { RetVal = "true"; } } catch (Exception ex) { Global.CreateExceptionString(ex, null); } return RetVal; }