DemoVariableProvider.cs
上传用户:husern
上传日期:2022-03-24
资源大小:534k
文件大小:2k
源码类别:

编辑器/阅读器

开发平台:

C#

  1. // -- FILE ------------------------------------------------------------------
  2. // name       : DemoVariableProvider.cs
  3. // project    : Itenso Web User Forms
  4. // created    : Jani Giannoudis - 2008.10.30
  5. // language   : c#
  6. // environment: .NET 2.0
  7. // copyright  : (c) 2008 by Itenso GmbH, Switzerland
  8. // --------------------------------------------------------------------------
  9. using System;
  10. using System.Web.UI;
  11. using Itenso.WebUserForms.Data.Form;
  12. using Itenso.WebUserForms.Data.Variable;
  13. using Itenso.WebUserForms.Runtime;
  14. // --------------------------------------------------------------------------
  15. public class DemoVariableProvider : IVariableProvider
  16. {
  17. // ------------------------------------------------------------------------
  18. public DemoVariableProvider()
  19. {
  20. } // DemoVariableProvider
  21. // ------------------------------------------------------------------------
  22. public IVariableSet GetVariables()
  23. {
  24. return GetVariables( null );
  25. } // GetVariables
  26. // ------------------------------------------------------------------------
  27. public IVariableSet GetVariables( string formType )
  28. {
  29. VariableSet variableSet = new VariableSet();
  30. variableSet.MapContentToVariable( "System.CurrentDate", DateTime.Now.ToString() );
  31. variableSet.MapContentToVariable( "System.User", "John Doe" );
  32. return variableSet;
  33. } // GetVariables
  34. // ------------------------------------------------------------------------
  35. public IVariableSet GetFormVariables( UserControl userControl )
  36. {
  37. IVariableSet variableSet = GetVariables();
  38. if ( userControl != null )
  39. {
  40. IForm form = UserFormAdapter.ExtractForm( userControl );
  41. if ( form != null )
  42. {
  43. variableSet.MapContentToVariable( "CurrentForm.Name", form.Name );
  44. variableSet.MapContentToVariable( "CurrentForm.Type", form.FormType );
  45. }
  46. }
  47. return variableSet;
  48. } // GetFormVariables
  49. } // class DemoVariableProvider
  50. // -- EOF -------------------------------------------------------------------