/NoCom_Shopping/Presentation/Nop.Web/Administration/Models/Customers/CustomerModel.cs

http://project-manh-lan.googlecode.com/ · C# · 288 lines · 192 code · 86 blank · 10 comment · 0 complexity · 1c1ba62ca7953114267a472c815d6f60 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.Web.Mvc;
  5. using FluentValidation.Attributes;
  6. using Nop.Admin.Validators.Customers;
  7. using Nop.Core.Domain.Customers;
  8. using Nop.Web.Framework;
  9. using Nop.Web.Framework.Mvc;
  10. namespace Nop.Admin.Models.Customers
  11. {
  12. [Validator(typeof(CustomerValidator))]
  13. public class CustomerModel : BaseNopEntityModel
  14. {
  15. public CustomerModel()
  16. {
  17. AvailableTimeZones = new List<SelectListItem>();
  18. SendEmail = new SendEmailModel();
  19. SendPm = new SendPmModel();
  20. AssociatedExternalAuthRecords = new List<AssociatedExternalAuthModel>();
  21. AvailableCountries = new List<SelectListItem>();
  22. AvailableStates = new List<SelectListItem>();
  23. }
  24. public bool AllowUsersToChangeUsernames { get; set; }
  25. public bool UsernamesEnabled { get; set; }
  26. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Username")]
  27. [AllowHtml]
  28. public string Username { get; set; }
  29. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Email")]
  30. [AllowHtml]
  31. public string Email { get; set; }
  32. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Password")]
  33. [AllowHtml]
  34. public string Password { get; set; }
  35. //form fields & properties
  36. public bool GenderEnabled { get; set; }
  37. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Gender")]
  38. public string Gender { get; set; }
  39. [NopResourceDisplayName("Admin.Customers.Customers.Fields.FirstName")]
  40. [AllowHtml]
  41. public string FirstName { get; set; }
  42. [NopResourceDisplayName("Admin.Customers.Customers.Fields.LastName")]
  43. [AllowHtml]
  44. public string LastName { get; set; }
  45. [NopResourceDisplayName("Admin.Customers.Customers.Fields.FullName")]
  46. public string FullName { get; set; }
  47. public bool DateOfBirthEnabled { get; set; }
  48. [UIHint("DateNullable")]
  49. [NopResourceDisplayName("Admin.Customers.Customers.Fields.DateOfBirth")]
  50. public DateTime? DateOfBirth { get; set; }
  51. public bool CompanyEnabled { get; set; }
  52. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Company")]
  53. [AllowHtml]
  54. public string Company { get; set; }
  55. public bool StreetAddressEnabled { get; set; }
  56. [NopResourceDisplayName("Admin.Customers.Customers.Fields.StreetAddress")]
  57. [AllowHtml]
  58. public string StreetAddress { get; set; }
  59. public bool StreetAddress2Enabled { get; set; }
  60. [NopResourceDisplayName("Admin.Customers.Customers.Fields.StreetAddress2")]
  61. [AllowHtml]
  62. public string StreetAddress2 { get; set; }
  63. public bool ZipPostalCodeEnabled { get; set; }
  64. [NopResourceDisplayName("Admin.Customers.Customers.Fields.ZipPostalCode")]
  65. [AllowHtml]
  66. public string ZipPostalCode { get; set; }
  67. public bool CityEnabled { get; set; }
  68. [NopResourceDisplayName("Admin.Customers.Customers.Fields.City")]
  69. [AllowHtml]
  70. public string City { get; set; }
  71. public bool CountryEnabled { get; set; }
  72. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Country")]
  73. public int CountryId { get; set; }
  74. public IList<SelectListItem> AvailableCountries { get; set; }
  75. public bool StateProvinceEnabled { get; set; }
  76. [NopResourceDisplayName("Admin.Customers.Customers.Fields.StateProvince")]
  77. public int StateProvinceId { get; set; }
  78. public IList<SelectListItem> AvailableStates { get; set; }
  79. public bool PhoneEnabled { get; set; }
  80. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Phone")]
  81. [AllowHtml]
  82. public string Phone { get; set; }
  83. public bool FaxEnabled { get; set; }
  84. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Fax")]
  85. [AllowHtml]
  86. public string Fax { get; set; }
  87. [NopResourceDisplayName("Admin.Customers.Customers.Fields.AdminComment")]
  88. [AllowHtml]
  89. public string AdminComment { get; set; }
  90. [NopResourceDisplayName("Admin.Customers.Customers.Fields.IsTaxExempt")]
  91. public bool IsTaxExempt { get; set; }
  92. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Active")]
  93. public bool Active { get; set; }
  94. [NopResourceDisplayName("Admin.Customers.Customers.Fields.Affiliate")]
  95. public int? AffiliateId { get; set; }
  96. //time zone
  97. [NopResourceDisplayName("Admin.Customers.Customers.Fields.TimeZoneId")]
  98. [AllowHtml]
  99. public string TimeZoneId { get; set; }
  100. public bool AllowCustomersToSetTimeZone { get; set; }
  101. public IList<SelectListItem> AvailableTimeZones { get; set; }
  102. //EU VAT
  103. [NopResourceDisplayName("Admin.Customers.Customers.Fields.VatNumber")]
  104. [AllowHtml]
  105. public string VatNumber { get; set; }
  106. public string VatNumberStatusNote { get; set; }
  107. public bool DisplayVatNumber { get; set; }
  108. //registration date
  109. [NopResourceDisplayName("Admin.Customers.Customers.Fields.CreatedOn")]
  110. public DateTime CreatedOn { get; set; }
  111. [NopResourceDisplayName("Admin.Customers.Customers.Fields.LastActivityDate")]
  112. public DateTime LastActivityDate { get; set; }
  113. //IP adderss
  114. [NopResourceDisplayName("Admin.Customers.Customers.Fields.IPAddress")]
  115. public string LastIpAddress { get; set; }
  116. [NopResourceDisplayName("Admin.Customers.Customers.Fields.LastVisitedPage")]
  117. public string LastVisitedPage { get; set; }
  118. //customer roles
  119. [NopResourceDisplayName("Admin.Customers.Customers.Fields.CustomerRoles")]
  120. public string CustomerRoleNames { get; set; }
  121. public List<CustomerRole> AvailableCustomerRoles { get; set; }
  122. public int[] SelectedCustomerRoleIds { get; set; }
  123. //reward points history
  124. public bool DisplayRewardPointsHistory { get; set; }
  125. [NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.AddRewardPointsValue")]
  126. public int AddRewardPointsValue { get; set; }
  127. [NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.AddRewardPointsMessage")]
  128. [AllowHtml]
  129. public string AddRewardPointsMessage { get; set; }
  130. //properties used for filtering (customer list page)
  131. public string SearchCustomerRoleIds { get; set; }
  132. public string SearchCustomerEmail { get; set; }
  133. public string SearchCustomerUsername { get; set; }
  134. public string SearchCustomerFirstName { get; set; }
  135. public string SearchCustomerLastName { get; set; }
  136. public string SearchCustomerDayOfBirth { get; set; }
  137. public string SearchCustomerMonthOfBirth { get; set; }
  138. public string SearchCustomerCompany { get; set; }
  139. public string SearchCustomerPhone { get; set; }
  140. public string SearchCustomerZipPostalCode { get; set; }
  141. //send email model
  142. public SendEmailModel SendEmail { get; set; }
  143. //send PM model
  144. public SendPmModel SendPm { get; set; }
  145. [NopResourceDisplayName("Admin.Customers.Customers.AssociatedExternalAuth")]
  146. public IList<AssociatedExternalAuthModel> AssociatedExternalAuthRecords { get; set; }
  147. #region Nested classes
  148. public class AssociatedExternalAuthModel : BaseNopEntityModel
  149. {
  150. [NopResourceDisplayName("Admin.Customers.Customers.AssociatedExternalAuth.Fields.Email")]
  151. public string Email { get; set; }
  152. [NopResourceDisplayName("Admin.Customers.Customers.AssociatedExternalAuth.Fields.ExternalIdentifier")]
  153. public string ExternalIdentifier { get; set; }
  154. [NopResourceDisplayName("Admin.Customers.Customers.AssociatedExternalAuth.Fields.AuthMethodName")]
  155. public string AuthMethodName { get; set; }
  156. }
  157. public class RewardPointsHistoryModel : BaseNopEntityModel
  158. {
  159. [NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.Points")]
  160. public int Points { get; set; }
  161. [NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.PointsBalance")]
  162. public int PointsBalance { get; set; }
  163. [NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.Message")]
  164. [AllowHtml]
  165. public string Message { get; set; }
  166. [NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.Date")]
  167. public DateTime CreatedOn { get; set; }
  168. }
  169. public class SendEmailModel : BaseNopModel
  170. {
  171. [NopResourceDisplayName("Admin.Customers.Customers.SendEmail.Subject")]
  172. [AllowHtml]
  173. public string Subject { get; set; }
  174. [NopResourceDisplayName("Admin.Customers.Customers.SendEmail.Body")]
  175. [AllowHtml]
  176. public string Body { get; set; }
  177. }
  178. public class SendPmModel : BaseNopModel
  179. {
  180. [NopResourceDisplayName("Admin.Customers.Customers.SendPM.Subject")]
  181. public string Subject { get; set; }
  182. [NopResourceDisplayName("Admin.Customers.Customers.SendPM.Message")]
  183. public string Message { get; set; }
  184. }
  185. public class OrderModel : BaseNopEntityModel
  186. {
  187. [NopResourceDisplayName("Admin.Customers.Customers.Orders.ID")]
  188. public override int Id { get; set; }
  189. [NopResourceDisplayName("Admin.Customers.Customers.Orders.OrderStatus")]
  190. public string OrderStatus { get; set; }
  191. [NopResourceDisplayName("Admin.Customers.Customers.Orders.PaymentStatus")]
  192. public string PaymentStatus { get; set; }
  193. [NopResourceDisplayName("Admin.Customers.Customers.Orders.ShippingStatus")]
  194. public string ShippingStatus { get; set; }
  195. [NopResourceDisplayName("Admin.Customers.Customers.Orders.OrderTotal")]
  196. public string OrderTotal { get; set; }
  197. [NopResourceDisplayName("Admin.Customers.Customers.Orders.CreatedOn")]
  198. public DateTime CreatedOn { get; set; }
  199. }
  200. #endregion
  201. }
  202. }