PageRenderTime 26ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/SFS.AdventureWorks/PROJECTS/SFS.AdventureWorks.Web.Mvc/Models/Contacts/Contacts.gen.cs

#
C# | 344 lines | 227 code | 117 blank | 0 comment | 50 complexity | 391c838572be8dfcb9101ff93f13ab46 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.ComponentModel.DataAnnotations;
  6. using SFS.AdventureWorks.Web.Mvc.Resources;
  7. using System.Runtime.Serialization;
  8. using SFSdotNet.Framework.Web.Mvc.Models;
  9. using SFSdotNet.Framework.Web.Mvc.Extensions;
  10. using BO = SFS.AdventureWorks.BusinessObjects;
  11. using System.Web.Mvc;
  12. using SFSdotNet.Framework.Web.Mvc.Validation;
  13. using SFSdotNet.Framework.Web.Mvc.Models;
  14. using SFSdotNet.Framework.Web.Mvc.Resources;
  15. using SFSdotNet.Framework.Entities.Metadata;
  16. namespace SFS.AdventureWorks.Web.Mvc.Models.Contacts
  17. {
  18. public partial class ContactModel: ModelBase{
  19. public ContactModel()
  20. {
  21. }
  22. public override string Id
  23. {
  24. get
  25. {
  26. return this.ContactID.ToString();
  27. }
  28. }
  29. public override string ToString()
  30. {
  31. if (this.Title != null)
  32. return this.Title.ToString();
  33. else
  34. return "";
  35. }
  36. [SystemProperty()]
  37. public Int32? ContactID{ get; set; }
  38. [Exportable()]
  39. [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_NAMESTYLE_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
  40. [RelationFilterable()]
  41. [LocalizedDisplayName("NAMESTYLE", NameResourceType=typeof(ContactResources))]
  42. public Boolean NameStyle { get; set; }
  43. [Exportable()]
  44. [RelationFilterable()]
  45. [LocalizedDisplayName("TITLE", NameResourceType=typeof(ContactResources))]
  46. public String Title { get; set; }
  47. [Exportable()]
  48. [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_FIRSTNAME_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
  49. [RelationFilterable()]
  50. [LocalizedDisplayName("FIRSTNAME", NameResourceType=typeof(ContactResources))]
  51. public String FirstName { get; set; }
  52. [Exportable()]
  53. [RelationFilterable()]
  54. [LocalizedDisplayName("MIDDLENAME", NameResourceType=typeof(ContactResources))]
  55. public String MiddleName { get; set; }
  56. [Exportable()]
  57. [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_LASTNAME_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
  58. [RelationFilterable()]
  59. [LocalizedDisplayName("LASTNAME", NameResourceType=typeof(ContactResources))]
  60. public String LastName { get; set; }
  61. [Exportable()]
  62. [RelationFilterable()]
  63. [LocalizedDisplayName("SUFFIX", NameResourceType=typeof(ContactResources))]
  64. public String Suffix { get; set; }
  65. [Exportable()]
  66. [RelationFilterable()]
  67. [LocalizedDisplayName("EMAILADDRESS", NameResourceType=typeof(ContactResources))]
  68. public String EmailAddress { get; set; }
  69. [Exportable()]
  70. [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_EMAILPROMOTION_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
  71. [RelationFilterable()]
  72. [DataType("Integer")]
  73. [LocalizedDisplayName("EMAILPROMOTION", NameResourceType=typeof(ContactResources))]
  74. public Int32 EmailPromotion { get; set; }
  75. public string EmailPromotionText {
  76. get {
  77. return EmailPromotion.ToString();
  78. }
  79. }
  80. [Exportable()]
  81. [RelationFilterable()]
  82. [LocalizedDisplayName("PHONE", NameResourceType=typeof(ContactResources))]
  83. public String Phone { get; set; }
  84. [Exportable()]
  85. [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_PASSWORDHASH_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
  86. [RelationFilterable()]
  87. [LocalizedDisplayName("PASSWORDHASH", NameResourceType=typeof(ContactResources))]
  88. public String PasswordHash { get; set; }
  89. [Exportable()]
  90. [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_PASSWORDSALT_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
  91. [RelationFilterable()]
  92. [LocalizedDisplayName("PASSWORDSALT", NameResourceType=typeof(ContactResources))]
  93. public String PasswordSalt { get; set; }
  94. [Exportable()]
  95. [RelationFilterable()]
  96. [DataType("RichEditorBasic")]
  97. [LocalizedDisplayName("ADDITIONALCONTACTINFO", NameResourceType=typeof(ContactResources))]
  98. public String AdditionalContactInfo { get; set; }
  99. [Exportable()]
  100. [RelationFilterable()]
  101. [SystemProperty()]
  102. [LocalizedDisplayName("ROWGUID", NameResourceType=typeof(ContactResources))]
  103. public Guid rowguid { get; set; }
  104. [Exportable()]
  105. [RelationFilterable()]
  106. [SystemProperty()]
  107. [DateTime(true, false, null)]
  108. [LocalizedDisplayName("MODIFIEDDATE", NameResourceType=typeof(ContactResources))]
  109. public DateTime ModifiedDate { get; set; }
  110. public string ModifiedDateText {
  111. get {
  112. if (ModifiedDate != null)
  113. return ((DateTime)ModifiedDate).ToShortDateString();
  114. else
  115. return String.Empty;
  116. }
  117. set{
  118. this.ModifiedDate = Convert.ToDateTime(value);
  119. }
  120. }
  121. [LocalizedDisplayName("EMPLOYEES", NameResourceType=typeof(ContactResources))]
  122. [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="Employees.Count()", ModelPartialType="Employees.Employee")]
  123. public List<Employees.EmployeeModel> Employees { get; set; }
  124. [LocalizedDisplayName("CONTACTCREDITCARDS", NameResourceType=typeof(ContactResources))]
  125. [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="ContactCreditCards.Count()", ModelPartialType="ContactCreditCards.ContactCreditCard")]
  126. public List<ContactCreditCards.ContactCreditCardModel> ContactCreditCards { get; set; }
  127. [LocalizedDisplayName("INDIVIDUALS", NameResourceType=typeof(ContactResources))]
  128. [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="Individuals.Count()", ModelPartialType="Individuals.Individual")]
  129. public List<Individuals.IndividualModel> Individuals { get; set; }
  130. [LocalizedDisplayName("SALESORDERHEADERS", NameResourceType=typeof(ContactResources))]
  131. [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="SalesOrderHeaders.Count()", ModelPartialType="SalesOrderHeaders.SalesOrderHeader")]
  132. public List<SalesOrderHeaders.SalesOrderHeaderModel> SalesOrderHeaders { get; set; }
  133. [LocalizedDisplayName("STORECONTACTS", NameResourceType=typeof(ContactResources))]
  134. [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="StoreContacts.Count()", ModelPartialType="StoreContacts.StoreContact")]
  135. public List<StoreContacts.StoreContactModel> StoreContacts { get; set; }
  136. [LocalizedDisplayName("VENDORCONTACTS", NameResourceType=typeof(ContactResources))]
  137. [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="VendorContacts.Count()", ModelPartialType="VendorContacts.VendorContact")]
  138. public List<VendorContacts.VendorContactModel> VendorContacts { get; set; }
  139. public override string SafeKey
  140. {
  141. get
  142. {
  143. if(this.ContactID != null)
  144. return SFSdotNet.Framework.Entities.Utils.GetKey(this ,"ContactID").Replace("/","-");
  145. else
  146. return String.Empty;
  147. }
  148. }
  149. public void Bind(ContactModel model){
  150. this.ContactID = model.ContactID;
  151. this.NameStyle = model.NameStyle;
  152. this.Title = model.Title;
  153. this.FirstName = model.FirstName;
  154. this.MiddleName = model.MiddleName;
  155. this.LastName = model.LastName;
  156. this.Suffix = model.Suffix;
  157. this.EmailAddress = model.EmailAddress;
  158. this.EmailPromotion = model.EmailPromotion;
  159. this.Phone = model.Phone;
  160. this.PasswordHash = model.PasswordHash;
  161. this.PasswordSalt = model.PasswordSalt;
  162. this.AdditionalContactInfo = model.AdditionalContactInfo;
  163. this.rowguid = model.rowguid;
  164. this.ModifiedDate = model.ModifiedDate;
  165. }
  166. public BusinessObjects.Contact GetBusinessObject()
  167. {
  168. BusinessObjects.Contact result = new BusinessObjects.Contact();
  169. if (this.ContactID != null )
  170. result.ContactID = (Int32)this.ContactID;
  171. if (this.NameStyle != null )
  172. result.NameStyle = (Boolean)this.NameStyle;
  173. if (this.Title != null )
  174. result.Title = (String)this.Title;
  175. if (this.FirstName != null )
  176. result.FirstName = (String)this.FirstName;
  177. if (this.MiddleName != null )
  178. result.MiddleName = (String)this.MiddleName;
  179. if (this.LastName != null )
  180. result.LastName = (String)this.LastName;
  181. if (this.Suffix != null )
  182. result.Suffix = (String)this.Suffix;
  183. if (this.EmailAddress != null )
  184. result.EmailAddress = (String)this.EmailAddress;
  185. if (this.EmailPromotion != null )
  186. result.EmailPromotion = (Int32)this.EmailPromotion;
  187. if (this.Phone != null )
  188. result.Phone = (String)this.Phone;
  189. if (this.PasswordHash != null )
  190. result.PasswordHash = (String)this.PasswordHash;
  191. if (this.PasswordSalt != null )
  192. result.PasswordSalt = (String)this.PasswordSalt;
  193. if (this.AdditionalContactInfo != null )
  194. result.AdditionalContactInfo = (String)this.AdditionalContactInfo;
  195. if (this.rowguid != null )
  196. result.rowguid = (Guid)this.rowguid;
  197. if(this.ModifiedDate != null)
  198. if (this.ModifiedDate != null)
  199. result.ModifiedDate = (DateTime)this.ModifiedDate;
  200. return result;
  201. }
  202. public void Bind(BusinessObjects.Contact businessObject)
  203. {
  204. this.ContactID = businessObject.ContactID;
  205. this.NameStyle = businessObject.NameStyle;
  206. if (businessObject.Title != null )
  207. this.Title = (String)businessObject.Title;
  208. this.FirstName = businessObject.FirstName;
  209. if (businessObject.MiddleName != null )
  210. this.MiddleName = (String)businessObject.MiddleName;
  211. this.LastName = businessObject.LastName;
  212. if (businessObject.Suffix != null )
  213. this.Suffix = (String)businessObject.Suffix;
  214. if (businessObject.EmailAddress != null )
  215. this.EmailAddress = (String)businessObject.EmailAddress;
  216. this.EmailPromotion = businessObject.EmailPromotion;
  217. if (businessObject.Phone != null )
  218. this.Phone = (String)businessObject.Phone;
  219. this.PasswordHash = businessObject.PasswordHash;
  220. this.PasswordSalt = businessObject.PasswordSalt;
  221. if (businessObject.AdditionalContactInfo != null )
  222. this.AdditionalContactInfo = (String)businessObject.AdditionalContactInfo;
  223. this.rowguid = businessObject.rowguid;
  224. this.ModifiedDate = (DateTime)businessObject.ModifiedDate;
  225. }
  226. }
  227. }