Example #1
0
        private void CreateEditAccessControlListControls(AccessControlList[] accessControlLists)
        {
            var resourceManager = GlobalizationService.GetResourceManager(typeof(ResourceIdentifier));

            AccessControlListsPlaceHolder.Controls.Clear();
            PlaceHolder statelessAccessControlListsPlaceHolder = new PlaceHolder();

            AccessControlListsPlaceHolder.Controls.Add(statelessAccessControlListsPlaceHolder);

            PlaceHolder statefulAccessControlListsPlaceHolder = new PlaceHolder();

            AccessControlListsPlaceHolder.Controls.Add(statefulAccessControlListsPlaceHolder);

            _editAccessControlListControls.Clear();
            for (int i = 0; i < accessControlLists.Length; i++)
            {
                var accessControlList = accessControlLists[i];

                string controlName = string.Format("Edit{0}Control.ascx", accessControlList.GetPublicDomainObjectType().Name);

                var editAccessControlListControlBase = (EditAccessControlListControlBase)LoadControl(controlName);
                editAccessControlListControlBase.ID             = "Acl_" + i;
                editAccessControlListControlBase.BusinessObject = accessControlList;
                editAccessControlListControlBase.Delete        += EditAccessControlListControl_Delete;

                UpdatePanel updatePanel = new UpdatePanel();
                updatePanel.ID         = "UpdatePanel_" + i;
                updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;

                var div = new HtmlGenericControl("div");
                div.Attributes.Add("class", "accessControlListContainer");
                div.Controls.Add(editAccessControlListControlBase);
                updatePanel.ContentTemplateContainer.Controls.Add(div);

                if (editAccessControlListControlBase is EditStatelessAccessControlListControl)
                {
                    if (statelessAccessControlListsPlaceHolder.Controls.Count == 0)
                    {
                        statelessAccessControlListsPlaceHolder.Controls.Add(
                            CreateAccessControlListTitle(resourceManager.GetString(ResourceIdentifier.StatelessAccessControlListTitle)));
                    }
                    statelessAccessControlListsPlaceHolder.Controls.Add(updatePanel);
                }
                else if (editAccessControlListControlBase is EditStatefulAccessControlListControl)
                {
                    if (statefulAccessControlListsPlaceHolder.Controls.Count == 0)
                    {
                        statefulAccessControlListsPlaceHolder.Controls.Add(
                            CreateAccessControlListTitle(resourceManager.GetString(ResourceIdentifier.StatefulAccessControlListsTitle)));
                    }
                    statefulAccessControlListsPlaceHolder.Controls.Add(updatePanel);
                }
                else
                {
                    throw new InvalidOperationException(string.Format("Control-type '{0}' is not supported.", editAccessControlListControlBase.GetType()));
                }

                _editAccessControlListControls.Add(editAccessControlListControlBase);
            }
        }
Example #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <SpyShopConfig>(Configuration.GetSection("SpyShopConfig"));

            services.AddDbContext <SpyShopContext>(options =>
                                                   options.UseSqlServer(Configuration.GetConnectionString("SpyShopDb")));

            //Register repositories, so IRepository can be injected
            services.AddTransient <IRepository <Product, long>, EfRepository <Product, long> >();
            services.AddTransient <IRepository <Category, long>, EfRepository <Category, long> >();

            services.TryAddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddTransient <ICartService, CookieCartService>();

            //Configure request localization
            services.Configure <RequestLocalizationOptions>(options =>
            {
                var globalizationService      = new GlobalizationService(env);
                var supportedCultures         = globalizationService.GetSupportedCldrLocales();
                options.DefaultRequestCulture = new RequestCulture(globalizationService.GetFallbackCulture());
                options.SupportedCultures     = supportedCultures;
                options.SupportedUICultures   = supportedCultures;
            });

            services.AddMvc();
        }
Example #3
0
        protected override void OnPreRender(EventArgs e)
        {
            var resourceManager = GlobalizationService.GetResourceManager(typeof(ResourceIdentifier));

            DuplicateStateCombinationsValidator.ErrorMessage = resourceManager.GetString(
                ResourceIdentifier.DuplicateStateCombinationsValidatorErrorMessage);

            NewStatefulAccessControlListButton.Text = resourceManager.GetString(
                ResourceIdentifier.NewStatefulAccessControlListButtonText);

            NewStatelessAccessControlListButton.Text = resourceManager.GetString(
                ResourceIdentifier.NewStatelessAccessControlListButtonText);

            SaveButton.Text   = GlobalResourcesHelper.GetString(GlobalResources.Save);
            CancelButton.Text = GlobalResourcesHelper.GetString(GlobalResources.Cancel);

            base.OnPreRender(e);

            EnableNewAccessControlListButton();

            HtmlHeadAppender.Current.RegisterUtilitiesJavaScriptInclude();
            var url = ResourceUrlFactory.CreateResourceUrl(typeof(EditPermissionsForm), ResourceType.Html, "EditPermissionsForm.js");

            HtmlHeadAppender.Current.RegisterJavaScriptInclude(GetType().FullName + "_script", url);
        }
Example #4
0
        public void ToStringExactGetRelativeText()
        {
            NhsDate date = new NhsDate(System.DateTime.Today);

            GlobalizationService gc = new GlobalizationService();

            // Today works
            Assert.AreEqual(NhsCui.Toolkit.Test.NhsCui_Toolkit_DateAndTime_Resources_NhsDateResourcesAccessor.Today, date.ToString(false, false, true, CultureInfo.CurrentCulture), "RelativeText of Today is not working");

            date.DateValue = DateTime.Today.AddDays(1);

            Assert.AreEqual(NhsCui.Toolkit.Test.NhsCui_Toolkit_DateAndTime_Resources_NhsDateResourcesAccessor.Tomorrow, date.ToString(false, false, true, CultureInfo.CurrentCulture), "RelativeText of Tomorrow is not working");

            date.DateValue = DateTime.Today.AddDays(-1);

            Assert.AreEqual(NhsCui.Toolkit.Test.NhsCui_Toolkit_DateAndTime_Resources_NhsDateResourcesAccessor.Yesterday, date.ToString(false, false, true, CultureInfo.CurrentCulture), "RelativeText of Yesterday is not working");

            // Check the "Who Wins condition when "Show Day of Week" and "Show Relative Text" are both true
            Assert.AreEqual(NhsCui.Toolkit.Test.NhsCui_Toolkit_DateAndTime_Resources_NhsDateResourcesAccessor.Yesterday, date.ToString(true, false, true, CultureInfo.CurrentCulture), "When includeDayOfWeek, showRelativeText are both true, showRelativeText should win. It is not");

            DateTime testDate = new DateTime(1974, 3, 26);

            date.DateValue = testDate;

            Assert.AreEqual(testDate.ToString(gc.ShortDatePattern, CultureInfo.CurrentCulture), date.ToString(), "Check that default for 'include day of week' flag is correct");

            // try with includeDayOfWeek flag

            Assert.AreEqual(testDate.ToString(gc.ShortDatePatternWithDayOfWeek, CultureInfo.CurrentCulture), date.ToString(true), "Check that default for 'include day of week' flag is correct");
        }
Example #5
0
        protected override void OnPreRenderComplete(EventArgs e)
        {
            var title = GlobalizationService.GetResourceManager(typeof(ResourceIdentifier)).GetString(ResourceIdentifier.Title);

            HtmlHeadAppender.Current.SetTitle(title);
            base.OnPreRenderComplete(e);
        }
        public void SetUp()
        {
            _resourceManagerStub           = MockRepository.GenerateStub <IResourceManager>();
            _resolvedResourceManagerResult = ResolvedResourceManagerResult.Create(_resourceManagerStub, NullResourceManager.Instance);

            _resolverStub         = MockRepository.GenerateStub <IResourceManagerResolver>();
            _globalizationService = new GlobalizationService(_resolverStub);
        }
Example #7
0
        protected override void OnPreRender(EventArgs e)
        {
            Title             = GlobalizationService.GetResourceManager(typeof(ResourceIdentifier)).GetString(ResourceIdentifier.Title);
            SaveButton.Text   = GlobalResourcesHelper.GetString(GlobalResources.Save);
            CancelButton.Text = GlobalResourcesHelper.GetString(GlobalResources.Cancel);

            base.OnPreRender(e);
        }
Example #8
0
        protected override void OnPreRenderComplete(EventArgs e)
        {
            string title = string.Format(
                GlobalizationService.GetResourceManager(typeof(ResourceIdentifier)).GetString(ResourceIdentifier.Title),
                CurrentSecurableClassDefinition.DisplayName);

            TitleLabel.InnerText = title;
            HtmlHeadAppender.Current.SetTitle(title);
            base.OnPreRenderComplete(e);
        }
Example #9
0
        private void InitializeMockList()
        {
            List = MockRepository.GenerateMock <IBocList>();

            List.Stub(list => list.ClientID).Return("MyList");
            List.Stub(mock => mock.ControlType).Return("BocList");
            List.Stub(list => list.HasClientScript).Return(true);

            List.Stub(list => list.DataSource).Return(MockRepository.GenerateStub <IBusinessObjectDataSource>());
            List.DataSource.BusinessObject = BusinessObject;
            List.Stub(list => list.Property).Return(BusinessObject.BusinessObjectClass.GetPropertyDefinition("ReferenceList"));

            var value = ((TypeWithReference)BusinessObject).ReferenceList;

            List.Stub(list => list.Value).Return(value);
            List.Stub(list => list.HasValue).Return(value != null && value.Length > 0);

            var listMenuStub = MockRepository.GenerateStub <IListMenu>();

            List.Stub(list => list.ListMenu).Return(listMenuStub);

            StateBag stateBag = new StateBag();

            List.Stub(mock => mock.Attributes).Return(new AttributeCollection(stateBag));
            List.Stub(mock => mock.Style).Return(List.Attributes.CssStyle);
            List.Stub(mock => mock.ControlStyle).Return(new Style(stateBag));

            var page = MockRepository.GenerateMock <IPage>();

            page.Stub(stub => page.Context).Return(HttpContext);
            List.Stub(list => list.Page).Return(page);

            var clientScriptManager = MockRepository.GenerateMock <IClientScriptManager>();

            page.Stub(pageMock => pageMock.ClientScript).Return(clientScriptManager);

            clientScriptManager.Stub(scriptManagerMock => scriptManagerMock.GetPostBackEventReference((IControl)null, ""))
            .IgnoreArguments().Return("postBackEventReference");

            clientScriptManager.Stub(scriptManagerMock => scriptManagerMock.GetPostBackEventReference((PostBackOptions)null))
            .IgnoreArguments().Return("postBackEventReference");

            var editModeController = MockRepository.GenerateMock <IEditModeController>();

            List.Stub(list => list.EditModeController).Return(editModeController);

            List.Stub(stub => stub.GetSelectorControlName()).Return("SelectRowControl$UnqiueID");
            List.Stub(stub => stub.GetSelectAllControlName()).Return("SelectAllControl$UniqueID");
            List.Stub(stub => stub.GetCurrentPageControlName()).Return("CurrentPageControl$UniqueID"); // Keep the $-sign as long as the ScalarLoadPostDataTarget is used.

            List.Stub(list => list.GetResourceManager()).Return(
                GlobalizationService.GetResourceManager(typeof(ObjectBinding.Web.UI.Controls.BocList.ResourceIdentifier)));

            List.Stub(stub => stub.ResolveClientUrl(null)).IgnoreArguments().Do((Func <string, string>)(url => url.TrimStart('~')));
        }
Example #10
0
        public void GetCurrencySymbol_WhenRegionNameIsInvalid_ShouldReturnEmptyString(string name)
        {
            // Arrange
            var service = new GlobalizationService();

            // Act
            string currencySymbol = service.GetCurrencySymbol(name);

            // Assert
            currencySymbol.ShouldBeEmpty();
        }
Example #11
0
        public void ParseWithAMPMDesignator()
        {
            GlobalizationService gs  = new GlobalizationService();
            DateTime             now = DateTime.Now;
            string  formattedTime    = now.ToString(gs.ShortTimePatternWithSecondsAMPM, CultureInfo.CurrentCulture);
            NhsTime time             = NhsTime.ParseExact(formattedTime, CultureInfo.CurrentCulture);

            Assert.AreEqual <int>(now.Hour, time.TimeValue.Hour, "Parse failed to set hours with am/pm designator");
            Assert.AreEqual <int>(now.Minute, time.TimeValue.Minute, "Parse failed to set minutes with am/pm designator");
            Assert.AreEqual <int>(now.Second, time.TimeValue.Second, "Parse failed to set seconds with am/pm designator");
        }
Example #12
0
        public void GetCurrencySymbol_WhenRegionNameIsValid_ShouldReturnProperCurrencySymbol(string name, string expectedCurrencySymbol)
        {
            // Arrange
            var service = new GlobalizationService();

            // Act
            string currencySymbol = service.GetCurrencySymbol(name);

            // Assert
            currencySymbol.ShouldBe(expectedCurrencySymbol);
        }
Example #13
0
        /// <summary> Find the <see cref="IResourceManager"/> for this control. </summary>
        /// <param name="localResourcesType">
        ///   A type with the <see cref="MultiLingualResourcesAttribute"/> applied to it. Typically an <b>enum</b> or the derived class itself.
        /// </param>
        /// <returns>An <see cref="IResourceManager"/> from which all resources for this control can be obtained.</returns>
        protected IResourceManager GetResourceManager(Type localResourcesType)
        {
            ArgumentUtility.CheckNotNull("localResourcesType", localResourcesType);

            return(_resourceManagerCache.GetOrCreateValue(
                       Tuple.Create(localResourcesType, NamingContainer),
                       key =>
            {
                var localResourceManager = GlobalizationService.GetResourceManager(localResourcesType);
                var namingContainerResourceManager = ResourceManagerUtility.GetResourceManager(NamingContainer, true);

                return ResourceManagerSet.Create(namingContainerResourceManager, localResourceManager);
            }));
        }
Example #14
0
        public void TryValidateRegion_WhenRegionNameValid_ShouldReturnTrue(string name)
        {
            // Arrange
            var service = new GlobalizationService();

            // Act
            bool result = service.TryValidateRegion(name, out var output);

            // Assert
            this.ShouldSatisfyAllConditions(
                () =>
            {
                result.ShouldBeTrue();
                output.ShouldNotBeNull();
            });
        }
Example #15
0
        /// <summary>
        ///   Find the <see cref="IResourceManager"/> for this <see cref="ValidationStateViewer"/>.
        /// </summary>
        /// <returns></returns>
        protected IResourceManager GetResourceManager()
        {
            //  Provider has already been identified.
            if (_cachedResourceManager != null)
            {
                return(_cachedResourceManager);
            }

            //  Get the resource managers

            IResourceManager localResourceManager           = GlobalizationService.GetResourceManager(typeof(ResourceIdentifier));
            IResourceManager namingContainerResourceManager = ResourceManagerUtility.GetResourceManager(NamingContainer, true);

            _cachedResourceManager = ResourceManagerSet.Create(namingContainerResourceManager, localResourceManager);

            return(_cachedResourceManager);
        }
Example #16
0
        public void ToStringApproximate()
        {
            DateTime             baseDateTime = System.DateTime.Now;
            GlobalizationService gc           = new GlobalizationService();

            NhsTime time = new NhsTime(baseDateTime, true);

            Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, "{0} {1}", NhsCui.Toolkit.Test.NhsCui_Toolkit_DateAndTime_Resources_NhsTimeResourcesAccessor.Approximate, baseDateTime.ToString(gc.ShortTimePattern, CultureInfo.CurrentCulture)), time.ToString());

            Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, "{0} {1}", NhsCui.Toolkit.Test.NhsCui_Toolkit_DateAndTime_Resources_NhsTimeResourcesAccessor.Approximate, baseDateTime.ToString(gc.ShortTimePattern, CultureInfo.CurrentCulture)), time.ToString(true));

            time = new NhsTime(baseDateTime);

            time.TimeType = TimeType.Approximate;

            Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, "{0} {1}", NhsCui.Toolkit.Test.NhsCui_Toolkit_DateAndTime_Resources_NhsTimeResourcesAccessor.Approximate, baseDateTime.ToString(gc.ShortTimePattern, CultureInfo.CurrentCulture)), time.ToString());

            Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, "{0} {1}", NhsCui.Toolkit.Test.NhsCui_Toolkit_DateAndTime_Resources_NhsTimeResourcesAccessor.Approximate, baseDateTime.ToString(gc.ShortTimePattern, CultureInfo.CurrentCulture)), time.ToString(true));
        }
Example #17
0
        /// <summary> Find the <see cref="IResourceManager"/> for this control info. </summary>
        /// <param name="localResourcesType">
        ///   A type with the <see cref="MultiLingualResourcesAttribute"/> applied to it.
        ///   Typically an <b>enum</b> or the derived class itself.
        /// </param>
        protected IResourceManager GetResourceManager(Type localResourcesType)
        {
            ArgumentUtility.CheckNotNull("localResourcesType", localResourcesType);

            //  Provider has already been identified.
            if (_cachedResourceManager != null)
            {
                return(_cachedResourceManager);
            }

            //  Get the resource managers

            var localResourceManager = GlobalizationService.GetResourceManager(localResourcesType);
            var pageResourceManager  = ResourceManagerUtility.GetResourceManager(_page.WrappedInstance, true);

            _cachedResourceManager = ResourceManagerSet.Create(pageResourceManager, localResourceManager);

            return(_cachedResourceManager);
        }
Example #18
0
        /// <summary> Find the <see cref="IResourceManager"/> for this control. </summary>
        /// <param name="localResourcesType">
        ///   A type with the <see cref="MultiLingualResourcesAttribute"/> applied to it.
        ///   Typically an <b>enum</b> or the derived class itself.
        /// </param>
        protected IResourceManager GetResourceManager(Type localResourcesType)
        {
            //Remotion.Utilities.ArgumentUtility.CheckNotNull ("localResourcesType", localResourcesType);

            //  Provider has already been identified.
            if (_cachedResourceManager != null)
            {
                return(_cachedResourceManager);
            }

            //  Get the resource managers

            var localResourceManager           = GlobalizationService.GetResourceManager(localResourcesType);
            var namingContainerResourceManager = ResourceManagerUtility.GetResourceManager(NamingContainer, true);

            _cachedResourceManager = ResourceManagerSet.Create(namingContainerResourceManager, localResourceManager);

            return(_cachedResourceManager);
        }
Example #19
0
        /// <summary>
        /// Parses a string that represents a time.
        /// </summary>
        /// <param name="time">A string containing the value to be parsed. </param>
        /// <param name="result">A container for a successfully-parsed time. </param>
        /// <param name="cultureInfo">The culture that should be used to parse the string. If a string is culture-agnostic, 
        /// this should be CultureInfo.InvariantCulture. Defaults to CurrentCulture.</param>
        /// <returns>True if time string was successfully parsed; otherwise, false. </returns>
        /// <remarks>If the string be parsed, the result parameter is set to a CuiTime object corresponding to the parsed timeString.
        /// If the time string cannot be parsed, the result parameter is set to DateTime.MinValue. </remarks>
        public static bool TryParseExact(string time, out CuiTime result, IFormatProvider cultureInfo)
        {
            result = null;

            // check for true null
            if (string.IsNullOrEmpty(time))
            {
                result = new CuiTime();
                result.TimeType = TimeType.Null;
                return true;
            }

            bool approxIndicatorPresent = false;

            // first check to see if approx indicator is present
            if (time.IndexOf(Resources.CuiTimeResources.Approximate, StringComparison.CurrentCultureIgnoreCase) >= 0)
            {
                time = time.Replace(Resources.CuiTimeResources.Approximate, string.Empty).Trim();
                approxIndicatorPresent = true;
            }

            DateTime parsedDateTime;

            // try standard datetime parse with our custom formats
            GlobalizationService gs = new GlobalizationService();
            string[] formats = new string[] 
                               {
                                   gs.ShortTimePattern,
                                   gs.ShortTimePatternWithSeconds,
                                   gs.ShortTimePatternAMPM,
                                   gs.ShortTimePatternWithSecondsAMPM,
                                   gs.ShortTimePattern12Hour,
                                   gs.ShortTimePatternWithSeconds12Hour,
                                   gs.ShortTimePattern12HourAMPM,
                                   gs.ShortTimePatternWithSeconds12HourAMPM
                               };

            if (DateTime.TryParseExact(time, formats, cultureInfo, DateTimeStyles.None, out parsedDateTime))
            {
                result = new CuiTime(parsedDateTime, approxIndicatorPresent);
                return true;
            }

            if (!approxIndicatorPresent)
            {
                // Check if 'time' is a Null time
                Regex nullTimeRegEx = new Regex(@"^Null:(?<Index>-?\d+)$", RegexOptions.IgnoreCase);

                Match match = nullTimeRegEx.Match(time);

                if (match.Success == true)
                {
                    // Pull the numeric Index text and see if it is in range
                    int nullIndex;

                    if (int.TryParse(match.Groups[1].Captures[0].Value, out nullIndex) == true)
                    {
                        if (nullIndex >= MinimumNullIndex && nullIndex <= MaximumNullIndex)
                        {
                            result = new CuiTime();

                            result.NullIndex = nullIndex;
                            result.TimeType = TimeType.NullIndex;
                            return true;
                        }
                    }
                }
            }

            return false;
        }
Example #20
0
        /// <summary>
        /// Gets the time format to use from the supplied globalization service.
        /// </summary>
        /// <param name="gs">Globalization service to get format from.</param>
        /// <param name="displaySeconds">Whether to display seconds.</param>
        /// <param name="display12Hour">Whether to use 12 hour or 24 hour clock.</param>
        /// <param name="displayAMPM">Whether to display am / pm indicator.</param>
        /// <returns>Time format.</returns>
        public static string GetTimeFormat(GlobalizationService gs, bool displaySeconds, bool display12Hour, bool displayAMPM)
        {
            string format;

            if (displaySeconds)
            {
                if (display12Hour)
                {
                    format = displayAMPM ? gs.ShortTimePatternWithSeconds12HourAMPM :
                                            gs.ShortTimePatternWithSeconds12Hour;
                }
                else
                {
                    format = displayAMPM ? gs.ShortTimePatternWithSecondsAMPM :
                                            gs.ShortTimePatternWithSeconds;
                }
            }
            else
            {
                if (display12Hour)
                {
                    format = displayAMPM ? gs.ShortTimePattern12HourAMPM :
                                            gs.ShortTimePattern12Hour;
                }
                else
                {
                    format = displayAMPM ? gs.ShortTimePatternAMPM :
                                            gs.ShortTimePattern;
                }
            }

            return format;
        }
Example #21
0
        protected IResourceManager GetResourceManager(Type resourceEnumType)
        {
            ArgumentUtility.CheckNotNullAndTypeIsAssignableFrom("resourceEnumType", resourceEnumType, typeof(Enum));

            return(ResourceManagerSet.Create(GlobalizationService.GetResourceManager(TypeAdapter.Create(resourceEnumType)), GetResourceManager()));
        }
Example #22
0
        protected virtual IResourceManager GetResourceManager()
        {
            Type type = this.GetType();

            return(GlobalizationService.GetResourceManager(type));
        }
Example #23
0
        public virtual IResourceManager GetResourceManager()
        {
            Type type = GetType();

            return(GlobalizationService.GetResourceManager(type));
        }
Example #24
0
        public string ToString(bool approximate, CultureInfo cultureInfo, bool displaySeconds, bool display12Hour, bool displayAMPM)
        {
            if (approximate && this.TimeType != TimeType.Approximate)
            {
                // This is invalid. You cannot make use of the indicateWhenApproximate flag when the 
                // TimeType is not Approximate
                throw new ArgumentOutOfRangeException("approximate", Resources.CuiTimeResources.ShowApproxIndicatorInvalidForTimeType);
            }

            string formattedTime;

            switch (this.TimeType)
            {
                case TimeType.Exact:
                case TimeType.Approximate:
                    GlobalizationService gs = new GlobalizationService();

                    // we never return a string such as "14:04 (pm)"
                    bool reallyDisplayAMPM = displayAMPM && (display12Hour || this.TimeValue.TimeOfDay.Hours < 12);

                    string format = GetTimeFormat(gs, displaySeconds, display12Hour, reallyDisplayAMPM);

                    formattedTime = this.timeValue.ToString(format, cultureInfo);

                    if (reallyDisplayAMPM)
                    {
                        // make am / pm lowercase
                        formattedTime = formattedTime.ToLower(cultureInfo);
                    }

                    if (approximate)
                    {
                        // prepend "Approx" indicator
                        formattedTime = string.Format(
                                            cultureInfo,
                                            Resources.CuiTimeResources.ApproximateTimeFormat,
                                            Resources.CuiTimeResources.Approximate,
                                            formattedTime);
                    }

                    break;

                case TimeType.NullIndex:
                    formattedTime = string.Format(cultureInfo, "Null:{0}", this.NullIndex);
                    break;

                case TimeType.Null:
                    formattedTime = string.Empty;
                    break;

                default:
                    throw new InvalidOperationException();
            }

            return formattedTime;
        }
Example #25
0
        protected override void OnPreRender(EventArgs e)
        {
            Title = GlobalizationService.GetResourceManager(typeof(ResourceIdentifier)).GetString(ResourceIdentifier.Title);

            base.OnPreRender(e);
        }