Beispiel #1
0
        public WebbuilderSite ExtractSite(int userModuelID, string culture, string hostURL)
        {
            WebbuilderSite objWebbuilder = new WebbuilderSite();

            try
            {
                SQLHandler             sagesql     = new SQLHandler();
                List <Webbuilderpages> objPageList = new List <Webbuilderpages>();
                List <KeyValuePair <string, object> > paramHeader = new List <KeyValuePair <string, object> >();
                paramHeader.Add(new KeyValuePair <string, object>("@UserModuleID", userModuelID));
                paramHeader.Add(new KeyValuePair <string, object>("@Culturecode", culture));
                paramHeader.Add(new KeyValuePair <string, object>("@HostURL", hostURL));
                objWebbuilder = sagesql.ExecuteAsObject <WebbuilderSite>("[dbo].[usp_WebBuilder_Site_GetPageGeneralDetail]", paramHeader);
                if (objWebbuilder != null)
                {
                    objPageList            = sagesql.ExecuteAsList <Webbuilderpages>("[dbo].[usp_WebBuilder_Site_GetPages]", paramHeader);
                    objWebbuilder.PageList = objPageList;
                    List <ControllerDetail> objAPIList = sagesql.ExecuteAsList <ControllerDetail>("[dbo].[usp_WebBUilder_Extract_GetAPI]");
                    objWebbuilder.APIInvokeList = objAPIList;
                }
            }
            catch
            {
                throw;
            }
            return(objWebbuilder);
        }
        private void UpdateThemeDownloadCount(int themeID)
        {
            SageFrameConfig sageConfig     = new SageFrameConfig();
            string          onlineStoreURL = sageConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.OnlineStore);
            string          apiUrl         = onlineStoreURL + "/UpdateThemeDownloadCount";
            WebbuilderSite  webInfo        = new WebbuilderSite();

            using (WebClient wc = new WebClient())
            {
                wc.Headers[HttpRequestHeader.ContentType] = "application/json";
                wc.QueryString.Add("themeID", themeID.ToString());
                var resultData = wc.DownloadString(apiUrl);
            }
        }
Beispiel #3
0
        public void CreateSite(WebbuilderSite objWebsite)
        {
            try
            {
                //update webbuilder archive old website  data
                SQLHandler sagesql = new SQLHandler();
                sagesql.ExecuteNonQuery("[dbo].[usp_WebBuilder_Site_ArchiveOld]");

                //insert all the pages here

                foreach (Webbuilderpages objPages in objWebsite.PageList)
                {
                    List <KeyValuePair <string, object> > param = new List <KeyValuePair <string, object> >();
                    param.Add(new KeyValuePair <string, object>("@EditDOM", objPages.EditDOM));
                    param.Add(new KeyValuePair <string, object>("@ViewDOM", objPages.ViewDOM));
                    param.Add(new KeyValuePair <string, object>("@PortalID", objWebsite.PortalID));
                    param.Add(new KeyValuePair <string, object>("@UserModuleID", objWebsite.UserModuleID));
                    param.Add(new KeyValuePair <string, object>("@Culture", objWebsite.Culture));
                    param.Add(new KeyValuePair <string, object>("@UserName", objWebsite.UserName));
                    param.Add(new KeyValuePair <string, object>("@Extra", objPages.Extra));
                    param.Add(new KeyValuePair <string, object>("@Settings", objPages.Settings));
                    param.Add(new KeyValuePair <string, object>("@PageName", objPages.PageName));
                    sagesql.ExecuteNonQuery("[dbo].[usp_WebBuilder_Site_InsertPage]", param);
                }

                //update header

                List <KeyValuePair <string, object> > paramHeader = new List <KeyValuePair <string, object> >();
                paramHeader.Add(new KeyValuePair <string, object>("@WebBuilderID", 0));
                paramHeader.Add(new KeyValuePair <string, object>("@Header", objWebsite.HeaderView));
                paramHeader.Add(new KeyValuePair <string, object>("@HeaderEdit", objWebsite.HeaderEdit));
                paramHeader.Add(new KeyValuePair <string, object>("@UserModuleID", objWebsite.UserModuleID));
                paramHeader.Add(new KeyValuePair <string, object>("@Culture", objWebsite.Culture));
                sagesql.ExecuteNonQuery("[dbo].[usp_WebbUilder_Site_InsertHeader]", paramHeader);


                //update Footer

                paramHeader = new List <KeyValuePair <string, object> >();
                paramHeader.Add(new KeyValuePair <string, object>("@WebBuilderID", 0));
                paramHeader.Add(new KeyValuePair <string, object>("@Footer", objWebsite.FooterView));
                paramHeader.Add(new KeyValuePair <string, object>("@FooterEdit", objWebsite.FooterEdit));
                paramHeader.Add(new KeyValuePair <string, object>("@UserModuleID", objWebsite.UserModuleID));
                paramHeader.Add(new KeyValuePair <string, object>("@Culture", objWebsite.Culture));
                sagesql.ExecuteNonQuery("[dbo].[usp_WebbUilder_Site_InsertFooter]", paramHeader);

                //default + delete unwanted pages

                //update APIInvoke
                sagesql.ExecuteNonQuery("[dbo].[usp_WebBuilder_Site_DeleteAPI]");
                foreach (ControllerDetail objController in objWebsite.APIInvokeList)
                {
                    List <KeyValuePair <string, object> > param = new List <KeyValuePair <string, object> >();
                    param.Add(new KeyValuePair <string, object>("@Namespaces", objController.Namespaces));
                    param.Add(new KeyValuePair <string, object>("@ClassNames", objController.ClassNames));
                    param.Add(new KeyValuePair <string, object>("@MethodNames", objController.MethodNames));
                    param.Add(new KeyValuePair <string, object>("@Parameters", objController.Parameters));
                    param.Add(new KeyValuePair <string, object>("@ComponentID", objController.ComponentID));
                    param.Add(new KeyValuePair <string, object>("@ComponentName", objController.ComponentName));
                    param.Add(new KeyValuePair <string, object>("@BindMethodName", objController.BindMethodName));
                    param.Add(new KeyValuePair <string, object>("@ErrorMethodName", objController.ErrorMethodName));
                    param.Add(new KeyValuePair <string, object>("@PageName", objController.PageName));
                    param.Add(new KeyValuePair <string, object>("@Type", objController.Type));
                    sagesql.ExecuteNonQuery("[dbo].[usp_WebBuilder_Site_InsertAPI]", param);
                }
                //usp_WebBuilder_site_updateInstall
                paramHeader = new List <KeyValuePair <string, object> >();
                paramHeader.Add(new KeyValuePair <string, object>("@DefaultPage", objWebsite.DefaultPage));
                sagesql.ExecuteNonQuery("[dbo].[usp_WebBuilder_site_updateInstall]", paramHeader);

                //Published Site
                sagesql.ExecuteNonQuery("[dbo].[usp_WebBuilder_site_Published]");
            }
            catch
            {
                throw;
            }
        }
        private void ProcessSite(string extractedPath)
        {
            //read json file
            string         filePath = extractedPath + "\\theme.json";
            string         json     = string.Empty;
            WebbuilderSite webInfo  = new WebbuilderSite();

            using (StreamReader readFrom = new StreamReader(filePath, System.Text.Encoding.ASCII))
            {
                json = readFrom.ReadToEnd();
            }
            if (json != string.Empty)
            {
                webInfo = JsonConvert.DeserializeObject <WebbuilderSite>(json);
            }
            if (webInfo != null)
            {
                UpdateThemeDownloadCount(themeID_);
                WebBuilderController objController = new WebBuilderController();
                webInfo.UserName     = userName_;
                webInfo.UserModuleID = userModuleID_;
                webInfo.PortalID     = portalID_;
                webInfo.Culture      = culture_;
                objController.CreateSite(webInfo);
                KeyValue      objKeyValue     = objController.GetInstalledComponentList();
                string[]      clientComponent = objKeyValue.Value.Split(',');
                string[]      siteComponent   = webInfo.Components.Split(',');
                List <string> unInstallCompo  = new List <string>();
                foreach (string siteCompo in siteComponent)
                {
                    bool exists = false;
                    foreach (string clientCom in clientComponent)
                    {
                        if (clientCom == siteCompo)
                        {
                            exists = true;
                        }
                    }
                    if (!exists)
                    {
                        unInstallCompo.Add(siteCompo);
                    }
                }
                if (unInstallCompo.Count > 0)
                {
                    using (WebClient wc = new WebClient())
                    {
                        SageFrameConfig         sageConfig     = new SageFrameConfig();
                        string                  onlineStoreURL = sageConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.OnlineStore);
                        List <BuilderComponent> objBuildCompo  = new List <BuilderComponent>();
                        string                  componentIDs   = string.Join(",", unInstallCompo);
                        var    reqparm    = new System.Collections.Specialized.NameValueCollection();
                        string resultData = GetOnlineComponents(componentIDs);
                        if (resultData != string.Empty)
                        {
                            objBuildCompo = JsonConvert.DeserializeObject <List <BuilderComponent> >(resultData);
                            foreach (BuilderComponent objBuildCompoitem in objBuildCompo)
                            {
                                objBuildCompoitem.UserModuleID = userModuleID_;
                                UpdateComponentForPage(objBuildCompoitem);
                                ClearUpdateCache();
                            }
                        }
                    }
                }
            }
            Directory.Delete(extractedPath, true);
        }
Beispiel #5
0
        public void CreateSite(WebbuilderSite objWebsite)
        {
            WebBuilderDataProvider objDataProvider = new WebBuilderDataProvider();

            objDataProvider.CreateSite(objWebsite);
        }