Advertisement
LoganYoung87

Untitled

May 23rd, 2016
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace ortund.Data
  2. {
  3.     // Entity eliminates a lot of repetition by providing common property
  4.     // values through inheritance.
  5.     public class Entity
  6.     {
  7.         public int Id { get; set; }
  8.         public Company Company { get; set; }
  9.     }
  10.  
  11.     // Each Company represents an organisation that will be using the system
  12.     // which employs this data model
  13.     public class Company
  14.     {
  15.         public int Id { get; set; }
  16.         public string Name { get; set; }
  17.     }
  18.  
  19.     // Each User represents an employee of the Company to which it belongs
  20.     // who is authorized to use the system which employs this data model
  21.     public class User : Entity
  22.     {
  23.         public string EmailAddress { get; set; }
  24.         public string Password { get; set; }
  25.     }
  26.  
  27.     // Every record in each of the following tables belongs to a company
  28.     // which represents a customer using the system.
  29.  
  30.     // A Complex represents a location developed for high density housing
  31.     // that contains multiple apartments
  32.     public class Complex : Entity
  33.     {
  34.         public string Name { get; set; }
  35.         public Address Address { get; set; }
  36.         public Policy Policy { get; set; }
  37.     }
  38.  
  39.     // An Apartment record represents housing inside a Complex
  40.     public class Apartment : Entity
  41.     {
  42.         public Complex Complex { get; set; }
  43.         public string Number { get; set; }
  44.         public Owner Owner { get; set; }
  45.         public Tenant Tenant { get; set; }
  46.     }
  47.  
  48.     // An Owner record represents the owner of the apartment
  49.     public class Owner : Entity
  50.     {
  51.         public Apartment Apartment { get; set; }
  52.         public string AccountNumber { get; set; }
  53.     }
  54.  
  55.     // A Tenant record represents the person who currently resides in
  56.     // the apartment
  57.     public class Tenant : Entity
  58.     {
  59.         public Apartment Apartment { get; set; }
  60.         public string AccountNumber { get; set; }
  61.     }
  62.  
  63.     // An Address represents the physical location of a Complex
  64.     public class Address
  65.     {
  66.         public string[] Lines { get; set; }
  67.         public string Street { get; set; }
  68.         public string City { get; set; }
  69.         public string ZipCode { get; set; }
  70.     }
  71.  
  72.     // A Policy represents the Insurance Policy under which all repairs
  73.     // are effected
  74.     public class Policy : Entity
  75.     {
  76.         public Insurer Insurer { get; set; }
  77.         public string Number { get; set; }
  78.     }
  79.  
  80.     // An Insurer represents the Insurance company who provisioned the
  81.     // insurance policy
  82.     public class Insurer : Entity
  83.     {
  84.         public string Name { get; set; }
  85.     }
  86.  
  87.     // Liaisons and LiaisonTypes don't exist under any particular company
  88.     // so select of these entities won't be limited to the company doing
  89.     // the selection.
  90.  
  91.     // Not sure if this is ideal or absolutely to be avoided
  92.  
  93.     // Liaisons represent the people who the Company can contact for any
  94.     // matter relating to the relevant LiaisonType (complex, owner, insurer, etc)
  95.     public class Liaison : Entity
  96.     {
  97.         public string Name{ get; set; }
  98.         public string Phone { get; set; }
  99.         public string EmailAddress { get; set; }
  100.         public LiaisonType Type { get; set; } // required
  101.         public int TypeLink { get; set; } // required
  102.         public LiaisonType SubType { get; set; }
  103.         public int SubTypeLink { get; set; }
  104.  
  105.         // A Type refers to any other object in the data model(complex, insurer, etc)
  106.         // TypeLink refers to the PK value of the particular object record to which
  107.         // this liaison belongs.
  108.  
  109.         // This allows for multiple Liaisons per <entity>
  110.     }
  111.  
  112.     // LiaisonType provides an updateable list of object types to be used in linking
  113.     // a Liaison to whatever other object in the data model it should be linked to.
  114.     public LiaisonType : Entity
  115.     {
  116.         public string Name { get; set; } // valid values are Complex, Insurer, etc
  117.     }
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement