Пример #1
0
 void DisplayLink.SetInitialDisplay(PostBackValueDictionary formControlValues)
 {
     if (getControlsToggled(controlsToggledHiddenFieldValueGetter(formControlValues)))
     {
         if (textControl != null)
         {
             if (getAlternateText().Any())
             {
                 textControl.Controls.Clear();
                 textControl.Controls.Add(getAlternateText().GetLiteralControl());
             }
             else
             {
                 this.SetInitialDisplay(false);
             }
         }
         foreach (var webControl in controlsToToggle)
         {
             if (toggleClasses != null)
             {
                 foreach (var i in toggleClasses)
                 {
                     webControl.CssClass = webControl.CssClass.Contains(i) ? webControl.CssClass.Replace(i, "") : webControl.CssClass.ConcatenateWithSpace(i);
                 }
             }
             else
             {
                 webControl.ToggleInitialDisplay();
             }
         }
     }
 }
Пример #2
0
        private static void linkFirstPanelCheckBoxToNextPanelDisplay(PostBackValueDictionary formControlValues, Control outerPanel)
        {
            var           panelIndex = 0;
            BlockCheckBox checkBox   = null;
            Panel         panel      = null;

            foreach (var control in outerPanel.Controls.OfType <Panel>())
            {
                panelIndex += 1;
                if (panelIndex == 1)
                {
                    checkBox = getFirstCheckBox(control);
                }
                else if (panelIndex == 2)
                {
                    panel = control;
                }
            }
            if (checkBox != null && panel != null)
            {
                if (formControlValues == null)
                {
                    DisplayLinkingOps.AddDisplayJavaScriptToCheckBox(checkBox, true, panel);
                }
                else
                {
                    DisplayLinkingOps.SetControlDisplay(panel, checkBox.IsCheckedInPostBack(formControlValues));
                }
            }
        }
 void DisplayLink.SetInitialDisplay(PostBackValueDictionary formControlValues)
 {
     foreach (var c in controls)
     {
         DisplayLinkingOps.SetControlDisplay(c, controlsVisibleWhenBoxChecked == checkBox.IsCheckedInPostBack(formControlValues));
     }
 }
 /// <summary>
 /// Validates and returns the duration, a secondary validation in case javascript is disabled on the client system.
 /// </summary>
 public TimeSpan ValidateAndGetPostBackDuration( PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler validationErrorHandler )
 {
     if( tooLongOrInvalidCharacters( durationPicker.GetPostBackValue( postBackValues ) ) ) {
         validator.NoteErrorAndAddMessage( "Please enter a valid duration." );
         return TimeSpan.Zero;
     }
     return validator.GetTimeSpan( validationErrorHandler, parseTimeSpan( durationPicker.GetPostBackValue( postBackValues ) ) );
 }
 /// <summary>
 /// Validates the date and returns the date.
 /// </summary>
 public DateTime ValidateAndGetPostBackDate(PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler errorHandler)
 {
     return(validator.GetDateTime(
                errorHandler,
                textBox.GetPostBackValue(postBackValues).ToUpper(),
                DateTimeTools.MonthDayYearFormats.Select(i => i + " " + DateTimeTools.HourAndMinuteFormat).ToArray(),
                min,
                max));
 }
Пример #6
0
 /// <summary>
 /// Validates and returns the duration, a secondary validation in case javascript is disabled on the client system.
 /// </summary>
 public TimeSpan ValidateAndGetPostBackDuration(PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler validationErrorHandler)
 {
     if (tooLongOrInvalidCharacters(durationPicker.GetPostBackValue(postBackValues)))
     {
         validator.NoteErrorAndAddMessage("Please enter a valid duration.");
         return(TimeSpan.Zero);
     }
     return(validator.GetTimeSpan(validationErrorHandler, parseTimeSpan(durationPicker.GetPostBackValue(postBackValues))));
 }
Пример #7
0
        /// <summary>
        /// Validates the date and returns the date.
        /// </summary>
        public DateTime ValidateAndGetPostBackDate(PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler errorHandler)
        {
            var date = validator.GetDateTime(errorHandler, textBox.GetPostBackValue(postBackValues), null, min, max);

            if (errorHandler.LastResult == ErrorCondition.NoError && date.HasTime())
            {
                validator.NoteErrorAndAddMessage("Time information is not allowed.");
            }
            return(date);
        }
Пример #8
0
 /// <summary>
 /// Validates the time and returns the nullable time. The value is expressed in time since 12AM on an arbitrary day.
 /// </summary>
 public TimeSpan?ValidateAndGetNullableTimeSpan(
     PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler errorHandler, bool allowEmpty)
 {
     return(textBox != null
                                ? validator.GetNullableTimeOfDayTimeSpan(
                errorHandler,
                textBox.GetPostBackValue( postBackValues ).ToUpper(),
                DateTimeTools.HourAndMinuteFormat.ToSingleElementArray(),
                allowEmpty)
                                : selectList.ValidateAndGetSelectedItemIdInPostBack(postBackValues, validator));
 }
        /// <summary>
        /// Gets the post back value.
        /// </summary>
        public RsFile GetPostBackValue( PostBackValueDictionary postBackValues )
        {
            if( postBackValue == null ) {
                var value = formValue.GetValue( postBackValues );
                if( value == null )
                    return null;

                using( var ms = new MemoryStream() ) {
                    value.InputStream.CopyTo( ms );
                    postBackValue = new RsFile( ms.ToArray(), Path.GetFileName( value.FileName ), contentType: value.ContentType );
                }
            }
            return postBackValue;
        }
 private void linkThirdColCheckBoxesToFourthColCellsDisplay( PostBackValueDictionary formControlValues )
 {
     foreach( Control formChild in form.Controls ) {
         var panelIndex = 0;
         foreach( Control rowChild in formChild.Controls ) {
             if( rowChild is Panel ) {
                 panelIndex += 1;
                 if( panelIndex == 3 ) {
                     linkFirstPanelCheckBoxToNextPanelDisplay( formControlValues, rowChild );
                     break;
                 }
             }
         }
     }
 }
Пример #11
0
 private void linkThirdColCheckBoxesToFourthColCellsDisplay(PostBackValueDictionary formControlValues)
 {
     foreach (Control formChild in form.Controls)
     {
         var panelIndex = 0;
         foreach (Control rowChild in formChild.Controls)
         {
             if (rowChild is Panel)
             {
                 panelIndex += 1;
                 if (panelIndex == 3)
                 {
                     linkFirstPanelCheckBoxToNextPanelDisplay(formControlValues, rowChild);
                     break;
                 }
             }
         }
     }
 }
 private static void linkFirstPanelCheckBoxToNextPanelDisplay( PostBackValueDictionary formControlValues, Control outerPanel )
 {
     var panelIndex = 0;
     BlockCheckBox checkBox = null;
     Panel panel = null;
     foreach( var control in outerPanel.Controls.OfType<Panel>() ) {
         panelIndex += 1;
         if( panelIndex == 1 )
             checkBox = getFirstCheckBox( control );
         else if( panelIndex == 2 )
             panel = control;
     }
     if( checkBox != null && panel != null ) {
         if( formControlValues == null )
             DisplayLinkingOps.AddDisplayJavaScriptToCheckBox( checkBox, true, panel );
         else
             DisplayLinkingOps.SetControlDisplay( panel, checkBox.IsCheckedInPostBack( formControlValues ) );
     }
 }
Пример #13
0
        /// <summary>
        /// Validates the time and returns the time. The value is expressed in time since 12AM on an arbitrary day.
        /// </summary>
        public TimeSpan ValidateAndGetTimeSpan(PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler errorHandler)
        {
            if (textBox != null)
            {
                return(validator.GetTimeOfDayTimeSpan(
                           errorHandler,
                           textBox.GetPostBackValue(postBackValues).ToUpper(),
                           DateTimeTools.HourAndMinuteFormat.ToSingleElementArray()));
            }

            var selectedItemIdInPostBack = selectList.ValidateAndGetSelectedItemIdInPostBack(postBackValues, validator);

            if (selectedItemIdInPostBack.HasValue)
            {
                return(selectedItemIdInPostBack.Value);
            }
            errorHandler.SetValidationResult(ValidationResult.Empty());
            errorHandler.HandleResult(validator, true);
            return(default(TimeSpan));
        }
Пример #14
0
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack(PostBackValueDictionary postBackValues)
 {
     return(durationPicker.ValueChangedOnPostBack(postBackValues));
 }
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack( PostBackValueDictionary postBackValues )
 {
     return durationPicker.ValueChangedOnPostBack( postBackValues );
 }
Пример #16
0
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack(PostBackValueDictionary postBackValues)
 {
     return(textBox != null?textBox.ValueChangedOnPostBack(postBackValues) : selectList.SelectionChangedOnPostBack(postBackValues));
 }
 /// <summary>
 /// Validates the date and returns the date.
 /// </summary>
 public DateTime ValidateAndGetPostBackDate( PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler errorHandler )
 {
     var date = validator.GetDateTime( errorHandler, textBox.GetPostBackValue( postBackValues ), null, min, max );
     if( errorHandler.LastResult == ErrorCondition.NoError && date.HasTime() )
         validator.NoteErrorAndAddMessage( "Time information is not allowed." );
     return date;
 }
 /// <summary>
 /// Gets the post back value.
 /// </summary>
 public string GetPostBackValue( PostBackValueDictionary postBackValues )
 {
     return formValue.GetValue( postBackValues );
 }
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack( PostBackValueDictionary postBackValues )
 {
     return formValue.ValueChangedOnPostBack( postBackValues );
 }
 /// <summary>
 /// Gets the post back value.
 /// </summary>
 private string getPostBackValue( PostBackValueDictionary postBackValues )
 {
     return formValue.GetValue( postBackValues );
 }
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack( PostBackValueDictionary postBackValues )
 {
     return textBox.ValueChangedOnPostBack( postBackValues );
 }
Пример #22
0
 /// <summary>
 /// Gets the post back value.
 /// </summary>
 public string GetPostBackValue(PostBackValueDictionary postBackValues)
 {
     return(formValue.GetValue(postBackValues));
 }
 /// <summary>
 /// Validates the HTML.
 /// </summary>
 public void Validate( PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler errorHandler )
 {
     mod.Html = validator.GetString( errorHandler, wysiwygEditor.GetPostBackValue( postBackValues ), true );
 }
Пример #24
0
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack(PostBackValueDictionary postBackValues)
 {
     return(formValue.ValueChangedOnPostBack(postBackValues));
 }
        /// <summary>
        /// Validates the time and returns the time. The value is expressed in time since 12AM on an arbitrary day.
        /// </summary>
        public TimeSpan ValidateAndGetTimeSpan( PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler errorHandler )
        {
            if( textBox != null ) {
                return validator.GetTimeOfDayTimeSpan(
                    errorHandler,
                    textBox.GetPostBackValue( postBackValues ).ToUpper(),
                    DateTimeTools.HourAndMinuteFormat.ToSingleElementArray() );
            }

            var selectedItemIdInPostBack = selectList.ValidateAndGetSelectedItemIdInPostBack( postBackValues, validator );
            if( selectedItemIdInPostBack.HasValue )
                return selectedItemIdInPostBack.Value;
            errorHandler.SetValidationResult( ValidationResult.Empty() );
            errorHandler.HandleResult( validator, true );
            return default( TimeSpan );
        }
 void DisplayLink.SetInitialDisplay( PostBackValueDictionary formControlValues )
 {
     if( getControlsToggled( controlsToggledHiddenFieldValueGetter( formControlValues ) ) ) {
         if( textControl != null ) {
             if( getAlternateText().Any() ) {
                 textControl.Controls.Clear();
                 textControl.Controls.Add( getAlternateText().GetLiteralControl() );
             }
             else
                 this.SetInitialDisplay( false );
         }
         foreach( var webControl in controlsToToggle ) {
             if( toggleClasses != null ) {
                 foreach( var i in toggleClasses )
                     webControl.CssClass = webControl.CssClass.Contains( i ) ? webControl.CssClass.Replace( i, "" ) : webControl.CssClass.ConcatenateWithSpace( i );
             }
             else
                 webControl.ToggleInitialDisplay();
         }
     }
 }
 void DisplayLink.SetInitialDisplay( PostBackValueDictionary formControlValues )
 {
     linkThirdColCheckBoxesToFourthColCellsDisplay( formControlValues );
 }
Пример #28
0
 void DisplayLink.SetInitialDisplay(PostBackValueDictionary formControlValues)
 {
     linkThirdColCheckBoxesToFourthColCellsDisplay(formControlValues);
 }
 /// <summary>
 /// Validates the time and returns the nullable time. The value is expressed in time since 12AM on an arbitrary day.
 /// </summary>
 public TimeSpan? ValidateAndGetNullableTimeSpan(
     PostBackValueDictionary postBackValues, Validator validator, ValidationErrorHandler errorHandler, bool allowEmpty)
 {
     return textBox != null
                ? validator.GetNullableTimeOfDayTimeSpan(
                    errorHandler,
                    textBox.GetPostBackValue( postBackValues ).ToUpper(),
                    DateTimeTools.HourAndMinuteFormat.ToSingleElementArray(),
                    allowEmpty )
                : selectList.ValidateAndGetSelectedItemIdInPostBack( postBackValues, validator );
 }
 /// <summary>
 /// Gets whether the box is checked in the post back.
 /// </summary>
 public bool IsCheckedInPostBack( PostBackValueDictionary postBackValues )
 {
     return checkBoxFormValue != null ? checkBoxFormValue.GetValue( postBackValues ) : radioButtonFormValue.GetValue( postBackValues ) == this;
 }
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack( PostBackValueDictionary postBackValues )
 {
     return textBox != null ? textBox.ValueChangedOnPostBack( postBackValues ) : selectList.SelectionChangedOnPostBack( postBackValues );
 }
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack( PostBackValueDictionary postBackValues )
 {
     return checkBoxFormValue != null ? checkBoxFormValue.ValueChangedOnPostBack( postBackValues ) : radioButtonFormValue.ValueChangedOnPostBack( postBackValues );
 }
 /// <summary>
 /// Returns true if the value changed on this post back.
 /// </summary>
 public bool ValueChangedOnPostBack(PostBackValueDictionary postBackValues)
 {
     return(textBox.ValueChangedOnPostBack(postBackValues));
 }
 void DisplayLink.SetInitialDisplay( PostBackValueDictionary formControlValues )
 {
     foreach( var c in controls )
         DisplayLinkingOps.SetControlDisplay( c, controlsVisibleWhenBoxChecked == checkBox.IsCheckedInPostBack( formControlValues ) );
 }