public static void RemoveMember(Guid communityID, Guid userID) { SPs.HispCommunityUserRemoveMember(communityID, userID).Execute(); }
public static void CreateDefaultWidgets(Guid pageID, string pageType, string page, string langCode) { try { XmlDocument xmlDefaultWidgets = new XmlDocument(); StreamReader sr = new StreamReader(HttpContext.Current.Server.MapPath(string.Format("{0}/Configurations/DefaultWidgets.config", SiteConfig.SiteVRoot))); xmlDefaultWidgets.LoadXml(sr.ReadToEnd()); sr.Close(); XmlNodeList xmlLayoutCols = xmlDefaultWidgets.SelectNodes(string.Format("//root/Community[@pageType='{0}' and @page='{1}']/Column", pageType, page)); foreach (XmlNode xmlLayoutCol in xmlLayoutCols) { try { int intColNr = Convert.ToInt32(xmlLayoutCol.Attributes["number"].Value); XmlNodeList xmlWidgtes = xmlLayoutCol.SelectNodes("widget"); int intOrderNr = 0; foreach (XmlNode xmlWidget in xmlWidgtes) { try { bool isFixed = false; bool hideIfNoContent = false; string roleVisibility = string.Empty; string templateID = string.Empty; string title = string.Empty; string outputTemplate = string.Empty; if (xmlWidget.Attributes["IsFixed"] != null) { bool.TryParse(xmlWidget.Attributes["IsFixed"].Value, out isFixed); } if (xmlWidget.Attributes["HideIfNoContent"] != null) { bool.TryParse(xmlWidget.Attributes["HideIfNoContent"].Value, out hideIfNoContent); } if (xmlWidget.Attributes["ViewRoles"] != null) { roleVisibility = xmlWidget.Attributes["ViewRoles"].Value.Replace(',', Constants.TAG_DELIMITER); } if (xmlWidget.Attributes["WTP_ID"] != null) { templateID = xmlWidget.Attributes["WTP_ID"].Value; } if (xmlWidget.Attributes["OutputTemplate"] != null) { outputTemplate = xmlWidget.Attributes["OutputTemplate"].Value; } if (xmlWidget.Attributes["Title"] != null) { title = xmlWidget.Attributes["Title"].Value; } Guid widgetId = new Guid(xmlWidget.Attributes["id"].Value); string predefinedContent = string.Empty; if (xmlWidget.HasChildNodes) { predefinedContent = xmlWidget.InnerText; } WidgetElement widget = WidgetSection.CachedInstance.Widgets.Cast <WidgetElement>().Where(w => w.Id == widgetId).Single(); HitblWidgetInstanceIn newWidgetIns = new HitblWidgetInstanceIn(); newWidgetIns.InsId = Guid.NewGuid(); newWidgetIns.InsColumnNo = intColNr; newWidgetIns.InsCreatedDate = newWidgetIns.InsLastUpdate = DateTime.Now; newWidgetIns.InsExpanded = true; newWidgetIns.InsOrderNo = intOrderNr; newWidgetIns.InsPagId = pageID; newWidgetIns.InsIsFixed = isFixed; newWidgetIns.InsHideIfNoContent = hideIfNoContent; newWidgetIns.InsViewRoles = roleVisibility; if (templateID.Length > 0) { newWidgetIns.WtpId = templateID.ToGuid(); } if (outputTemplate.Length > 0) { newWidgetIns.InsOutputTemplate = outputTemplate.ToGuid(); } newWidgetIns.InsXmlStateData = predefinedContent.Length == 0 ? widget.Settings.Value : predefinedContent; newWidgetIns.WdgId = widgetId; newWidgetIns.Save(); HitblWidgetInstanceTextWit newWidgetInsTxt = new HitblWidgetInstanceTextWit(); newWidgetInsTxt.InsId = newWidgetIns.InsId; newWidgetInsTxt.WitLangCode = langCode; if (title.Length == 0) { newWidgetInsTxt.WitTitle = GuiLanguage.GetGuiLanguage("WidgetsBase").GetString(widget.TitleKey); } else { newWidgetInsTxt.WitTitle = title; } newWidgetInsTxt.Save(); if (templateID.Length > 0) { SPs.HispWidgetTemplatesIncreaseCount(pageID, newWidgetIns.WtpId).Execute(); } intOrderNr++; } catch { } } } catch { } } } catch { } }
/// <summary> /// Gets the current Page of the community and set it in the user settings /// If the user has already visitetd the page it will be read form his settings, else page id with order 1 will come /// </summary> /// <param name="n"></param> /// <returns></returns> public static HitblPagePag GetCurrPage(Guid communityID, Guid userId) { Guid fisrtPageID = (Guid)SPs.HispCommunityGetCurrPageID(communityID, userId).ExecuteScalar(); return(HitblPagePag.FetchByID(fisrtPageID)); }
/// <summary> /// Gets the first Page of the community (The non deletable page with sort order 1) /// </summary> /// <param name="n"></param> /// <returns></returns> public static HitblPagePag GetFirstPage(Guid communityID) { Guid fisrtPageID = (Guid)SPs.HispCommunityGetFirstPageID(communityID).ExecuteScalar(); return(HitblPagePag.FetchByID(fisrtPageID)); }
public static void DeletePage(Guid PageId) { SPs.HispCommunityDeletePage(PageId).Execute(); }