/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
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.ComponentModel.DataAnnotations;
- using SFS.AdventureWorks.Web.Mvc.Resources;
- using System.Runtime.Serialization;
- using SFSdotNet.Framework.Web.Mvc.Models;
- using SFSdotNet.Framework.Web.Mvc.Extensions;
- using BO = SFS.AdventureWorks.BusinessObjects;
- using System.Web.Mvc;
- using SFSdotNet.Framework.Web.Mvc.Validation;
- using SFSdotNet.Framework.Web.Mvc.Models;
- using SFSdotNet.Framework.Web.Mvc.Resources;
- using SFSdotNet.Framework.Entities.Metadata;
-
-
- namespace SFS.AdventureWorks.Web.Mvc.Models.Contacts
- {
- public partial class ContactModel: ModelBase{
- public ContactModel()
- {
- }
- public override string Id
- {
- get
- {
- return this.ContactID.ToString();
- }
- }
-
-
- public override string ToString()
- {
- if (this.Title != null)
-
- return this.Title.ToString();
- else
- return "";
-
- }
-
-
- [SystemProperty()]
- public Int32? ContactID{ get; set; }
-
-
- [Exportable()]
-
- [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_NAMESTYLE_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
-
- [RelationFilterable()]
- [LocalizedDisplayName("NAMESTYLE", NameResourceType=typeof(ContactResources))]
- public Boolean NameStyle { get; set; }
-
-
-
- [Exportable()]
-
- [RelationFilterable()]
- [LocalizedDisplayName("TITLE", NameResourceType=typeof(ContactResources))]
- public String Title { get; set; }
-
-
-
- [Exportable()]
-
- [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_FIRSTNAME_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
-
- [RelationFilterable()]
- [LocalizedDisplayName("FIRSTNAME", NameResourceType=typeof(ContactResources))]
- public String FirstName { get; set; }
-
-
-
- [Exportable()]
-
- [RelationFilterable()]
- [LocalizedDisplayName("MIDDLENAME", NameResourceType=typeof(ContactResources))]
- public String MiddleName { get; set; }
-
-
-
- [Exportable()]
-
- [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_LASTNAME_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
-
- [RelationFilterable()]
- [LocalizedDisplayName("LASTNAME", NameResourceType=typeof(ContactResources))]
- public String LastName { get; set; }
-
-
-
- [Exportable()]
-
- [RelationFilterable()]
- [LocalizedDisplayName("SUFFIX", NameResourceType=typeof(ContactResources))]
- public String Suffix { get; set; }
-
-
-
- [Exportable()]
-
- [RelationFilterable()]
- [LocalizedDisplayName("EMAILADDRESS", NameResourceType=typeof(ContactResources))]
- public String EmailAddress { get; set; }
-
-
-
- [Exportable()]
-
- [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_EMAILPROMOTION_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
-
- [RelationFilterable()]
- [DataType("Integer")]
- [LocalizedDisplayName("EMAILPROMOTION", NameResourceType=typeof(ContactResources))]
- public Int32 EmailPromotion { get; set; }
- public string EmailPromotionText {
- get {
- return EmailPromotion.ToString();
-
- }
-
- }
-
-
-
-
- [Exportable()]
-
- [RelationFilterable()]
- [LocalizedDisplayName("PHONE", NameResourceType=typeof(ContactResources))]
- public String Phone { get; set; }
-
-
-
- [Exportable()]
-
- [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_PASSWORDHASH_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
-
- [RelationFilterable()]
- [LocalizedDisplayName("PASSWORDHASH", NameResourceType=typeof(ContactResources))]
- public String PasswordHash { get; set; }
-
-
-
- [Exportable()]
-
- [Required(AllowEmptyStrings=false, ErrorMessageResourceName="VAL_PASSWORDSALT_REQUIRED", ErrorMessageResourceType=typeof(ContactResources))]
-
- [RelationFilterable()]
- [LocalizedDisplayName("PASSWORDSALT", NameResourceType=typeof(ContactResources))]
- public String PasswordSalt { get; set; }
-
-
-
- [Exportable()]
-
- [RelationFilterable()]
- [DataType("RichEditorBasic")]
- [LocalizedDisplayName("ADDITIONALCONTACTINFO", NameResourceType=typeof(ContactResources))]
- public String AdditionalContactInfo { get; set; }
-
-
-
- [Exportable()]
-
- [RelationFilterable()]
- [SystemProperty()]
- [LocalizedDisplayName("ROWGUID", NameResourceType=typeof(ContactResources))]
- public Guid rowguid { get; set; }
-
-
-
- [Exportable()]
-
- [RelationFilterable()]
- [SystemProperty()]
- [DateTime(true, false, null)]
- [LocalizedDisplayName("MODIFIEDDATE", NameResourceType=typeof(ContactResources))]
- public DateTime ModifiedDate { get; set; }
- public string ModifiedDateText {
- get {
- if (ModifiedDate != null)
- return ((DateTime)ModifiedDate).ToShortDateString();
- else
- return String.Empty;
- }
- set{
- this.ModifiedDate = Convert.ToDateTime(value);
- }
- }
-
-
-
- [LocalizedDisplayName("EMPLOYEES", NameResourceType=typeof(ContactResources))]
- [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="Employees.Count()", ModelPartialType="Employees.Employee")]
- public List<Employees.EmployeeModel> Employees { get; set; }
-
- [LocalizedDisplayName("CONTACTCREDITCARDS", NameResourceType=typeof(ContactResources))]
- [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="ContactCreditCards.Count()", ModelPartialType="ContactCreditCards.ContactCreditCard")]
- public List<ContactCreditCards.ContactCreditCardModel> ContactCreditCards { get; set; }
-
- [LocalizedDisplayName("INDIVIDUALS", NameResourceType=typeof(ContactResources))]
- [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="Individuals.Count()", ModelPartialType="Individuals.Individual")]
- public List<Individuals.IndividualModel> Individuals { get; set; }
-
- [LocalizedDisplayName("SALESORDERHEADERS", NameResourceType=typeof(ContactResources))]
- [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="SalesOrderHeaders.Count()", ModelPartialType="SalesOrderHeaders.SalesOrderHeader")]
- public List<SalesOrderHeaders.SalesOrderHeaderModel> SalesOrderHeaders { get; set; }
-
- [LocalizedDisplayName("STORECONTACTS", NameResourceType=typeof(ContactResources))]
- [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="StoreContacts.Count()", ModelPartialType="StoreContacts.StoreContact")]
- public List<StoreContacts.StoreContactModel> StoreContacts { get; set; }
-
- [LocalizedDisplayName("VENDORCONTACTS", NameResourceType=typeof(ContactResources))]
- [RelationFilterable(IsNavigationPropertyMany=true, FiltrablePropertyPathName="VendorContacts.Count()", ModelPartialType="VendorContacts.VendorContact")]
- public List<VendorContacts.VendorContactModel> VendorContacts { get; set; }
-
- public override string SafeKey
- {
- get
- {
- if(this.ContactID != null)
- return SFSdotNet.Framework.Entities.Utils.GetKey(this ,"ContactID").Replace("/","-");
- else
- return String.Empty;
- }
- }
- public void Bind(ContactModel model){
-
- this.ContactID = model.ContactID;
- this.NameStyle = model.NameStyle;
- this.Title = model.Title;
- this.FirstName = model.FirstName;
- this.MiddleName = model.MiddleName;
- this.LastName = model.LastName;
- this.Suffix = model.Suffix;
- this.EmailAddress = model.EmailAddress;
- this.EmailPromotion = model.EmailPromotion;
- this.Phone = model.Phone;
- this.PasswordHash = model.PasswordHash;
- this.PasswordSalt = model.PasswordSalt;
- this.AdditionalContactInfo = model.AdditionalContactInfo;
- this.rowguid = model.rowguid;
- this.ModifiedDate = model.ModifiedDate;
- }
-
- public BusinessObjects.Contact GetBusinessObject()
- {
- BusinessObjects.Contact result = new BusinessObjects.Contact();
- if (this.ContactID != null )
- result.ContactID = (Int32)this.ContactID;
-
- if (this.NameStyle != null )
- result.NameStyle = (Boolean)this.NameStyle;
-
- if (this.Title != null )
- result.Title = (String)this.Title;
-
- if (this.FirstName != null )
- result.FirstName = (String)this.FirstName;
-
- if (this.MiddleName != null )
- result.MiddleName = (String)this.MiddleName;
-
- if (this.LastName != null )
- result.LastName = (String)this.LastName;
-
- if (this.Suffix != null )
- result.Suffix = (String)this.Suffix;
-
- if (this.EmailAddress != null )
- result.EmailAddress = (String)this.EmailAddress;
-
- if (this.EmailPromotion != null )
- result.EmailPromotion = (Int32)this.EmailPromotion;
-
- if (this.Phone != null )
- result.Phone = (String)this.Phone;
-
- if (this.PasswordHash != null )
- result.PasswordHash = (String)this.PasswordHash;
-
- if (this.PasswordSalt != null )
- result.PasswordSalt = (String)this.PasswordSalt;
-
- if (this.AdditionalContactInfo != null )
- result.AdditionalContactInfo = (String)this.AdditionalContactInfo;
-
- if (this.rowguid != null )
- result.rowguid = (Guid)this.rowguid;
-
- if(this.ModifiedDate != null)
- if (this.ModifiedDate != null)
- result.ModifiedDate = (DateTime)this.ModifiedDate;
-
-
-
-
- return result;
- }
- public void Bind(BusinessObjects.Contact businessObject)
- {
-
- this.ContactID = businessObject.ContactID;
-
- this.NameStyle = businessObject.NameStyle;
-
-
- if (businessObject.Title != null )
- this.Title = (String)businessObject.Title;
- this.FirstName = businessObject.FirstName;
-
-
- if (businessObject.MiddleName != null )
- this.MiddleName = (String)businessObject.MiddleName;
- this.LastName = businessObject.LastName;
-
-
- if (businessObject.Suffix != null )
- this.Suffix = (String)businessObject.Suffix;
-
- if (businessObject.EmailAddress != null )
- this.EmailAddress = (String)businessObject.EmailAddress;
- this.EmailPromotion = businessObject.EmailPromotion;
-
-
- if (businessObject.Phone != null )
- this.Phone = (String)businessObject.Phone;
- this.PasswordHash = businessObject.PasswordHash;
-
- this.PasswordSalt = businessObject.PasswordSalt;
-
-
- if (businessObject.AdditionalContactInfo != null )
- this.AdditionalContactInfo = (String)businessObject.AdditionalContactInfo;
- this.rowguid = businessObject.rowguid;
-
- this.ModifiedDate = (DateTime)businessObject.ModifiedDate;
-
- }
- }
- }