Example #1
0
        private static void SetDate(DataRow row, List <string> modifiedColumns, string propertyName, string dateString)
        {
            ExDateTime?utcExDateTime = DiscoveryHoldPropertiesHelper.GetUtcExDateTime(dateString);

            if (utcExDateTime != null)
            {
                row[propertyName] = utcExDateTime.Value.ToUtc();
                modifiedColumns.Add(propertyName);
                return;
            }
            DDIHelper.Trace(string.Format("{0} was not set because an expected date {1} resulted in null.", propertyName, dateString));
        }
Example #2
0
        public static void GetObjectForCopySearchPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow = dataTable.Rows[0];

            dataRow["EnableFullLogging"]     = ((LoggingLevel)dataRow["LogLevel"] == LoggingLevel.Full);
            dataRow["SendMeEmailOnComplete"] = ((MultiValuedProperty <ADObjectId>)dataRow["StatusMailRecipients"]).Contains(RbacPrincipal.Current.ExecutingUserId);
            DiscoveryHoldPropertiesHelper.GetValuesForListRow(dataRow);
        }
Example #3
0
        internal static void GetValuesForListRow(DataRow row)
        {
            ExDateTime? exDateTimeValue = row["LastModifiedTime"].IsNullValue() ? null : ((ExDateTime?)row["LastModifiedTime"]);
            SearchState searchState     = (SearchState)row["Status"];
            bool        flag            = (bool)row["EstimateOnly"];

            row["HoldStatusDescription"]   = DiscoveryHoldPropertiesHelper.GetHoldStatusDescription((bool)row["InPlaceHoldEnabled"]);
            row["LastModifiedTimeDisplay"] = exDateTimeValue.ToUserDateTimeString();
            row["LastModifiedUTCDateTime"] = ((exDateTimeValue != null) ? exDateTimeValue.Value.UniversalTime : DateTime.MinValue);
            row["CreatedByDisplayName"]    = DiscoveryHoldPropertiesHelper.GetCreatedByUserDisplayName((string)row["CreatedBy"]);
            row["IsEstimateOnly"]          = flag;
            row["IsStartable"]             = DiscoveryHoldPropertiesHelper.IsStartable(flag, searchState);
            row["IsPreviewable"]           = (searchState != SearchState.EstimateFailed && searchState != SearchState.Failed);
            row["IsStoppable"]             = (searchState == SearchState.InProgress || SearchState.EstimateInProgress == searchState);
            row["IsResumable"]             = (SearchState.PartiallySucceeded == searchState);
        }
Example #4
0
        public static void GetObjectPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow = dataTable.Rows[0];

            if (dataRow["StartDate"] != DBNull.Value)
            {
                ExDateTime?exDateTime = (ExDateTime?)dataRow["StartDate"];
                dataRow["StartDateEnabled"] = (exDateTime != null);
                dataRow["SearchStartDate"]  = ((exDateTime != null) ? exDateTime.Value.ToUserDateTimeGeneralFormatString() : ExDateTime.Now.ToUserDateTimeGeneralFormatString());
            }
            else
            {
                dataRow["StartDateEnabled"] = false;
                dataRow["SearchStartDate"]  = ExDateTime.Now.ToUserDateTimeGeneralFormatString();
            }
            if (dataRow["EndDate"] != DBNull.Value)
            {
                ExDateTime?exDateTime2 = (ExDateTime?)dataRow["EndDate"];
                dataRow["EndDateEnabled"] = (exDateTime2 != null);
                dataRow["SearchEndDate"]  = ((exDateTime2 != null) ? exDateTime2.Value.ToUserDateTimeGeneralFormatString() : ExDateTime.Now.AddDays(1.0).ToUserExDateTime().ToUserDateTimeGeneralFormatString());
            }
            else
            {
                dataRow["EndDateEnabled"] = false;
                dataRow["SearchEndDate"]  = ExDateTime.Now.AddDays(1.0).ToUserExDateTime().Date.ToUserDateTimeGeneralFormatString();
            }
            if (dataRow["ItemHoldPeriod"] != DBNull.Value)
            {
                Unlimited <EnhancedTimeSpan> unlimited = (Unlimited <EnhancedTimeSpan>)dataRow["ItemHoldPeriod"];
                dataRow["HoldIndefinitely"]   = unlimited.IsUnlimited;
                dataRow["ItemHoldPeriodDays"] = (unlimited.IsUnlimited ? null : unlimited.Value.Days.ToString());
            }
            DiscoveryHoldPropertiesHelper.GetValuesForListRow(dataRow);
        }
Example #5
0
        public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow       dataRow = dataTable.Rows[0];
            List <string> list    = new List <string>();

            if (!dataRow["SearchAllMailboxes"].IsNullValue() && dataRow["SearchAllMailboxes"].IsTrue())
            {
                dataRow["SourceMailboxes"] = null;
                list.Add("SourceMailboxes");
            }
            if (!dataRow["SearchAllPublicFolders"].IsNullValue() && dataRow["SearchAllPublicFolders"].IsTrue())
            {
                dataRow["PublicFolderSources"] = null;
                list.Add("PublicFolderSources");
                dataRow["AllPublicFolderSources"] = true;
                list.Add("AllPublicFolderSources");
            }
            if (!dataRow["HoldIndefinitely"].IsNullValue() && dataRow["HoldIndefinitely"].IsTrue())
            {
                dataRow["ItemHoldPeriod"] = Unlimited <EnhancedTimeSpan> .UnlimitedValue;
                list.Add("ItemHoldPeriod");
            }
            else if (!dataRow["ItemHoldPeriodDays"].IsNullValue())
            {
                dataRow["ItemHoldPeriod"] = Unlimited <EnhancedTimeSpan> .Parse((string)dataRow["ItemHoldPeriodDays"]);

                list.Add("ItemHoldPeriod");
            }
            if (!dataRow["StartDateEnabled"].IsNullValue())
            {
                if (dataRow["StartDateEnabled"].IsTrue())
                {
                    DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "StartDate", (string)dataRow["SearchStartDate"]);
                }
                else
                {
                    dataRow["StartDate"] = null;
                    list.Add("StartDate");
                }
            }
            else if (!dataRow["SearchStartDate"].IsNullValue())
            {
                DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "StartDate", (string)dataRow["SearchStartDate"]);
            }
            if (!dataRow["EndDateEnabled"].IsNullValue())
            {
                if (dataRow["EndDateEnabled"].IsTrue())
                {
                    DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "EndDate", (string)dataRow["SearchEndDate"]);
                }
                else
                {
                    dataRow["EndDate"] = null;
                    list.Add("EndDate");
                }
            }
            else if (!dataRow["SearchEndDate"].IsNullValue())
            {
                DiscoveryHoldPropertiesHelper.SetDate(dataRow, list, "EndDate", (string)dataRow["SearchEndDate"]);
            }
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "SenderList", "Senders");
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "RecipientList", "Recipients");
            DiscoveryHoldPropertiesHelper.SetChangedListProperty(dataRow, list, "MessageTypeList", "MessageTypes");
            if (!dataRow["SearchContent"].IsNullValue() && dataRow["SearchContent"].IsFalse())
            {
                dataRow["SearchQuery"] = DBNull.Value;
                list.Add("SearchQuery");
                dataRow["Senders"] = DBNull.Value;
                list.Add("Senders");
                dataRow["Recipients"] = DBNull.Value;
                list.Add("Recipients");
                dataRow["MessageTypes"] = DBNull.Value;
                list.Add("MessageTypes");
                dataRow["StartDate"] = DBNull.Value;
                list.Add("StartDate");
                dataRow["EndDate"] = DBNull.Value;
                list.Add("EndDate");
            }
            if (RbacPrincipal.Current.IsInRole("Set-MailboxSearch?EstimateOnly&ExcludeDuplicateMessages&LogLevel"))
            {
                dataRow["EstimateOnly"] = true;
                list.Add("EstimateOnly");
                dataRow["ExcludeDuplicateMessages"] = false;
                list.Add("ExcludeDuplicateMessages");
                dataRow["LogLevel"] = LoggingLevel.Suppress;
                list.Add("LogLevel");
            }
            store.SetModifiedColumns(list);
        }