Advertisement
homph

ComplexTypesTest

Nov 4th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.07 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3. using CobolTest1.CustomTypes;
  4.  
  5. namespace CobolTest1
  6. {
  7.     public class ComplexTypesTest
  8.     {
  9.         // Properties for ACUCOBOLGT
  10.         public StructTest Struct
  11.         {
  12.             get { return GetStruct(); }
  13.         }
  14.  
  15.         public InterfaceClass InterfacedClass
  16.         {
  17.             get { return GetInterfacedClass(); }
  18.         }
  19.  
  20.         public DerivedClass DerivedClass
  21.         {
  22.             get { return GetDerivedClass(); }
  23.         }
  24.  
  25.         public ClassTest BaseClass {
  26.             get { return GetBaseClass(); }
  27.         }
  28.  
  29.  
  30.         public InterfaceClass GetInterfacedClass()
  31.         {
  32.             return new InterfaceClass();
  33.         }
  34.  
  35.         public ICobolTest GetInterfacedClassAsInterface()
  36.         {
  37.             return new InterfaceClass();
  38.         }
  39.  
  40.         public DerivedClass GetDerivedClass()
  41.         {
  42.             return new DerivedClass();
  43.         }
  44.  
  45.         public ICobolTest GetDerivedClassAsInterface()
  46.         {
  47.             return new DerivedClass();
  48.         }
  49.  
  50.         public ClassTest GetBaseClass()
  51.         {
  52.             return new ClassTest();
  53.         }
  54.  
  55.  
  56.         public StructTest GetStruct()
  57.         {
  58.             MessageBox.Show( "Called GetStruct!" );
  59.  
  60.             var ret = new StructTest();
  61.  
  62.             var rand = new Random();
  63.  
  64.             ret.DateTime = DateTime.Now;
  65.             ret.Int = rand.Next();
  66.             ret.Double = rand.NextDouble();
  67.             ret.Float = (float)rand.NextDouble();
  68.             ret.String = "Hat geklappt!";
  69.  
  70.             return ret;
  71.         }
  72.  
  73.         public bool IsInterfacedClass(object ic)
  74.         {
  75.             return (ic is InterfaceClass);
  76.         }
  77.  
  78.         public string GetType(ICobolTest ict)
  79.         {
  80.             if (ict is DerivedClass) return "DerivedClass" ;
  81.             if (ict is InterfaceClass) return "InterfaceClass";
  82.  
  83.             return "unknown or null";
  84.         }
  85.  
  86.         public DateTime GetStructDatreTime(StructTest s)
  87.         {
  88.             return (s.DateTime);
  89.         }
  90.  
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement