PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/V4/MVVM RI/MVVM.Questionnaires/Model/DomainObjects.cs

#
C# | 628 lines | 413 code | 73 blank | 142 comment | 41 complexity | f3771f845eff96c7a67edcc5d098fd21 MD5 | raw file
  1. //===================================================================================
  2. // Microsoft patterns & practices
  3. // Composite Application Guidance for Windows Presentation Foundation and Silverlight
  4. //===================================================================================
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
  7. // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  8. // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9. // FITNESS FOR A PARTICULAR PURPOSE.
  10. //===================================================================================
  11. // The example companies, organizations, products, domain names,
  12. // e-mail addresses, logos, people, places, and events depicted
  13. // herein are fictitious. No association with any real company,
  14. // organization, product, domain name, email address, logo, person,
  15. // places, or events is intended or should be inferred.
  16. //===================================================================================
  17. using System.Collections.Generic;
  18. using System.ComponentModel.DataAnnotations;
  19. using MVVM.Questionnaires.Framework;
  20. namespace MVVM.Questionnaires.Model
  21. {
  22. #region pseudo generated code - code for domain classes as it could have been generated by a tool
  23. /// <summary>
  24. /// The MultipleSelectionQuestion domain object class.
  25. /// </summary>
  26. public sealed partial class MultipleSelectionQuestion : Question
  27. {
  28. private ICollection<string> response;
  29. /// <summary>
  30. /// Initializes a new instance of the <see cref="MultipleSelectionQuestion"/> class.
  31. /// </summary>
  32. public MultipleSelectionQuestion()
  33. {
  34. }
  35. /// <summary>
  36. /// Gets or sets the Response value.
  37. /// </summary>
  38. [CustomValidation(typeof(CommonValidation), "ValidationMultipleSelectionResponseChoices")]
  39. [Required()]
  40. public ICollection<string> Response
  41. {
  42. get
  43. {
  44. return this.response;
  45. }
  46. set
  47. {
  48. if (this.response != value)
  49. {
  50. this.ValidateProperty("Response", value);
  51. this.response = value;
  52. this.RaisePropertyChanged("Response");
  53. }
  54. }
  55. }
  56. }
  57. /// <summary>
  58. /// The MultipleSelectionQuestionTemplate domain object class.
  59. /// </summary>
  60. public sealed partial class MultipleSelectionQuestionTemplate : QuestionTemplate
  61. {
  62. private int? maxSelections;
  63. private string[] range;
  64. /// <summary>
  65. /// Initializes a new instance of the <see cref="MultipleSelectionQuestionTemplate"/> class.
  66. /// </summary>
  67. public MultipleSelectionQuestionTemplate()
  68. {
  69. }
  70. /// <summary>
  71. /// Gets or sets the MaxSelections value.
  72. /// </summary>
  73. public int? MaxSelections
  74. {
  75. get
  76. {
  77. return this.maxSelections;
  78. }
  79. set
  80. {
  81. if (this.maxSelections != value)
  82. {
  83. this.ValidateProperty("MaxSelections", value);
  84. this.maxSelections = value;
  85. this.RaisePropertyChanged("MaxSelections");
  86. }
  87. }
  88. }
  89. /// <summary>
  90. /// Gets or sets the Range value.
  91. /// </summary>
  92. public string[] Range
  93. {
  94. get
  95. {
  96. return this.range;
  97. }
  98. set
  99. {
  100. if (this.range != value)
  101. {
  102. this.ValidateProperty("Range", value);
  103. this.range = value;
  104. this.RaisePropertyChanged("Range");
  105. }
  106. }
  107. }
  108. }
  109. /// <summary>
  110. /// The NumericQuestion domain object class.
  111. /// </summary>
  112. public sealed partial class NumericQuestion : Question
  113. {
  114. private int? response;
  115. /// <summary>
  116. /// Initializes a new instance of the <see cref="NumericQuestion"/> class.
  117. /// </summary>
  118. public NumericQuestion()
  119. {
  120. }
  121. /// <summary>
  122. /// Gets or sets the Response value.
  123. /// </summary>
  124. [CustomValidation(typeof(CommonValidation), "ValidationNumericQuestionResponseRange")]
  125. [Required()]
  126. public int? Response
  127. {
  128. get
  129. {
  130. return this.response;
  131. }
  132. set
  133. {
  134. if (this.response != value)
  135. {
  136. this.ValidateProperty("Response", value);
  137. this.response = value;
  138. this.RaisePropertyChanged("Response");
  139. }
  140. }
  141. }
  142. }
  143. /// <summary>
  144. /// The NumericQuestionTemplate domain object class.
  145. /// </summary>
  146. public sealed partial class NumericQuestionTemplate : QuestionTemplate
  147. {
  148. private int? maxValue;
  149. /// <summary>
  150. /// Initializes a new instance of the <see cref="NumericQuestionTemplate"/> class.
  151. /// </summary>
  152. public NumericQuestionTemplate()
  153. {
  154. }
  155. /// <summary>
  156. /// Gets or sets the MaxValue value.
  157. /// </summary>
  158. public int? MaxValue
  159. {
  160. get
  161. {
  162. return this.maxValue;
  163. }
  164. set
  165. {
  166. if (this.maxValue != value)
  167. {
  168. this.ValidateProperty("MaxValue", value);
  169. this.maxValue = value;
  170. this.RaisePropertyChanged("MaxValue");
  171. }
  172. }
  173. }
  174. }
  175. /// <summary>
  176. /// The OpenQuestion domain object class.
  177. /// </summary>
  178. public sealed partial class OpenQuestion : Question
  179. {
  180. private string response;
  181. /// <summary>
  182. /// Initializes a new instance of the <see cref="OpenQuestion"/> class.
  183. /// </summary>
  184. public OpenQuestion()
  185. {
  186. }
  187. /// <summary>
  188. /// Gets or sets the Response value.
  189. /// </summary>
  190. [CustomValidation(typeof(CommonValidation), "ValidationOpenQuestionResponseLength")]
  191. [Required()]
  192. public string Response
  193. {
  194. get
  195. {
  196. return this.response;
  197. }
  198. set
  199. {
  200. if (this.response != value)
  201. {
  202. this.ValidateProperty("Response", value);
  203. this.response = value;
  204. this.RaisePropertyChanged("Response");
  205. }
  206. }
  207. }
  208. }
  209. /// <summary>
  210. /// The OpenQuestionTemplate domain object class.
  211. /// </summary>
  212. public sealed partial class OpenQuestionTemplate : QuestionTemplate
  213. {
  214. private int maxLength;
  215. /// <summary>
  216. /// Initializes a new instance of the <see cref="OpenQuestionTemplate"/> class.
  217. /// </summary>
  218. public OpenQuestionTemplate()
  219. {
  220. }
  221. /// <summary>
  222. /// Gets or sets the MaxLength value.
  223. /// </summary>
  224. public int MaxLength
  225. {
  226. get
  227. {
  228. return this.maxLength;
  229. }
  230. set
  231. {
  232. if (this.maxLength != value)
  233. {
  234. this.ValidateProperty("MaxLength", value);
  235. this.maxLength = value;
  236. this.RaisePropertyChanged("MaxLength");
  237. }
  238. }
  239. }
  240. }
  241. /// <summary>
  242. /// The Question domain object class.
  243. /// </summary>
  244. public abstract partial class Question : DomainObject
  245. {
  246. private QuestionTemplate questionTemplate;
  247. /// <summary>
  248. /// Initializes a new instance of the <see cref="Question"/> class.
  249. /// </summary>
  250. protected Question()
  251. {
  252. }
  253. /// <summary>
  254. /// Gets or sets the associated <see cref="QuestionTemplate"/> entity.
  255. /// </summary>
  256. public QuestionTemplate QuestionTemplate
  257. {
  258. get
  259. {
  260. return this.questionTemplate;
  261. }
  262. set
  263. {
  264. if (this.questionTemplate != value)
  265. {
  266. this.ValidateProperty("QuestionTemplate", value);
  267. this.questionTemplate = value;
  268. this.RaisePropertyChanged("QuestionTemplate");
  269. }
  270. }
  271. }
  272. }
  273. /// <summary>
  274. /// The Questionnaire domain object class.
  275. /// </summary>
  276. public sealed partial class Questionnaire : DomainObject
  277. {
  278. private int? age;
  279. private string name;
  280. private ICollection<Question> questions;
  281. private QuestionnaireTemplate template;
  282. /// <summary>
  283. /// Initializes a new instance of the <see cref="Questionnaire"/> class.
  284. /// </summary>
  285. public Questionnaire()
  286. {
  287. }
  288. /// <summary>
  289. /// Gets or sets the Age value.
  290. /// </summary>
  291. [Range(21, 100)]
  292. public int? Age
  293. {
  294. get
  295. {
  296. return this.age;
  297. }
  298. set
  299. {
  300. if (this.age != value)
  301. {
  302. this.ValidateProperty("Age", value);
  303. this.age = value;
  304. this.RaisePropertyChanged("Age");
  305. }
  306. }
  307. }
  308. /// <summary>
  309. /// Gets or sets the Name value.
  310. /// </summary>
  311. [Required()]
  312. [StringLength(50)]
  313. public string Name
  314. {
  315. get
  316. {
  317. return this.name;
  318. }
  319. set
  320. {
  321. if (this.name != value)
  322. {
  323. this.ValidateProperty("Name", value);
  324. this.name = value;
  325. this.RaisePropertyChanged("Name");
  326. }
  327. }
  328. }
  329. /// <summary>
  330. /// Gets the collection of associated <see cref="Question"/> entities.
  331. /// </summary>
  332. public ICollection<Question> Questions
  333. {
  334. get
  335. {
  336. if (this.questions == null)
  337. {
  338. this.questions = new List<Question>();
  339. }
  340. return this.questions;
  341. }
  342. }
  343. /// <summary>
  344. /// Gets or sets the associated <see cref="QuestionnaireTemplate"/> entity.
  345. /// </summary>
  346. public QuestionnaireTemplate Template
  347. {
  348. get
  349. {
  350. return this.template;
  351. }
  352. set
  353. {
  354. if (this.template != value)
  355. {
  356. this.ValidateProperty("Template", value);
  357. this.template = value;
  358. this.RaisePropertyChanged("Template");
  359. }
  360. }
  361. }
  362. }
  363. /// <summary>
  364. /// The QuestionnaireTemplate domain object class.
  365. /// </summary>
  366. public sealed partial class QuestionnaireTemplate : DomainObject
  367. {
  368. private ICollection<QuestionTemplate> questions;
  369. private string title;
  370. /// <summary>
  371. /// Initializes a new instance of the <see cref="QuestionnaireTemplate"/> class.
  372. /// </summary>
  373. public QuestionnaireTemplate()
  374. {
  375. }
  376. /// <summary>
  377. /// Gets the collection of associated <see cref="QuestionTemplate"/> entities.
  378. /// </summary>
  379. public ICollection<QuestionTemplate> Questions
  380. {
  381. get
  382. {
  383. if (this.questions == null)
  384. {
  385. this.questions = new List<QuestionTemplate>();
  386. }
  387. return this.questions;
  388. }
  389. }
  390. /// <summary>
  391. /// Gets or sets the Title value.
  392. /// </summary>
  393. public string Title
  394. {
  395. get
  396. {
  397. return this.title;
  398. }
  399. set
  400. {
  401. if (this.title != value)
  402. {
  403. this.ValidateProperty("Title", value);
  404. this.title = value;
  405. this.RaisePropertyChanged("Title");
  406. }
  407. }
  408. }
  409. }
  410. /// <summary>
  411. /// The QuestionTemplate domain object class.
  412. /// </summary>
  413. public abstract partial class QuestionTemplate : DomainObject
  414. {
  415. private string questionText;
  416. /// <summary>
  417. /// Initializes a new instance of the <see cref="QuestionTemplate"/> class.
  418. /// </summary>
  419. protected QuestionTemplate()
  420. {
  421. }
  422. /// <summary>
  423. /// Gets or sets the QuestionText value.
  424. /// </summary>
  425. public string QuestionText
  426. {
  427. get
  428. {
  429. return this.questionText;
  430. }
  431. set
  432. {
  433. if (this.questionText != value)
  434. {
  435. this.ValidateProperty("QuestionText", value);
  436. this.questionText = value;
  437. this.RaisePropertyChanged("QuestionText");
  438. }
  439. }
  440. }
  441. }
  442. /// <summary>
  443. /// The QuestionnaireTemplateSummary domain object class.
  444. /// </summary>
  445. public sealed partial class QuestionnaireTemplateSummary : DomainObject
  446. {
  447. private string title;
  448. private string description;
  449. private int numberOfQuestions;
  450. private float estimatedTime;
  451. private int timesTaken;
  452. /// <summary>
  453. /// Initializes a new instance of the <see cref="QuestionnaireTemplateSummary"/> class.
  454. /// </summary>
  455. public QuestionnaireTemplateSummary()
  456. {
  457. }
  458. /// <summary>
  459. /// Gets or sets the Title value.
  460. /// </summary>
  461. public string Title
  462. {
  463. get
  464. {
  465. return this.title;
  466. }
  467. set
  468. {
  469. if (this.title != value)
  470. {
  471. this.ValidateProperty("Title", value);
  472. this.title = value;
  473. this.RaisePropertyChanged("Title");
  474. }
  475. }
  476. }
  477. /// <summary>
  478. /// Gets or sets the Description value.
  479. /// </summary>
  480. public string Description
  481. {
  482. get
  483. {
  484. return this.description;
  485. }
  486. set
  487. {
  488. if (this.description != value)
  489. {
  490. this.ValidateProperty("Description", value);
  491. this.description = value;
  492. this.RaisePropertyChanged("Description");
  493. }
  494. }
  495. }
  496. /// <summary>
  497. /// Gets or sets the NumberOfQuestions value.
  498. /// </summary>
  499. public int NumberOfQuestions
  500. {
  501. get
  502. {
  503. return this.numberOfQuestions;
  504. }
  505. set
  506. {
  507. if (this.numberOfQuestions != value)
  508. {
  509. this.ValidateProperty("NumberOfQuestions", value);
  510. this.numberOfQuestions = value;
  511. this.RaisePropertyChanged("NumberOfQuestions");
  512. }
  513. }
  514. }
  515. /// <summary>
  516. /// Gets or sets the EstimatedTime value.
  517. /// </summary>
  518. public float EstimatedTime
  519. {
  520. get
  521. {
  522. return this.estimatedTime;
  523. }
  524. set
  525. {
  526. if (this.estimatedTime != value)
  527. {
  528. this.ValidateProperty("EstimatedTime", value);
  529. this.estimatedTime = value;
  530. this.RaisePropertyChanged("EstimatedTime");
  531. }
  532. }
  533. }
  534. /// <summary>
  535. /// Gets or sets the TimesTaken value.
  536. /// </summary>
  537. public int TimesTaken
  538. {
  539. get
  540. {
  541. return this.timesTaken;
  542. }
  543. set
  544. {
  545. if (this.timesTaken != value)
  546. {
  547. this.ValidateProperty("TimesTaken", value);
  548. this.timesTaken = value;
  549. this.RaisePropertyChanged("TimesTaken");
  550. }
  551. }
  552. }
  553. }
  554. #endregion
  555. }