public static ExDateTime?ToEcpExDateTime(this string dateTimeString, string parseFormat) { if (dateTimeString.IsNullOrBlank()) { return(null); } ExDateTime?result; try { if (EacRbacPrincipal.Instance.UserTimeZone != null) { result = new ExDateTime?(ExDateTime.ParseExact(EacRbacPrincipal.Instance.UserTimeZone, dateTimeString, parseFormat, CultureInfo.InvariantCulture)); } else { int browserTimeZoneOffsetMinutes = EcpDateTimeHelper.GetBrowserTimeZoneOffsetMinutes(); result = new ExDateTime?(ExDateTime.ParseExact(ExTimeZone.UtcTimeZone, dateTimeString, parseFormat, CultureInfo.InvariantCulture).AddMinutes((double)browserTimeZoneOffsetMinutes)); } } catch (FormatException ex) { ExTraceGlobals.EventLogTracer.TraceError <string, string>(0, 0L, "Fail to parse the date time string: {0}. Got the exception of '{1}'.", dateTimeString, ex.Message); result = null; } return(result); }
public PowerShellResults <InboxRule> GetObject(Identity identity) { PSCommand pscommand = new PSCommand().AddCommand("Get-InboxRule"); pscommand.AddParameter("DescriptionTimeFormat", EcpDateTimeHelper.GetWeekdayDateFormat(true)); pscommand.AddParameter("DescriptionTimeZone", RbacPrincipal.Current.UserTimeZone); return(base.GetObject <InboxRule>(pscommand, identity)); }
public UMAAHolidaySchedule(HolidaySchedule holiday) { this.Name = holiday.Name; this.GreetingFileName = holiday.Greeting; this.StartDate = holiday.StartDate.ToString("yyyy/MM/dd", CultureInfo.InvariantCulture); this.EndDate = holiday.EndDate.ToString("yyyy/MM/dd", CultureInfo.InvariantCulture); this.StartDateDisplay = holiday.StartDate.ToString(EcpDateTimeHelper.GetUserDateFormat(), CultureInfo.CurrentCulture); this.EndDateDisplay = holiday.EndDate.ToString(EcpDateTimeHelper.GetUserDateFormat(), CultureInfo.CurrentCulture); }
public static string ToUserWeekdayDateString(this ExDateTime?exDateTimeValue) { if (exDateTimeValue == null) { return(string.Empty); } CultureInfo currentCulture = CultureInfo.CurrentCulture; return(exDateTimeValue.Value.ToUserExDateTime().ToString(EcpDateTimeHelper.GetWeekdayDateFormat(true), currentCulture)); }
public static ExDateTime ToUserExDateTime(this ExDateTime dateTimeValue) { if (EacRbacPrincipal.Instance.UserTimeZone != null) { return(EacRbacPrincipal.Instance.UserTimeZone.ConvertDateTime(dateTimeValue)); } int browserTimeZoneOffsetMinutes = EcpDateTimeHelper.GetBrowserTimeZoneOffsetMinutes(); return(dateTimeValue.ToUtc().AddMinutes((double)(-(double)browserTimeZoneOffsetMinutes))); }
protected override ScriptControlDescriptor GetScriptDescriptor() { ScriptControlDescriptor scriptDescriptor = base.GetScriptDescriptor(); scriptDescriptor.Type = "UMHolidayScheduleProperties"; scriptDescriptor.AddComponentProperty("HolidayPromptUploader", base.ContentContainer.FindControl("auGreetingFile").ClientID); scriptDescriptor.AddComponentProperty("StartDateChooser", base.ContentContainer.FindControl("dcStartDate").ClientID); scriptDescriptor.AddComponentProperty("EndDateChooser", base.ContentContainer.FindControl("dcEndDate").ClientID); scriptDescriptor.AddElementProperty("Name", base.ContentContainer.FindControl("txtName").ClientID); scriptDescriptor.AddElementProperty("StartDateForDisplay", base.ContentContainer.FindControl("txtStartDateDisplay").ClientID); scriptDescriptor.AddElementProperty("EndDateForDisplay", base.ContentContainer.FindControl("txtEndDateDisplay").ClientID); scriptDescriptor.AddProperty("UserDateFormat", EcpDateTimeHelper.GetUserDateFormat()); scriptDescriptor.AddProperty("TodaysDate", ExDateTime.Now.ToUserExDateTime().ToString("yyyy/MM/dd", CultureInfo.InvariantCulture)); return(scriptDescriptor); }
public static string ToLastMonth() { return(ExDateTime.GetNow(EcpDateTimeHelper.GetCurrentUserTimeZone()).AddMonths(-1).ToString(Strings.LastMonthFormat)); }