コード例 #1
0
        public TeamFormViewModel(Team team, IEnumerable <Borough> AllBoros, IEnumerable <Service> AllMHC)
        {
            this.ID          = team.ID;
            this.TeamName    = team.TeamName;
            this.FinanceCode = team.FinanceCode;
            this.LeaderID    = team.LeaderID;
            this.CohortID    = team.CohortID;
            this.NoTrain     = team.NoTrain;
            this.Members     = team.Members.ToArray();
            this.Boroughs    = new BoroughSelector[AllBoros.Count()];
            int i = 0;

            foreach (Borough b in AllBoros)
            {
                BoroughSelector bs = new BoroughSelector(b);
                bs.Selected = team.Boroughs.Contains(b);
                Boroughs[i] = bs;
                i++;
            }
            this.MHCs = new MHC[AllMHC.Count()];
            i         = 0;
            foreach (Service s in AllMHC)
            {
                MHC mhc = new MHC(s);
                mhc.Selected = team.Services.Contains(s);
                MHCs[i]      = mhc;
                i++;
            }
            this.Services = team.Services.Where(s => s.Level == ServiceLevel.Speciality && s.Display).ToArray();
        }
コード例 #2
0
        public PersonFormViewModel(Person person, IEnumerable <Flag> AllFlags, IEnumerable <Borough> AllBoros, IEnumerable <Service> AllMHC)
        {
            this.ID            = person.ID;
            this.TitleID       = person.TitleID;
            this.Forename      = person.Forename;
            this.Surname       = person.Surname;
            this.PreferredName = person.PreferredName;
            this.DisplayName   = person.GetFullName();
            this.Gender        = person.Gender;
            this.JobTitle      = person.JobTitle;
            this.FinanceCode   = person.FinanceCode;
            this.SubjectiveID  = person.SubjectiveID;
            this.LineManID     = person.LineManID;
            this.Phone         = person.Phone;
            this.Email         = person.Email;
            this.ESRID         = person.ESRID;
            this.MiddleName    = person.MiddleName;
            this.Comments      = person.Comments;
            this.CohortID      = person.CohortID;
            this.Flags         = new FlagSelector[AllFlags.Count()];
            int i = 0;

            foreach (Flag f in AllFlags)
            {
                FlagSelector fs = new FlagSelector(f);
                fs.Selected = person.Flags.Contains(f);
                Flags[i]    = fs;
                i++;
            }
            this.Boroughs = new BoroughSelector[AllBoros.Count()];
            i             = 0;
            foreach (Borough b in AllBoros)
            {
                BoroughSelector bs = new BoroughSelector(b);
                bs.Selected = person.Boroughs.Contains(b);
                Boroughs[i] = bs;
                i++;
            }
            this.MHCs = new MHC[AllMHC.Count()];
            i         = 0;
            foreach (Service s in AllMHC)
            {
                MHC mhc = new MHC(s);
                mhc.Selected = person.Services.Contains(s);
                MHCs[i]      = mhc;
                i++;
            }
            this.Services    = person.Services.Where(s => s.Level == ServiceLevel.Speciality && s.Display).ToArray();
            this.Memberships = person.MemberOf.ToArray();
        }