diff options
author | Gaurav Vaish <gvaish@mono-cvs.ximian.com> | 2001-12-16 21:26:37 +0300 |
---|---|---|
committer | Gaurav Vaish <gvaish@mono-cvs.ximian.com> | 2001-12-16 21:26:37 +0300 |
commit | b0cb454c4c2866295a3ce14c83f3d36fd55c88a7 (patch) | |
tree | 0b9fb6f3d37d3fe9fa9d3585f353fe333ae9d213 /mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs | |
parent | 785acfc3e8b05532e3c195d15df5ed526aa2e69b (diff) |
2001-12-17 Gaurav Vaish <Gvaish@iitk.ac.in>
* DataList, IRepeatInfoUser, RepeaterCommandEventArgs, ValidationCompareOperator ---- Corrected SILLY mistakes
* BaseCompareValidator --- Almost done. Just left with AddAttributesToRender(...)
svn path=/trunk/mcs/; revision=1595
Diffstat (limited to 'mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs')
-rwxr-xr-x | mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs index a090d853937..63aa8a2b59e 100755 --- a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs +++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs @@ -70,19 +70,23 @@ namespace System.Web.UI.WebControls protected override void AddAttributesToRender(HtmlTextWriter writer)
{
- /*
- ValidationDataType vdt;
- NumberFormatInfo nfi;
- DateTime dt;
- */
base.AddAttributesToRender(writer);
- if(base.RenderUplevel)
+ if(RenderUplevel)
{
- // TODO: The Lost World
+ //writer.AddAttribute("type",
}
throw new NotImplementedException();
}
+ protected override bool DetermineRenderUplevel()
+ {
+ if(Type == ValidationDataType.Date && DateTimeFormatInfo.CurrentInfo.Calendar.GetType() != typeof(GregorianCalendar))
+ {
+ return false;
+ }
+ return base.DetermineRenderUplevel();
+ }
+
/// <summary>
/// Undocumented
/// </summary>
@@ -101,14 +105,40 @@ namespace System.Web.UI.WebControls {
return true;
}
- int compareResult;
+ int compareResult = 0;
switch(type)
{
case ValidationDataType.String:
compareResult = ((String)left).CompareTo(right);
break;
+ case ValidationDataType.Integer:
+ compareResult = ((int)left).CompareTo(right);
+ break;
+ case ValidationDataType.Double:
+ compareResult = ((Double)left).CompareTo(right);
+ break;
+ case ValidationDataType.Date:
+ compareResult = ((DateTime)left).CompareTo(right);
+ break;
+ case ValidationDataType.Currency:
+ compareResult = ((Decimal)left).CompareTo(right);
+ break;
+ }
+ switch(op)
+ {
+ case ValidationCompareOperator.Equal:
+ return (compareResult == 0);
+ case ValidationCompareOperator.NotEqual:
+ return (compareResult != 0);
+ case ValidationCompareOperator.GreaterThan:
+ return (compareResult > 0);
+ case ValidationCompareOperator.GreaterThanEqual:
+ return (compareResult >= 0);
+ case ValidationCompareOperator.LessThan:
+ return (compareResult < 0);
+ case ValidationCompareOperator.LessThanEqual:
+ return (compareResult == 0);
}
- throw new NotImplementedException();
return false;
}
|