BaseCompareValidator.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * Namespace: System.Web.UI.WebControls
  3. * Class: BaseCompareValidator
  4. *
  5. * Author: Gaurav Vaish
  6. * Contact: <[email protected]>
  7. * Status: 100%
  8. *
  9. * (C) Gaurav Vaish (2001)
  10. */
  11. using System;
  12. using System.Collections;
  13. using System.Globalization;
  14. using System.Web;
  15. using System.Web.UI;
  16. namespace System.Web.UI.WebControls
  17. {
  18. public abstract class BaseCompareValidator: BaseValidator
  19. {
  20. protected BaseCompareValidator(): base()
  21. {
  22. //TODO: Init work
  23. }
  24. /*[
  25. WebSysDescriptionAttribute("RangeValidator_Type"),
  26. WebCategoryAttribute("Behaviour"),
  27. DefaultValueAttribute(System.Web.UI.WebControls.ValidationDataType)
  28. ]*/
  29. public static bool CanConvert(string text, ValidationDataType type)
  30. {
  31. //text = null;
  32. return false;
  33. }
  34. public ValidationDataType Type
  35. {
  36. get
  37. {
  38. object o = ViewState["Type"];
  39. if(o!=null)
  40. return (ValidationDataType)o;
  41. return ValidationDataType.String;
  42. }
  43. set
  44. {
  45. if(!System.Enum.IsDefined(typeof(ValidationDataType), value))
  46. throw new ArgumentException();
  47. ViewState["Type"] = value;
  48. // Else the function itself throws the exception
  49. }
  50. }
  51. protected static int CutoffYear
  52. {
  53. get
  54. {
  55. return DateTimeFormatInfo.CurrentInfo.Calendar.TwoDigitYearMax;
  56. }
  57. }
  58. protected static int GetFullYear(int shortYear)
  59. {
  60. DateTime dt = DateTime.Today;
  61. int year = dt.Year;
  62. return 0; //TODO: Get the values. This is just to ensure that the code compiles
  63. }
  64. protected override void AddAttributesToRender(HtmlTextWriter writer)
  65. {
  66. /*
  67. ValidationDataType vdt;
  68. NumberFormatInfo nfi;
  69. DateTime dt;
  70. */
  71. base.AddAttributesToRender(writer);
  72. if(base.RenderUplevel)
  73. {
  74. // TODO: The Lost World
  75. }
  76. }
  77. }
  78. }