示例#1
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            this.InitializeControls();
            PowerShellResults <JsonDictionary <object> > powerShellResults = (PowerShellResults <JsonDictionary <object> >) base["PreLoadResults"];

            if (powerShellResults != null && powerShellResults.SucceededWithValue)
            {
                Dictionary <string, object> dictionary = powerShellResults.Value;
                bool includeArchive = false;
                if ((string)dictionary["Type"] == ElcFolderType.All.ToString() || (string)dictionary["Type"] == ElcFolderType.Personal.ToString())
                {
                    this.divType.Visible = false;
                    includeArchive       = true;
                }
                RetentionUtils.PopulateRetentionActions(this.rblRetentionAction, includeArchive);
            }
        }
示例#2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            bool includeArchive = true;

            this.InitializeControls();
            NameValueCollection queryString = this.Context.Request.QueryString;
            string text = queryString["typeGroup"];

            if (!string.IsNullOrEmpty(text))
            {
                this.divType.Visible = false;
                string text2;
                if (string.Compare(text, "SystemFolder", true) == 0)
                {
                    text2 = Strings.NewRetentionTagForSystemFolder;
                    this.tbxTypeHidden.Text    = string.Empty;
                    this.divType.Visible       = true;
                    this.tbxTypeHidden.Visible = false;
                    RetentionUtils.PopulateRetentionTypes(this.ddlType);
                    includeArchive = false;
                }
                else if (string.Compare(text, "All", true) == 0)
                {
                    text2 = Strings.NewRetentionTagForAll;
                    this.tbxTypeHidden.Text = "All";
                }
                else
                {
                    if (string.Compare(text, "Personal", true) != 0)
                    {
                        throw new BadQueryParameterException("typeGroup", new ArgumentException(string.Format("Retention tag type group [{0}] is not supported.", text)));
                    }
                    text2 = Strings.NewRetentionTagForPersonal;
                    this.tbxTypeHidden.Text = "Personal";
                }
                base.Title   = text2;
                base.Caption = text2;
                RetentionUtils.PopulateRetentionActions(this.rblRetentionAction, includeArchive);
                return;
            }
            throw new BadQueryParameterException("typeGroup", new ArgumentException("Retention tag type group is required."));
        }
        public PowerShellResults <RetentionPolicyTagRow> GetList(AllAssociatedRPTsFilter filter, SortOptions sort)
        {
            filter.IncludeDefaultTags = true;
            PowerShellResults <RetentionPolicyTagRow> list = base.GetList <RetentionPolicyTagRow, AllAssociatedRPTsFilter>("Get-RetentionPolicyTag", filter, null);
            PowerShellResults <RetentionPolicyTagRow> powerShellResults = list.MergeErrors <RetentionPolicyTagRow>(base.GetList <RetentionPolicyTagRow, OptInRPTsFilter>("Get-RetentionPolicyTag", new OptInRPTsFilter(), null));

            if (list.Succeeded && RbacPrincipal.Current.ExecutingUserId != null)
            {
                Accounts accounts = new Accounts();
                if (!RetentionUtils.UserHasArchive(accounts.GetRecipientObject(null)))
                {
                    List <RetentionPolicyTagRow> list2 = new List <RetentionPolicyTagRow>();
                    foreach (RetentionPolicyTagRow retentionPolicyTagRow in list.Output)
                    {
                        if (retentionPolicyTagRow.RetentionPolicyTag.RetentionAction != RetentionActionType.MoveToArchive)
                        {
                            list2.Add(retentionPolicyTagRow);
                        }
                    }
                    list.Output = list2.ToArray();
                }
            }
            if (list.Succeeded && powerShellResults.Succeeded)
            {
                foreach (RetentionPolicyTagRow retentionPolicyTagRow2 in list.Output.Intersect(powerShellResults.Output))
                {
                    retentionPolicyTagRow2.OptionalTag = true;
                }
                if (sort != null)
                {
                    sort.PropertyName = RetentionPolicyTagBaseRow.GetSortProperty(sort.PropertyName);
                    Func <RetentionPolicyTagRow[], RetentionPolicyTagRow[]> sortFunction = sort.GetSortFunction <RetentionPolicyTagRow>();
                    if (sortFunction != null)
                    {
                        list.Output = sortFunction(list.Output);
                    }
                }
            }
            return(list);
        }
示例#4
0
        public PowerShellResults <OptionalRetentionPolicyTagRow> GetList(AllRPTsFilter filter, SortOptions sort)
        {
            PowerShellResults <OptionalRetentionPolicyTagRow> powerShellResults = new PowerShellResults <OptionalRetentionPolicyTagRow>();
            PowerShellResults <OptionalRetentionPolicyTagRow> list = base.GetList <OptionalRetentionPolicyTagRow, AllRPTsFilter>("Get-RetentionPolicyTag", filter, sort, "DisplayName");
            PowerShellResults <OptionalRetentionPolicyTagRow> powerShellResults2 = list.MergeErrors <OptionalRetentionPolicyTagRow>(base.GetList <OptionalRetentionPolicyTagRow, AllAssociatedRPTsFilter>("Get-RetentionPolicyTag", new AllAssociatedRPTsFilter(), null));

            if (list.Succeeded && powerShellResults2.Succeeded)
            {
                powerShellResults.Output = list.Output.Except(powerShellResults2.Output).ToArray <OptionalRetentionPolicyTagRow>();
                if (RbacPrincipal.Current.ExecutingUserId != null)
                {
                    Accounts accounts = new Accounts();
                    if (!RetentionUtils.UserHasArchive(accounts.GetRecipientObject(null)))
                    {
                        List <OptionalRetentionPolicyTagRow> list2 = new List <OptionalRetentionPolicyTagRow>();
                        foreach (OptionalRetentionPolicyTagRow optionalRetentionPolicyTagRow in powerShellResults.Output)
                        {
                            if (optionalRetentionPolicyTagRow.RetentionPolicyTag.RetentionAction != RetentionActionType.MoveToArchive)
                            {
                                list2.Add(optionalRetentionPolicyTagRow);
                            }
                        }
                        powerShellResults.Output = list2.ToArray();
                    }
                }
                if (sort != null)
                {
                    sort.PropertyName = RetentionPolicyTagBaseRow.GetSortProperty(sort.PropertyName);
                    Func <OptionalRetentionPolicyTagRow[], OptionalRetentionPolicyTagRow[]> sortFunction = sort.GetSortFunction <OptionalRetentionPolicyTagRow>();
                    if (sortFunction != null)
                    {
                        powerShellResults.Output = sortFunction(powerShellResults.Output);
                    }
                }
            }
            return(powerShellResults);
        }