Example #1
0
        /// <summary>
        /// The save_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Save_Click([NotNull] object sender, [NotNull] EventArgs e)
        {
            // retrieve access mask ID from parameter (if applicable)
            if (this.Request.QueryString.GetFirstOrDefault("r") != null)
            {
                object groupId = this.Request.QueryString.GetFirstOrDefault("r");

                foreach (RepeaterItem ri in this.AccessList.Items)
                {
                    string eventTypeName = ((Label)ri.FindControl("EventTypeName")).Text.Trim();
                    bool   viewAccess    = ((CheckBox)ri.FindControl("ViewAccess")).Checked;
                    bool   deleteAccess  = ((CheckBox)ri.FindControl("DeleteAccess")).Checked;

                    if (viewAccess)
                    {
                        // Parse enum value from name.
                        EventLogTypes eventTypeId;
                        Enum.TryParse(eventTypeName, true, out eventTypeId);

                        // save it
                        LegacyDb.eventloggroupaccess_save(
                            groupId, eventTypeId.ToType <int>(), eventTypeName, deleteAccess);
                    }
                    else
                    {
                        var           etn = ((Label)ri.FindControl("EventTypeName")).Text.Trim();
                        EventLogTypes eventTypeId;
                        Enum.TryParse(etn, true, out eventTypeId);
                        LegacyDb.eventloggroupaccess_delete(groupId, eventTypeId.ToType <int>(), etn);
                    }
                }
            }

            YafBuildLink.Redirect(ForumPages.admin_eventloggroups);
        }
Example #2
0
        /// <summary>
        /// The RevokeAll _Click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void RevokeAll_Click([NotNull] object sender, [NotNull] EventArgs e)
        {
            // revoke permissions by deleting records from table. Number of records ther should be minimal.
            if (this.Request.QueryString.GetFirstOrDefault("r") != null)
            {
                object groupId = this.Request.QueryString.GetFirstOrDefault("r");
                foreach (var etn in
                         from RepeaterItem ri in this.AccessList.Items
                         select((Label)ri.FindControl("EventTypeName")).Text.Trim())
                {
                    // Parse enum value from name.
                    EventLogTypes eventTypeId;
                    Enum.TryParse(etn, true, out eventTypeId);

                    // save it
                    LegacyDb.eventloggroupaccess_delete(groupId, eventTypeId.ToType <int>(), etn);
                }
            }

            YafBuildLink.Redirect(ForumPages.admin_eventloggroups);
        }