Beispiel #1
0
        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);
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
 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);
 }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        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);
        }
Beispiel #7
0
 public static string ToLastMonth()
 {
     return(ExDateTime.GetNow(EcpDateTimeHelper.GetCurrentUserTimeZone()).AddMonths(-1).ToString(Strings.LastMonthFormat));
 }