private static void AggregateData(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DLPPolicyReportingService dlppolicyReportingService = new DLPPolicyReportingService(); PowerShellResults <MailTrafficPolicyReport> dlptrafficData = dlppolicyReportingService.GetDLPTrafficData(new DLPPolicyTrafficReportParameters { StartDate = new DateTime?((DateTime)ExDateTime.GetNow(EcpDateTimeHelper.GetCurrentUserTimeZone()).Subtract(new TimeSpan(48, 0, 0)).ToUtc()), EndDate = new DateTime?((DateTime)ExDateTime.GetNow(EcpDateTimeHelper.GetCurrentUserTimeZone()).ToUtc()), EventType = "DlpPolicyHits,DlpPolicyOverride,DlpPolicyFalsePositive", Direction = "Outbound" }); if (dlptrafficData != null && dlptrafficData.Output != null) { IEnumerable <MailTrafficPolicyReport> source = from d in dlptrafficData.Output orderby d.Date.Date descending, d.Date.Hour descending select d; IEnumerable <MailTrafficPolicyReport> reportData = source.Take(24); IEnumerable <MailTrafficPolicyReport> trendData = source.Skip(24); foreach (object obj in dataTable.Rows) { DataRow row = (DataRow)obj; DLPPolicy.CalcuatePolicyData(row, "Name", "Hits", "HitsTrend", "DlpPolicyHits", reportData, trendData); DLPPolicy.CalcuatePolicyData(row, "Name", "Overrides", "OverridesTrend", "DlpPolicyOverride", reportData, trendData); DLPPolicy.CalcuatePolicyData(row, "Name", "FalsePositives", "FalsePositivesTrend", "DlpPolicyFalsePositive", reportData, trendData); } } }
protected override void BuildScriptDescriptor(ScriptComponentDescriptor descriptor) { base.BuildScriptDescriptor(descriptor); descriptor.AddElementProperty("DdlYear", this.DdlYearID, this); descriptor.AddElementProperty("DdlMonth", this.DdlMonthID, this); descriptor.AddElementProperty("DdlDay", this.DdlDayID, this); descriptor.AddProperty("UserDateFormat", EcpDateTimeHelper.GetUserDateFormat()); }
public static string ToUserDateTime(object value) { if (value == null) { return(string.Empty); } string result; try { ExDateTime dateTimeValue = new ExDateTime(EcpDateTimeHelper.GetCurrentUserTimeZone(), (DateTime)value); result = dateTimeValue.ToUserDateTimeString(); } catch { result = string.Empty; } return(result); }
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"); }