public void GetOnlineComponent(BuilderComponent component) { SageFrameConfig sageConfig = new SageFrameConfig(); OnlineStoreURL = sageConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.OnlineStore); string apiUrl = OnlineStoreURL + "/GetOnlineComponentPackage"; ComponentPackage tempThemeDetail = new ComponentPackage(); using (WebClient wc = new WebClient()) { wc.Headers[HttpRequestHeader.ContentType] = "application/json"; wc.QueryString.Add("componentID", component.UniversalComponentID.ToString()); wc.Encoding = Encoding.UTF8; var resultData = wc.DownloadString(apiUrl); dynamic dyn = JsonConvert.DeserializeObject(resultData); if (dyn != null) { tempThemeDetail = JsonConvert.DeserializeObject <ComponentPackage>(dyn.d.Value); } string themePackageFilePath = HttpContext.Current.Server.MapPath(@"\downloadmyComponent"); if (!Directory.Exists(themePackageFilePath)) { Directory.CreateDirectory(themePackageFilePath); } successComponentName = tempThemeDetail.FileName; componentDownloadPath = themePackageFilePath + "\\component.zip"; string sendHostURl = OnlineStoreURL.Replace("Sage_Services/OnlineStore.asmx", ""); tempThemeDetail.HostUrl = sendHostURl + tempThemeDetail.FolderName + "/" + tempThemeDetail.FileName; DownloadComponentZip(tempThemeDetail.HostUrl, componentDownloadPath); } }
public void GetOnlineTheme(int themeID, int portalID, int userModuleID, string userName, string culture) { themeID_ = themeID; portalID_ = portalID; userModuleID_ = userModuleID; userName_ = userName; culture_ = culture; SageFrameConfig sageConfig = new SageFrameConfig(); OnlineStoreURL = sageConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.OnlineStore); decimal easyVersion = 0; decimal.TryParse(Config.GetSetting("SageFrameVersion"), out easyVersion); string apiUrl = OnlineStoreURL + "/GetOnlineThemePackage"; ComponentPackage tempThemeDetail = new ComponentPackage(); using (WebClient wc = new WebClient()) { wc.Headers[HttpRequestHeader.ContentType] = "application/json"; wc.QueryString.Add("themeID", themeID.ToString()); wc.Encoding = Encoding.UTF8; var resultData = wc.DownloadString(apiUrl); dynamic dyn = JsonConvert.DeserializeObject(resultData); if (dyn != null) { tempThemeDetail = JsonConvert.DeserializeObject <ComponentPackage>(dyn.d.Value); } string themePackageFilePath = HttpContext.Current.Server.MapPath(@"\downloadmyfiles"); templateZipPath = themePackageFilePath; if (!Directory.Exists(themePackageFilePath)) { Directory.CreateDirectory(themePackageFilePath); } successFileName = tempThemeDetail.FileName; string sendHostURl = OnlineStoreURL.Replace("Sage_Services/OnlineStore.asmx", ""); tempThemeDetail.HostUrl = sendHostURl + tempThemeDetail.FolderName + "/" + tempThemeDetail.FileName; DownloadThemeZip(tempThemeDetail.HostUrl, themePackageFilePath + "\\theme.zip"); } }