public void MinValueChanged(object param) { if (MinimumValue != null) { AddLog("MinValue Changed: " + MinimumValue.ToString()); } }
/// <summary> /// Renders the base control. /// </summary> /// <param name="writer">The writer.</param> public override void RenderBaseControl(HtmlTextWriter writer) { string numberType = NumberType.ConvertToString(); if (numberType == "Integer") { this.Attributes["pattern"] = "[0-9]*"; } var minValue = MinimumValue.AsIntegerOrNull(); if (minValue.HasValue) { this.Attributes["min"] = minValue.ToString(); } var maxValue = MaximumValue.AsIntegerOrNull(); if (maxValue.HasValue) { this.Attributes["max"] = maxValue.ToString(); } base.RenderBaseControl(writer); }
public void ValueChanged(object param) { if (Value != null) { if (param is IntegerTextBox) { IntegerTextBox textBox = param as IntegerTextBox; if (Value.Value > MaximumValue && !textBox.IsFocused && textBox.MaxValidation != MaxValidation.OnLostFocus) { AddLog("Value Changed: " + MaximumValue.ToString()); } else if (Value.Value < MinimumValue && !textBox.IsFocused && textBox.MinValidation != MinValidation.OnLostFocus) { AddLog("Value Changed: " + MinimumValue.ToString()); } else { AddLog("Value Changed: " + Value.ToString()); } } else { AddLog("Value Changed: " + Value.ToString()); } } else { AddLog("Value Changed: NULL"); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (UnitOfMeasure != null) { hashCode = hashCode * 59 + UnitOfMeasure.GetHashCode(); } if (MinimumValue != null) { hashCode = hashCode * 59 + MinimumValue.GetHashCode(); } if (MaximumValue != null) { hashCode = hashCode * 59 + MaximumValue.GetHashCode(); } if (RateApplicationMethod != null) { hashCode = hashCode * 59 + RateApplicationMethod.GetHashCode(); } if (ApplicabilityConditions != null) { hashCode = hashCode * 59 + ApplicabilityConditions.GetHashCode(); } return(hashCode); } }
public void ValueChanged(object param) { if (Value != null) { if (param is Syncfusion.Windows.Shared.PercentTextBox) { Syncfusion.Windows.Shared.PercentTextBox textBox = param as Syncfusion.Windows.Shared.PercentTextBox; if (Value.Value > MaximumValue && !textBox.IsFocused && textBox.MaxValidation != MaxValidation.OnLostFocus) { AddLog("Value Changed: " + MaximumValue.ToString()); } else if (Value.Value < MinimumValue && !textBox.IsFocused && textBox.MinValidation != MinValidation.OnLostFocus) { AddLog("Value Changed: " + MinimumValue.ToString()); } else { AddLog("Value Changed: " + Value.ToString()); } } else { AddLog("Value Changed: " + Value.ToString()); } } else { AddLog("Value Changed: NULL"); } }
/// <summary> /// Renders any data validator. /// </summary> /// <param name="writer">The writer.</param> protected override void RenderDataValidator(HtmlTextWriter writer) { _customValidator.Attributes.Add("min", MinimumValue ?? int.MinValue.ToString()); _customValidator.Attributes.Add("max", MaximumValue ?? int.MaxValue.ToString()); _customValidator.Attributes.Add("control", ClientID); decimal minValue = MinimumValue.AsDecimalOrNull() ?? decimal.MinValue; decimal maxValue = MaximumValue.AsDecimalOrNull() ?? decimal.MaxValue; string rangeMessageFormat = null; // if they are in the valid range, but not an integer, they'll see this message switch (NumberType) { case ValidationDataType.Integer: rangeMessageFormat = "{0} must be an integer"; break; case ValidationDataType.Double: rangeMessageFormat = "{0} must be a decimal amount"; break; case ValidationDataType.Currency: rangeMessageFormat = "{0} must be a currency amount"; break; case ValidationDataType.Date: rangeMessageFormat = "{0} must be a date"; break; case ValidationDataType.String: rangeMessageFormat = "{0} must be a string"; break; } if (minValue > decimal.MinValue) { rangeMessageFormat = "{0} must be at least " + MinimumValue; } if (maxValue < decimal.MaxValue) { rangeMessageFormat = "{0} must be at most " + MaximumValue; } if ((minValue > decimal.MinValue) && (maxValue < decimal.MaxValue)) { rangeMessageFormat = string.Format("{{0}} must be between {0} and {1} ", MinimumValue, MaximumValue); } if (!string.IsNullOrWhiteSpace(rangeMessageFormat)) { _customValidator.ErrorMessage = string.Format(rangeMessageFormat, string.IsNullOrWhiteSpace(FieldName) ? "Value" : FieldName); } _customValidator.Attributes.Add("ErrorMessage", _customValidator.ErrorMessage); _customValidator.ValidationGroup = this.ValidationGroup; _customValidator.RenderControl(writer); }
public override void MakeSchemaCompliant() { base.MakeSchemaCompliant(); MinimumValue.MakeSchemaCompliant(); MaximumValue.MakeSchemaCompliant(); VerticalCRS.MakeSchemaCompliant(); }
public void CalculateCompletion() { MinimumValue minimumValue = new MinimumValue(); Assert.AreEqual(0, minimumValue.CalculateCompletion(8, 0)); //stores the maximum value on the first instance Assert.AreEqual(0.5, minimumValue.CalculateCompletion(4, 0)); Assert.AreEqual(0.5, minimumValue.CalculateCompletion(8, 0)); //should store the previously calculated value of 0.5 Assert.AreEqual(0.75, minimumValue.CalculateCompletion(2, 0)); Assert.AreEqual(1.0, minimumValue.CalculateCompletion(0, 0)); Assert.AreEqual(1.0, minimumValue.CalculateCompletion(-1, 0)); //test that we have already attained 100% }
public void Terminate() { MinimumValue minimumValue = new MinimumValue(); Assert.True(minimumValue.Terminate(0, 0)); Assert.True(minimumValue.Terminate(0, 1)); Assert.True(minimumValue.Terminate(-1, 0)); Assert.True(minimumValue.Terminate(5, 10)); Assert.False(minimumValue.Terminate(1, 0)); Assert.False(minimumValue.Terminate(0, -1)); Assert.False(minimumValue.Terminate(10, 5)); }
/// <summary> /// Renders any data validator. /// </summary> /// <param name="writer">The writer.</param> protected override void RenderDataValidator(HtmlTextWriter writer) { _rangeValidator.Type = NumberType; _rangeValidator.MinimumValue = this.MinimumValue; _rangeValidator.MaximumValue = this.MaximumValue; string dataTypeText = string.Empty; int minValue = MinimumValue.AsIntegerOrNull() ?? int.MinValue; int maxValue = MaximumValue.AsIntegerOrNull() ?? int.MaxValue; string rangeMessageFormat = null; // if they are in the valid range, but not an integer, they'll see this message switch (_rangeValidator.Type) { case ValidationDataType.Integer: rangeMessageFormat = "{0} must be an integer"; break; case ValidationDataType.Double: rangeMessageFormat = "{0} must be a decimal amout"; break; case ValidationDataType.Currency: rangeMessageFormat = "{0} must be a currency amount"; break; case ValidationDataType.Date: rangeMessageFormat = "{0} must be a date"; break; case ValidationDataType.String: rangeMessageFormat = "{0} must be a string"; break; } if (minValue > int.MinValue) { rangeMessageFormat = "{0} must be at least " + MinimumValue; } if (maxValue < int.MaxValue) { rangeMessageFormat = "{0} must be at most " + MaximumValue; } if ((minValue > int.MinValue) && (maxValue < int.MaxValue)) { rangeMessageFormat = string.Format("{{0}} must be between {0} and {1} ", MinimumValue, MaximumValue); } if (!string.IsNullOrWhiteSpace(rangeMessageFormat)) { _rangeValidator.ErrorMessage = string.Format(rangeMessageFormat, string.IsNullOrWhiteSpace(FieldName) ? "Value" : FieldName); } _rangeValidator.ValidationGroup = this.ValidationGroup; _rangeValidator.RenderControl(writer); }
private void ServerValidation(object source, ServerValidateEventArgs args) { var min = MinimumValue.IsNotNullOrWhiteSpace() ? Convert.ToDecimal(MinimumValue) : int.MinValue; var max = MaximumValue.IsNotNullOrWhiteSpace() ? Convert.ToDecimal(MaximumValue) : int.MaxValue; var value = args.Value.AsDecimalInvariantCultureOrNull(); if (value == null) { args.IsValid = false; return; } args.IsValid = value <= max && value >= min; }
/// <summary> /// Returns true if BankingProductRateTier instances are equal /// </summary> /// <param name="other">Instance of BankingProductRateTier to be compared</param> /// <returns>Boolean</returns> public bool Equals(BankingProductRateTier other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( UnitOfMeasure == other.UnitOfMeasure || UnitOfMeasure != null && UnitOfMeasure.Equals(other.UnitOfMeasure) ) && ( MinimumValue == other.MinimumValue || MinimumValue != null && MinimumValue.Equals(other.MinimumValue) ) && ( MaximumValue == other.MaximumValue || MaximumValue != null && MaximumValue.Equals(other.MaximumValue) ) && ( RateApplicationMethod == other.RateApplicationMethod || RateApplicationMethod != null && RateApplicationMethod.Equals(other.RateApplicationMethod) ) && ( ApplicabilityConditions == other.ApplicabilityConditions || ApplicabilityConditions != null && ApplicabilityConditions.SequenceEqual(other.ApplicabilityConditions) ) && ( SubTier == other.SubTier || SubTier != null && SubTier.Equals(other.SubTier) )); }
private void OnFormLoad(object sender, EventArgs e) { switch (ClassificationScheme) { case "Jenk's-Fisher's": break; case "Equal interval": lblMinValue.Text += MinimumValue.ToString(); lblMaxValue.Text += MaximumValue.ToString(); tabControl.TabPages["tabEqualInterval"].Select(); break; case "User defined": tabControl.TabPages["tabUserDefined"].Select(); break; } Text = ParameterToClassify; txtEndTarget.Enabled = false; txtNumberOfSteps.Enabled = false; }
/// <summary> /// String representation for debug purposes /// </summary> /// <returns></returns> public override string ToString() { return(MinimumValue == MaximumValue?MinimumValue.ToString(CultureInfo.InvariantCulture) : (MinimumValue.ToString(CultureInfo.InvariantCulture) + "-" + MaximumValue.ToString(CultureInfo.InvariantCulture))); }
/// <summary> /// Returns the maximum number of characters for the maximum value or the minimum value. /// Used to autosize a NumberEntry. /// </summary> /// <returns></returns> public override int CalculateMaxCharacters() { return(Math.Max(MaximumValue.ToString().Length, MinimumValue.ToString().Length)); }
public CoordinateModel(char coordinate) { Litera = coordinate; DisplayMinimumValue = MinimumValue.ToString(); DisplayDelta = Delta.ToString(); }