PageRenderTime 32ms CodeModel.GetById 15ms app.highlight 12ms RepoModel.GetById 2ms 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//===================================================================================
 17using System.Collections.Generic;
 18using System.ComponentModel.DataAnnotations;
 19using MVVM.Questionnaires.Framework;
 20
 21namespace MVVM.Questionnaires.Model
 22{
 23    #region pseudo generated code - code for domain classes as it could have been generated by a tool
 24
 25    /// <summary>
 26    /// The MultipleSelectionQuestion domain object class.
 27    /// </summary>
 28    public sealed partial class MultipleSelectionQuestion : Question
 29    {
 30        private ICollection<string> response;
 31
 32        /// <summary>
 33        /// Initializes a new instance of the <see cref="MultipleSelectionQuestion"/> class.
 34        /// </summary>
 35        public MultipleSelectionQuestion()
 36        {
 37        }
 38
 39        /// <summary>
 40        /// Gets or sets the Response value.
 41        /// </summary>
 42        [CustomValidation(typeof(CommonValidation), "ValidationMultipleSelectionResponseChoices")]
 43        [Required()]
 44        public ICollection<string> Response
 45        {
 46            get
 47            {
 48                return this.response;
 49            }
 50
 51            set
 52            {
 53                if (this.response != value)
 54                {
 55                    this.ValidateProperty("Response", value);
 56                    this.response = value;
 57                    this.RaisePropertyChanged("Response");
 58                }
 59            }
 60        }
 61    }
 62
 63    /// <summary>
 64    /// The MultipleSelectionQuestionTemplate domain object class.
 65    /// </summary>
 66    public sealed partial class MultipleSelectionQuestionTemplate : QuestionTemplate
 67    {
 68        private int? maxSelections;
 69
 70        private string[] range;
 71
 72        /// <summary>
 73        /// Initializes a new instance of the <see cref="MultipleSelectionQuestionTemplate"/> class.
 74        /// </summary>
 75        public MultipleSelectionQuestionTemplate()
 76        {
 77        }
 78
 79        /// <summary>
 80        /// Gets or sets the MaxSelections value.
 81        /// </summary>
 82        public int? MaxSelections
 83        {
 84            get
 85            {
 86                return this.maxSelections;
 87            }
 88
 89            set
 90            {
 91                if (this.maxSelections != value)
 92                {
 93                    this.ValidateProperty("MaxSelections", value);
 94                    this.maxSelections = value;
 95                    this.RaisePropertyChanged("MaxSelections");
 96                }
 97            }
 98        }
 99
100        /// <summary>
101        /// Gets or sets the Range value.
102        /// </summary>
103        public string[] Range
104        {
105            get
106            {
107                return this.range;
108            }
109
110            set
111            {
112                if (this.range != value)
113                {
114                    this.ValidateProperty("Range", value);
115                    this.range = value;
116                    this.RaisePropertyChanged("Range");
117                }
118            }
119        }
120    }
121
122    /// <summary>
123    /// The NumericQuestion domain object class.
124    /// </summary>
125    public sealed partial class NumericQuestion : Question
126    {
127        private int? response;
128
129        /// <summary>
130        /// Initializes a new instance of the <see cref="NumericQuestion"/> class.
131        /// </summary>
132        public NumericQuestion()
133        {
134        }
135
136        /// <summary>
137        /// Gets or sets the Response value.
138        /// </summary>
139        [CustomValidation(typeof(CommonValidation), "ValidationNumericQuestionResponseRange")]
140        [Required()]
141        public int? Response
142        {
143            get
144            {
145                return this.response;
146            }
147
148            set
149            {
150                if (this.response != value)
151                {
152                    this.ValidateProperty("Response", value);
153                    this.response = value;
154                    this.RaisePropertyChanged("Response");
155                }
156            }
157        }
158    }
159
160    /// <summary>
161    /// The NumericQuestionTemplate domain object class.
162    /// </summary>
163    public sealed partial class NumericQuestionTemplate : QuestionTemplate
164    {
165        private int? maxValue;
166
167        /// <summary>
168        /// Initializes a new instance of the <see cref="NumericQuestionTemplate"/> class.
169        /// </summary>
170        public NumericQuestionTemplate()
171        {
172        }
173
174        /// <summary>
175        /// Gets or sets the MaxValue value.
176        /// </summary>
177        public int? MaxValue
178        {
179            get
180            {
181                return this.maxValue;
182            }
183
184            set
185            {
186                if (this.maxValue != value)
187                {
188                    this.ValidateProperty("MaxValue", value);
189                    this.maxValue = value;
190                    this.RaisePropertyChanged("MaxValue");
191                }
192            }
193        }
194    }
195
196    /// <summary>
197    /// The OpenQuestion domain object class.
198    /// </summary>
199    public sealed partial class OpenQuestion : Question
200    {
201        private string response;
202
203        /// <summary>
204        /// Initializes a new instance of the <see cref="OpenQuestion"/> class.
205        /// </summary>
206        public OpenQuestion()
207        {
208        }
209
210        /// <summary>
211        /// Gets or sets the Response value.
212        /// </summary>
213        [CustomValidation(typeof(CommonValidation), "ValidationOpenQuestionResponseLength")]
214        [Required()]
215        public string Response
216        {
217            get
218            {
219                return this.response;
220            }
221
222            set
223            {
224                if (this.response != value)
225                {
226                    this.ValidateProperty("Response", value);
227                    this.response = value;
228                    this.RaisePropertyChanged("Response");
229                }
230            }
231        }
232    }
233
234    /// <summary>
235    /// The OpenQuestionTemplate domain object class.
236    /// </summary>
237    public sealed partial class OpenQuestionTemplate : QuestionTemplate
238    {
239        private int maxLength;
240
241        /// <summary>
242        /// Initializes a new instance of the <see cref="OpenQuestionTemplate"/> class.
243        /// </summary>
244        public OpenQuestionTemplate()
245        {
246        }
247
248        /// <summary>
249        /// Gets or sets the MaxLength value.
250        /// </summary>
251        public int MaxLength
252        {
253            get
254            {
255                return this.maxLength;
256            }
257
258            set
259            {
260                if (this.maxLength != value)
261                {
262                    this.ValidateProperty("MaxLength", value);
263                    this.maxLength = value;
264                    this.RaisePropertyChanged("MaxLength");
265                }
266            }
267        }
268    }
269
270    /// <summary>
271    /// The Question domain object class.
272    /// </summary>
273    public abstract partial class Question : DomainObject
274    {
275        private QuestionTemplate questionTemplate;
276
277        /// <summary>
278        /// Initializes a new instance of the <see cref="Question"/> class.
279        /// </summary>
280        protected Question()
281        {
282        }
283
284        /// <summary>
285        /// Gets or sets the associated <see cref="QuestionTemplate"/> entity.
286        /// </summary>
287        public QuestionTemplate QuestionTemplate
288        {
289            get
290            {
291                return this.questionTemplate;
292            }
293
294            set
295            {
296                if (this.questionTemplate != value)
297                {
298                    this.ValidateProperty("QuestionTemplate", value);
299                    this.questionTemplate = value;
300                    this.RaisePropertyChanged("QuestionTemplate");
301                }
302            }
303        }
304    }
305
306    /// <summary>
307    /// The Questionnaire domain object class.
308    /// </summary>
309    public sealed partial class Questionnaire : DomainObject
310    {
311        private int? age;
312
313        private string name;
314
315        private ICollection<Question> questions;
316
317        private QuestionnaireTemplate template;
318
319        /// <summary>
320        /// Initializes a new instance of the <see cref="Questionnaire"/> class.
321        /// </summary>
322        public Questionnaire()
323        {
324        }
325
326        /// <summary>
327        /// Gets or sets the Age value.
328        /// </summary>
329        [Range(21, 100)]
330        public int? Age
331        {
332            get
333            {
334                return this.age;
335            }
336
337            set
338            {
339                if (this.age != value)
340                {
341                    this.ValidateProperty("Age", value);
342                    this.age = value;
343                    this.RaisePropertyChanged("Age");
344                }
345            }
346        }
347
348        /// <summary>
349        /// Gets or sets the Name value.
350        /// </summary>
351        [Required()]
352        [StringLength(50)]
353        public string Name
354        {
355            get
356            {
357                return this.name;
358            }
359
360            set
361            {
362                if (this.name != value)
363                {
364                    this.ValidateProperty("Name", value);
365                    this.name = value;
366                    this.RaisePropertyChanged("Name");
367                }
368            }
369        }
370
371        /// <summary>
372        /// Gets the collection of associated <see cref="Question"/> entities.
373        /// </summary>
374        public ICollection<Question> Questions
375        {
376            get
377            {
378                if (this.questions == null)
379                {
380                    this.questions = new List<Question>();
381                }
382
383                return this.questions;
384            }
385        }
386
387        /// <summary>
388        /// Gets or sets the associated <see cref="QuestionnaireTemplate"/> entity.
389        /// </summary>
390        public QuestionnaireTemplate Template
391        {
392            get
393            {
394                return this.template;
395            }
396
397            set
398            {
399                if (this.template != value)
400                {
401                    this.ValidateProperty("Template", value);
402                    this.template = value;
403                    this.RaisePropertyChanged("Template");
404                }
405            }
406        }
407    }
408
409    /// <summary>
410    /// The QuestionnaireTemplate domain object class.
411    /// </summary>
412    public sealed partial class QuestionnaireTemplate : DomainObject
413    {
414        private ICollection<QuestionTemplate> questions;
415
416        private string title;
417
418        /// <summary>
419        /// Initializes a new instance of the <see cref="QuestionnaireTemplate"/> class.
420        /// </summary>
421        public QuestionnaireTemplate()
422        {
423        }
424
425        /// <summary>
426        /// Gets the collection of associated <see cref="QuestionTemplate"/> entities.
427        /// </summary>
428        public ICollection<QuestionTemplate> Questions
429        {
430            get
431            {
432                if (this.questions == null)
433                {
434                    this.questions = new List<QuestionTemplate>();
435                }
436
437                return this.questions;
438            }
439        }
440
441        /// <summary>
442        /// Gets or sets the Title value.
443        /// </summary>
444        public string Title
445        {
446            get
447            {
448                return this.title;
449            }
450
451            set
452            {
453                if (this.title != value)
454                {
455                    this.ValidateProperty("Title", value);
456                    this.title = value;
457                    this.RaisePropertyChanged("Title");
458                }
459            }
460        }
461    }
462
463    /// <summary>
464    /// The QuestionTemplate domain object class.
465    /// </summary>
466    public abstract partial class QuestionTemplate : DomainObject
467    {
468        private string questionText;
469
470        /// <summary>
471        /// Initializes a new instance of the <see cref="QuestionTemplate"/> class.
472        /// </summary>
473        protected QuestionTemplate()
474        {
475        }
476
477        /// <summary>
478        /// Gets or sets the QuestionText value.
479        /// </summary>
480        public string QuestionText
481        {
482            get
483            {
484                return this.questionText;
485            }
486
487            set
488            {
489                if (this.questionText != value)
490                {
491                    this.ValidateProperty("QuestionText", value);
492                    this.questionText = value;
493                    this.RaisePropertyChanged("QuestionText");
494                }
495            }
496        }
497    }
498
499    /// <summary>
500    /// The QuestionnaireTemplateSummary domain object class.
501    /// </summary>
502    public sealed partial class QuestionnaireTemplateSummary : DomainObject
503    {
504        private string title;
505
506        private string description;
507
508        private int numberOfQuestions;
509
510        private float estimatedTime;
511
512        private int timesTaken;
513
514        /// <summary>
515        /// Initializes a new instance of the <see cref="QuestionnaireTemplateSummary"/> class.
516        /// </summary>
517        public QuestionnaireTemplateSummary()
518        {
519        }
520
521        /// <summary>
522        /// Gets or sets the Title value.
523        /// </summary>
524        public string Title
525        {
526            get
527            {
528                return this.title;
529            }
530
531            set
532            {
533                if (this.title != value)
534                {
535                    this.ValidateProperty("Title", value);
536                    this.title = value;
537                    this.RaisePropertyChanged("Title");
538                }
539            }
540        }
541
542        /// <summary>
543        /// Gets or sets the Description value.
544        /// </summary>
545        public string Description
546        {
547            get
548            {
549                return this.description;
550            }
551
552            set
553            {
554                if (this.description != value)
555                {
556                    this.ValidateProperty("Description", value);
557                    this.description = value;
558                    this.RaisePropertyChanged("Description");
559                }
560            }
561        }
562
563        /// <summary>
564        /// Gets or sets the NumberOfQuestions value.
565        /// </summary>
566        public int NumberOfQuestions
567        {
568            get
569            {
570                return this.numberOfQuestions;
571            }
572
573            set
574            {
575                if (this.numberOfQuestions != value)
576                {
577                    this.ValidateProperty("NumberOfQuestions", value);
578                    this.numberOfQuestions = value;
579                    this.RaisePropertyChanged("NumberOfQuestions");
580                }
581            }
582        }
583
584        /// <summary>
585        /// Gets or sets the EstimatedTime value.
586        /// </summary>
587        public float EstimatedTime
588        {
589            get
590            {
591                return this.estimatedTime;
592            }
593
594            set
595            {
596                if (this.estimatedTime != value)
597                {
598                    this.ValidateProperty("EstimatedTime", value);
599                    this.estimatedTime = value;
600                    this.RaisePropertyChanged("EstimatedTime");
601                }
602            }
603        }
604
605        /// <summary>
606        /// Gets or sets the TimesTaken value.
607        /// </summary>
608        public int TimesTaken
609        {
610            get
611            {
612                return this.timesTaken;
613            }
614
615            set
616            {
617                if (this.timesTaken != value)
618                {
619                    this.ValidateProperty("TimesTaken", value);
620                    this.timesTaken = value;
621                    this.RaisePropertyChanged("TimesTaken");
622                }
623            }
624        }
625    }
626
627    #endregion
628}