/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { repLatestPosts.DataBindByDefault = false; pagerElem.PageControl = repLatestPosts.ID; if (StopProcessing) { // Do nothing } else { SetContext(); if (!String.IsNullOrEmpty(TransformationName)) { // Basic control properties repLatestPosts.HideControlForZeroRows = HideControlForZeroRows; repLatestPosts.ZeroRowsText = ZeroRowsText; // Check if Group name is set GroupInfo gi = null; if ((CommunityContext.CurrentGroup != null) && (GroupName.ToLower() == CommunityContext.CurrentGroup.GroupName.ToLower())) { gi = CommunityContext.CurrentGroup; } else { gi = GroupInfoProvider.GetGroupInfo(GroupName, CMSContext.CurrentSiteName); } if (gi != null) { // Data source properties forumDataSource.TopN = SelectTopN; forumDataSource.OrderBy = OrderBy; forumDataSource.CacheItemName = CacheItemName; forumDataSource.CacheDependencies = CacheDependencies; forumDataSource.CacheMinutes = CacheMinutes; forumDataSource.SelectedColumns = Columns; forumDataSource.FilterName = FilterName; #region "Repeater template properties" // Apply transformations if they exist repLatestPosts.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName, false); if (!String.IsNullOrEmpty(AlternatingItemTransformationName)) { repLatestPosts.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName, false); } if (!String.IsNullOrEmpty(FooterTransformationName)) { repLatestPosts.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName, false); } if (!String.IsNullOrEmpty(HeaderTransformationName)) { repLatestPosts.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName, false); } if (!String.IsNullOrEmpty(SeparatorTransformationName)) { repLatestPosts.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName, false); } #endregion // UniPager properties pagerElem.PageSize = PageSize; pagerElem.GroupSize = GroupSize; pagerElem.QueryStringKey = QueryStringKey; pagerElem.DisplayFirstLastAutomatically = DisplayFirstLastAutomatically; pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically; pagerElem.HidePagerForSinglePage = HidePagerForSinglePage; switch (PagingMode.ToLower()) { case "postback": pagerElem.PagerMode = UniPagerMode.PostBack; break; default: pagerElem.PagerMode = UniPagerMode.Querystring; break; } #region "UniPager template properties" // UniPager template properties if (!String.IsNullOrEmpty(PagesTemplate)) { pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate, false); } if (!String.IsNullOrEmpty(CurrentPageTemplate)) { pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate, false); } if (!String.IsNullOrEmpty(SeparatorTemplate)) { pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate, false); } if (!String.IsNullOrEmpty(FirstPageTemplate)) { pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate, false); } if (!String.IsNullOrEmpty(LastPageTemplate)) { pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate, false); } if (!String.IsNullOrEmpty(PreviousPageTemplate)) { pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate, false); } if (!String.IsNullOrEmpty(NextPageTemplate)) { pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate, false); } if (!String.IsNullOrEmpty(PreviousGroupTemplate)) { pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate, false); } if (!String.IsNullOrEmpty(NextGroupTemplate)) { pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate, false); } if (!String.IsNullOrEmpty(DirectPageTemplate)) { pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate, false); } if (!String.IsNullOrEmpty(LayoutTemplate)) { pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate, false); } #endregion forumDataSource.WhereCondition = WhereCondition; forumDataSource.GroupID = gi.GroupID; forumDataSource.CheckPermissions = true; forumDataSource.SiteName = SiteName; repLatestPosts.DataSource = forumDataSource.DataSource; if (!DataHelper.DataSourceIsEmpty(repLatestPosts.DataSource)) { repLatestPosts.DataBind(); } } else { forumDataSource.StopProcessing = true; } } ReleaseContext(); } }
private void buttonAdd_Click(object sender, EventArgs e) { XDocument doc = XDocument.Load(Form1.FileName); if (!doc.Descendants("firmen").First().Descendants("firma").Where(x => x.Attribute("name").Value == comboBoxCompany.Text).First().Descendants("group").Select(x => x.Attribute("name").Value).ToList().ConvertAll(x => x.ToLower()).Contains(textBoxGroupName.Text.ToLower()) || textBoxGroupName.Text.ToLower() == GroupName.ToLower()) { if (!string.IsNullOrEmpty(textBoxGroupName.Text)) { if (string.IsNullOrEmpty(this.GroupName)) { if (!string.IsNullOrEmpty(comboBoxCompany.Text)) { doc.Descendants("firmen").First().Descendants("firma").Where(x => x.Attribute("name").Value == comboBoxCompany.Text).First().Add(new XElement("group", "", new XAttribute[] { new XAttribute("name", textBoxGroupName.Text), new XAttribute("pfad", textBoxPath.Text), new XAttribute("freigabepfad", textBoxReleasePath.Text), new XAttribute("sachb", StringBoolToInt(checkBoxSachb.Checked)) })); } } else { XElement xElement = doc.Descendants("firmen").First().Descendants("firma").Where(x => x.Attribute("name").Value == Company).First().Descendants("group").Where(x => x.Attribute("name").Value == this.GroupName).First(); xElement.Attribute("name").Value = textBoxGroupName.Text; xElement.Attribute("pfad").Value = textBoxPath.Text; xElement.Attribute("freigabepfad").Value = textBoxReleasePath.Text; xElement.Attribute("sachb").Value = StringBoolToInt(checkBoxSachb.Checked).ToString(); } NewGroupName = textBoxGroupName.Text; CompanyWhichGotNewGroup = comboBoxCompany.Text; doc.Save(Form1.FileName); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("Bitte einen Gruppennamen angeben", "Gruppenname ungültig", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show($"Eine Gruppe mit dem Namen \"{textBoxGroupName.Text}\" existiert bereits", "Gruppenname vergeben", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }