コード例 #1
0
        public static string Join(object separator, object value)
        {
            if (DDIHelper.IsEmptyValue(value))
            {
                return(string.Empty);
            }
            List <object> list = value as List <object>;

            if (DDIHelper.IsEmptyValue(list))
            {
                return(string.Empty);
            }
            if (separator == null || separator.ToString() == null)
            {
                separator = string.Empty;
            }
            StringBuilder stringBuilder = new StringBuilder();

            foreach (object obj in list)
            {
                if (!DDIHelper.IsEmptyValue(obj) && !DDIHelper.IsEmptyValue(obj.ToString()))
                {
                    if (stringBuilder.Length != 0)
                    {
                        stringBuilder.Append(separator);
                    }
                    stringBuilder.Append(obj.ToString());
                }
            }
            return(stringBuilder.ToString());
        }
コード例 #2
0
ファイル: Antispam.cs プロジェクト: YHZX2013/exchange_diff
        public static void GetConnectionFilterPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow             = dataTable.Rows[0];
            List <IPAddressEntry> list  = new List <IPAddressEntry>();
            List <IPAddressEntry> list2 = new List <IPAddressEntry>();

            if (!DDIHelper.IsEmptyValue(dataRow["IPAllowList"]))
            {
                foreach (IPRange range in ((MultiValuedProperty <IPRange>)dataRow["IPAllowList"]))
                {
                    list.Add(new IPAddressEntry(range));
                }
            }
            if (!DDIHelper.IsEmptyValue(dataRow["IPBlockList"]))
            {
                foreach (IPRange range2 in ((MultiValuedProperty <IPRange>)dataRow["IPBlockList"]))
                {
                    list2.Add(new IPAddressEntry(range2));
                }
            }
            dataRow["IPAllowList"] = list;
            dataRow["IPBlockList"] = list2;
        }
コード例 #3
0
 public static HolidaySchedule[] UMAAHolidayScheduleToTask(object value)
 {
     if (!DDIHelper.IsEmptyValue(value))
     {
         return(Array.ConvertAll <object, HolidaySchedule>((object[])value, (object x) => ((UMAAHolidaySchedule)x).ToHolidaySchedule()));
     }
     return(null);
 }
コード例 #4
0
 public static CustomMenuKeyMapping[] UMAAMenuKeyMappingToTask(object value)
 {
     if (!DDIHelper.IsEmptyValue(value))
     {
         return(Array.ConvertAll <object, CustomMenuKeyMapping>((object[])value, (object x) => ((UMAAMenuKeyMapping)x).ToCustomKeyMapping()));
     }
     return(null);
 }
コード例 #5
0
 public static string[] UMDialingRuleEntryToTask(object value)
 {
     if (!DDIHelper.IsEmptyValue(value))
     {
         return(UMDialingRuleEntry.GetStringArray(Array.ConvertAll <object, UMDialingRuleEntry>((object[])value, (object x) => (UMDialingRuleEntry)x)));
     }
     return(null);
 }
コード例 #6
0
ファイル: DDIHelper.cs プロジェクト: YHZX2013/exchange_diff
        public static bool IsUnlimited(object value)
        {
            if (DDIHelper.IsEmptyValue(value))
            {
                return(false);
            }
            Type type = value.GetType();

            return((bool)type.GetProperty("IsUnlimited").GetValue(value, null));
        }
コード例 #7
0
        public static string ToDaysString(object value)
        {
            string result = string.Empty;

            if (!DDIHelper.IsEmptyValue(value))
            {
                Unlimited <EnhancedTimeSpan> unlimited = (Unlimited <EnhancedTimeSpan>)value;
                result = (unlimited.IsUnlimited ? unlimited.ToString() : unlimited.Value.Days.ToString());
            }
            return(result);
        }
コード例 #8
0
 public static int Length(object value)
 {
     if (!DDIHelper.IsEmptyValue(value))
     {
         Array array = value as Array;
         if (array != null)
         {
             return(array.Length);
         }
     }
     return(0);
 }
コード例 #9
0
        public static void PreGetListAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            ExDateTime exDateTime  = ExDateTime.Now;
            ExDateTime exDateTime2 = ExDateTime.Now;

            if (!DDIHelper.IsEmptyValue(inputrow["DateRangeType"]))
            {
                string a;
                if ((a = inputrow["DateRangeType"].ToString()) != null)
                {
                    if (a == "24h")
                    {
                        exDateTime = ExDateTime.Now.AddHours(-24.0);
                        goto IL_13F;
                    }
                    if (a == "7d")
                    {
                        exDateTime = ExDateTime.Now.AddDays(-7.0);
                        goto IL_13F;
                    }
                    if (a == "custom")
                    {
                        ExTimeZone utcTimeZone = ExTimeZone.UtcTimeZone;
                        if (!DDIHelper.IsEmptyValue(inputrow["TimeZone"]))
                        {
                            ExTimeZoneEnumerator.Instance.TryGetTimeZoneByName(inputrow["TimeZone"].ToString(), out utcTimeZone);
                        }
                        if (!DDIHelper.IsEmptyValue(inputrow["StartDate"]))
                        {
                            exDateTime = ExDateTime.Parse(utcTimeZone, inputrow["StartDate"].ToString());
                        }
                        if (!DDIHelper.IsEmptyValue(inputrow["EndDate"]))
                        {
                            exDateTime2 = ExDateTime.Parse(utcTimeZone, inputrow["EndDate"].ToString());
                            goto IL_13F;
                        }
                        goto IL_13F;
                    }
                }
                exDateTime = ExDateTime.Now.AddHours(-48.0);
IL_13F:
                inputrow["StartDate"] = (DateTime)exDateTime.ToUtc();
                inputrow["EndDate"]   = (DateTime)exDateTime2.ToUtc();
            }
            else
            {
                inputrow["StartDate"] = DBNull.Value;
                inputrow["EndDate"]   = DBNull.Value;
            }
            store.ModifiedColumns.Add("StartDate");
            store.ModifiedColumns.Add("EndDate");
        }
コード例 #10
0
        public static string NullableDateTimeToUserString(object value)
        {
            if (DDIHelper.IsEmptyValue(value))
            {
                return(null);
            }
            DateTime?dateTime = (DateTime?)value;

            if (dateTime == null)
            {
                return(null);
            }
            return(dateTime.Value.LocalToUserDateTimeGeneralFormatString());
        }
コード例 #11
0
        public static void GetListPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            dataTable.BeginLoadData();
            ServerVersion b         = (inputRow["MaxMajorVersion"] is DBNull || string.IsNullOrEmpty((string)inputRow["MaxMajorVersion"])) ? new ServerVersion(int.MaxValue, 0, 0, 0) : new ServerVersion(int.Parse((string)inputRow["MaxMajorVersion"]), int.MaxValue, 0, 0);
            ServerVersion b2        = (inputRow["MinMajorVersion"] is DBNull || string.IsNullOrEmpty((string)inputRow["MinMajorVersion"])) ? new ServerVersion(0, 0, 0, 0) : new ServerVersion(int.Parse((string)inputRow["MinMajorVersion"]), 0, 0, 0);
            ArrayList     arrayList = new ArrayList();

            if (!DDIHelper.IsEmptyValue(inputRow["ServerRole"]))
            {
                string   text  = (string)inputRow["ServerRole"];
                string[] array = text.Split(new char[]
                {
                    ','
                }, StringSplitOptions.RemoveEmptyEntries);
                if (array != null && array.Length > 0)
                {
                    foreach (string value in array)
                    {
                        ServerRole serverRole;
                        if (Enum.TryParse <ServerRole>(value, out serverRole))
                        {
                            arrayList.Add(serverRole);
                        }
                    }
                }
            }
            List <DataRow> list = new List <DataRow>(dataTable.Rows.Count);

            foreach (object obj in dataTable.Rows)
            {
                DataRow dataRow = (DataRow)obj;
                if (!ServerProperties.ServerHasRole(arrayList, (ServerRole)dataRow["ServerRole"]))
                {
                    list.Add(dataRow);
                }
                else
                {
                    ServerVersion a = (ServerVersion)dataRow["AdminDisplayVersion"];
                    if (ServerVersion.Compare(a, b) > 0 || ServerVersion.Compare(a, b2) < 0)
                    {
                        list.Add(dataRow);
                    }
                }
            }
            foreach (DataRow row in list)
            {
                dataTable.Rows.Remove(row);
            }
            dataTable.EndLoadData();
        }
コード例 #12
0
        public static IEnumerable <ScheduleInterval> BoolArrayToScheduleInterval(object value)
        {
            if (DDIHelper.IsEmptyValue(value))
            {
                return(null);
            }
            bool[] array = Array.ConvertAll <object, bool>((object[])value, (object x) => (bool)x);
            if (array.Length != 672)
            {
                throw new FaultException(Strings.EditUMAutoAttendantBusinessHoursScheduleFault(array.Length));
            }
            ScheduleBuilder scheduleBuilder = new ScheduleBuilder();

            scheduleBuilder.SetEntireState(array);
            return(scheduleBuilder.Schedule.Intervals);
        }
コード例 #13
0
        public static void OnPostGlobalSettings(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow dataRow = dataTable.Rows[0];

            dataRow["MaxRecipientEnvelopeLimit"] = DDIUtil.ConvertUnlimitedToString <int>(dataRow["MaxRecipientEnvelopeLimit"], (int t) => t.ToString());
            dataRow["MaxReceiveSize"]            = DDIUtil.ConvertUnlimitedToString <ByteQuantifiedSize>(dataRow["MaxReceiveSize"], (ByteQuantifiedSize s) => s.ToMB(3));
            dataRow["MaxSendSize"] = DDIUtil.ConvertUnlimitedToString <ByteQuantifiedSize>(dataRow["MaxSendSize"], (ByteQuantifiedSize s) => s.ToMB(3));
            if (!DDIHelper.IsEmptyValue(dataRow["SafetyNetHoldTime"]))
            {
                dataRow["SafetyNetHoldTime"] = ((EnhancedTimeSpan)dataRow["SafetyNetHoldTime"]).ToString(TimeUnit.Day, 2);
            }
            if (!DDIHelper.IsEmptyValue(dataRow["MaxDumpsterTime"]))
            {
                dataRow["MaxDumpsterTime"] = ((EnhancedTimeSpan)dataRow["MaxDumpsterTime"]).ToString(TimeUnit.Day, 2);
            }
        }
コード例 #14
0
        public static void OnPreAddDatabaseCopy(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow dataRow = dataTable.Rows[0];

            if (!DBNull.Value.Equals(dataRow["ReplayLagTime"]) && !DDIHelper.IsEmptyValue(dataRow["ReplayLagTime"]))
            {
                inputRow["ReplayLagTime"] = ((string)dataRow["ReplayLagTime"]).FromTimeSpan(TimeUnit.Day);
            }
            else
            {
                inputRow["ReplayLagTime"] = "0".FromTimeSpan(TimeUnit.Day);
            }
            store.SetModifiedColumns(new List <string>
            {
                "ReplayLagTime"
            });
        }
コード例 #15
0
        public static void GetObjectPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow dataRow = dataTable.Rows[0];

            if (!DBNull.Value.Equals(dataRow["IssueWarningQuota"]))
            {
                Unlimited <ByteQuantifiedSize> unlimited = (Unlimited <ByteQuantifiedSize>)dataRow["IssueWarningQuota"];
                dataRow["IssueWarningQuota"] = MailboxPropertiesHelper.UnlimitedByteQuantifiedSizeToString(unlimited);
            }
            if (!DBNull.Value.Equals(dataRow["ProhibitSendQuota"]))
            {
                Unlimited <ByteQuantifiedSize> unlimited2 = (Unlimited <ByteQuantifiedSize>)dataRow["ProhibitSendQuota"];
                dataRow["ProhibitSendQuota"] = MailboxPropertiesHelper.UnlimitedByteQuantifiedSizeToString(unlimited2);
            }
            if (!DBNull.Value.Equals(dataRow["ProhibitSendReceiveQuota"]))
            {
                Unlimited <ByteQuantifiedSize> unlimited3 = (Unlimited <ByteQuantifiedSize>)dataRow["ProhibitSendReceiveQuota"];
                dataRow["ProhibitSendReceiveQuota"] = MailboxPropertiesHelper.UnlimitedByteQuantifiedSizeToString(unlimited3);
            }
            dataRow["MountStatus"] = ((DDIHelper.IsEmptyValue(dataRow["Mounted"]) || !(bool)dataRow["Mounted"]) ? Strings.StatusDismounted : Strings.StatusMounted);
            if (!DBNull.Value.Equals(dataRow["DeletedItemRetention"]))
            {
                dataRow["DeletedItemRetention"] = ((EnhancedTimeSpan)dataRow["DeletedItemRetention"]).Days.ToString();
            }
            if (!DBNull.Value.Equals(dataRow["MailboxRetention"]))
            {
                dataRow["MailboxRetention"] = ((EnhancedTimeSpan)dataRow["MailboxRetention"]).Days.ToString();
            }
            MailboxDatabase mailboxDatabase = store.GetDataObject("MailboxDatabase") as MailboxDatabase;

            if (mailboxDatabase != null)
            {
                dataRow["Servers"] = mailboxDatabase.Servers;
            }
            if (!DBNull.Value.Equals(dataRow["MaintenanceSchedule"]))
            {
                Schedule schedule = (Schedule)dataRow["MaintenanceSchedule"];
                dataRow["MaintenanceSchedule"] = new ScheduleBuilder(schedule).GetEntireState();
            }
            if (!DBNull.Value.Equals(dataRow["QuotaNotificationSchedule"]))
            {
                Schedule schedule2 = (Schedule)dataRow["QuotaNotificationSchedule"];
                dataRow["QuotaNotificationSchedule"] = new ScheduleBuilder(schedule2).GetEntireState();
            }
        }
コード例 #16
0
        public static void PostGetForSDOActionRule(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow = dataTable.Rows[0];

            if (!DDIHelper.IsEmptyValue(dataRow["Description"]))
            {
                RuleDescription ruleDescription = (RuleDescription)dataRow["Description"];
                dataRow["RuleDescriptionIf"]          = ruleDescription.RuleDescriptionIf;
                dataRow["RuleDescriptionTakeActions"] = ruleDescription.RuleDescriptionTakeActions;
                dataRow["RuleDescriptionExceptIf"]    = ruleDescription.RuleDescriptionExceptIf;
                dataRow["ConditionDescriptions"]      = ruleDescription.ConditionDescriptions.ToArray();
                dataRow["ActionDescriptions"]         = ruleDescription.ActionDescriptions.ToArray();
                dataRow["ExceptionDescriptions"]      = ruleDescription.ExceptionDescriptions.ToArray();
            }
        }
コード例 #17
0
        public static void NewPolicyPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            Hashtable hashtable = new Hashtable();

            if (!DDIHelper.IsEmptyValue(inputRow["ExceptionGroup"]))
            {
                hashtable["exceptionDL"] = ((Identity)inputRow["ExceptionGroup"]).DisplayName;
            }
            if (!DDIHelper.IsEmptyValue(inputRow["IncidentMailbox"]))
            {
                hashtable["IncidentManagementMailBox"] = ((Identity)inputRow["IncidentMailbox"]).DisplayName;
            }
            if (hashtable.Count > 0)
            {
                DataRow dataRow = dataTable.Rows[0];
                dataRow["Parameters"] = hashtable;
                store.ModifiedColumns.Add("Parameters");
            }
        }
コード例 #18
0
ファイル: Antispam.cs プロジェクト: YHZX2013/exchange_diff
        public static void PostGetForSDOActionRule(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow = dataTable.Rows[0];

            if (!DDIHelper.IsEmptyValue(dataRow["Description"]))
            {
                RuleDescription ruleDescription = (RuleDescription)dataRow["Description"];
                dataRow["RuleDescriptionIf"]          = ruleDescription.RuleDescriptionIf;
                dataRow["RuleDescriptionTakeActions"] = ruleDescription.RuleDescriptionTakeActions;
                dataRow["RuleDescriptionExceptIf"]    = ruleDescription.RuleDescriptionExceptIf;
                dataRow["ConditionDescriptions"]      = ruleDescription.ConditionDescriptions.ToArray();
                dataRow["ActionDescriptions"]         = ruleDescription.ActionDescriptions.ToArray();
                dataRow["ExceptionDescriptions"]      = ruleDescription.ExceptionDescriptions.ToArray();
            }
            dataRow["CanToggleESN"] = (!DBNull.Value.Equals(dataRow["RecipientDomainIs"]) && DBNull.Value.Equals(dataRow["SentTo"]) && DBNull.Value.Equals(dataRow["SentToMemberOf"]) && DBNull.Value.Equals(dataRow["ExceptIfSentTo"]) && DBNull.Value.Equals(dataRow["ExceptIfSentToMemberOf"]) && DBNull.Value.Equals(dataRow["ExceptIfRecipientDomainIs"]));
        }
コード例 #19
0
        public static void GetListPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            bool     flag     = !DDIHelper.IsEmptyValue(inputRow["NoSipDialPlans"]) && (bool)inputRow["NoSipDialPlans"];
            Identity identity = inputRow["NoSipDialPlansExcludeId"] as Identity;

            if (flag)
            {
                List <DataRow> list = new List <DataRow>();
                foreach (object obj in dataTable.Rows)
                {
                    DataRow dataRow = (DataRow)obj;
                    if ((UMUriType)dataRow["URIType"] == UMUriType.SipName && !((ADObjectId)dataRow["Identity"]).ToIdentity().Equals(identity))
                    {
                        list.Add(dataRow);
                    }
                }
                list.ForEach(delegate(DataRow x)
                {
                    x.Delete();
                });
            }
        }
コード例 #20
0
        private void UpdateTable(string targetConfigObject, bool fillAllColumns)
        {
            object dataObject = base.DataObjectStore.GetDataObject(targetConfigObject);

            if (dataObject == null)
            {
                return;
            }
            foreach (object obj in base.Table.Columns)
            {
                DataColumn dataColumn = (DataColumn)obj;
                Variable   variable   = dataColumn.ExtendedProperties["Variable"] as Variable;
                if (variable != null && variable.DataObjectName != null && (fillAllColumns || targetConfigObject.Equals(variable.DataObjectName, StringComparison.OrdinalIgnoreCase)))
                {
                    object obj2 = variable.PersistWholeObject ? dataObject : base.DataObjectStore.GetValue(targetConfigObject, variable.MappingProperty);
                    obj2 = (obj2 ?? DBNull.Value);
                    if (!this.IsGetObjectForNew || !DDIHelper.IsEmptyValue(obj2))
                    {
                        base.Row[dataColumn.ColumnName] = obj2;
                    }
                }
            }
        }
コード例 #21
0
        public static void GetListPreAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            ExDateTime now    = ExDateTime.Now;
            ExDateTime value  = ExDateTime.Create(EcpDateTimeHelper.GetCurrentUserTimeZone(), (DateTime)now.ToUserExDateTime()).First <ExDateTime>();
            TimeSpan   value2 = now.Subtract(value);

            if (!DDIHelper.IsEmptyValue(inputrow["ReceivedFilter"]))
            {
                string     text = inputrow["ReceivedFilter"].ToStringWithNull();
                string     a;
                ExDateTime exDateTime;
                ExDateTime exDateTime2;
                if ((a = text) != null)
                {
                    if (a == "2d")
                    {
                        exDateTime  = value.Date.AddDays(-2.0);
                        exDateTime2 = value.Date;
                        goto IL_13A;
                    }
                    if (a == "7d")
                    {
                        exDateTime  = value.Date.AddDays(-7.0);
                        exDateTime2 = value.Date;
                        goto IL_13A;
                    }
                    if (a == "custom")
                    {
                        exDateTime  = ExDateTime.ParseExact(inputrow["ReceivedStartDateFilter"].ToString(), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
                        exDateTime2 = ExDateTime.ParseExact(inputrow["ReceivedEndDateFilter"].ToString(), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
                        goto IL_13A;
                    }
                }
                exDateTime  = value.Date;
                exDateTime2 = value.Date.AddDays(-1.0);
IL_13A:
                inputrow["ReceivedStartDateFilter"] = exDateTime.Add(value2);
                inputrow["ReceivedEndDateFilter"]   = exDateTime2.Add(value2);
            }
            else
            {
                inputrow["ReceivedStartDateFilter"] = DBNull.Value;
                inputrow["ReceivedEndDateFilter"]   = DBNull.Value;
            }
            store.ModifiedColumns.Add("ReceivedStartDateFilter");
            store.ModifiedColumns.Add("ReceivedEndDateFilter");
            if (!DDIHelper.IsEmptyValue(inputrow["ExpiresFilter"]))
            {
                string     text2 = inputrow["ExpiresFilter"].ToStringWithNull();
                string     a2;
                ExDateTime exDateTime3;
                ExDateTime exDateTime4;
                if ((a2 = text2) != null)
                {
                    if (a2 == "2d")
                    {
                        exDateTime3 = value.Date;
                        exDateTime4 = value.Date.AddDays(2.0);
                        goto IL_2C5;
                    }
                    if (a2 == "7d")
                    {
                        exDateTime3 = value.Date;
                        exDateTime4 = value.Date.AddDays(7.0);
                        goto IL_2C5;
                    }
                    if (a2 == "custom")
                    {
                        exDateTime3 = ExDateTime.ParseExact(inputrow["ExpiresStartDateFilter"].ToString(), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
                        exDateTime4 = ExDateTime.ParseExact(inputrow["ExpiresEndDateFilter"].ToString(), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
                        goto IL_2C5;
                    }
                }
                exDateTime3 = value.Date;
                exDateTime4 = value.Date.AddDays(1.0);
IL_2C5:
                inputrow["ExpiresStartDateFilter"] = exDateTime3.Add(value2);
                inputrow["ExpiresEndDateFilter"]   = exDateTime4.Add(value2);
            }
            else
            {
                inputrow["ExpiresStartDateFilter"] = DBNull.Value;
                inputrow["ExpiresEndDateFilter"]   = DBNull.Value;
            }
            store.ModifiedColumns.Add("ExpiresStartDateFilter");
            store.ModifiedColumns.Add("ExpiresEndDateFilter");
        }