public ReservationViewModel(Reservation r) { Id = r.Id; DateDebut = r.DateDebut; DateFin = r.DateFin; Utilisateur = new UtilisateurViewModel(r.Utilisateur); Vehicule = new VehiculeViewModel(r.Vehicule); if (r.Cle != null) { Cle = new CleViewModel(r.Cle); } foreach (var personnel in r.Personnel_Reservations.Select(pr => pr.Personnel)) { Personnels.Add(new PersonnelViewModel(personnel)); } SiteDestination = r.SiteDestination; Description = r.Description; ConfirmationCle = r.ConfirmationCle; IsAccepted = r.IsAccepted; IsRejeted = r.IsRejeted; Status = (int)r.State; }
private void InitDepartments() { Log.InfoStart("InitDepartments"); Department dep0 = new Department() { Name = "根节点", ShowOrder = 0, Parent = null }; Departments.Add(dep0); Department dep11 = new Department() { Name = "四会电厂", ShowOrder = 0, Parent = dep0 }; Departments.Add(dep11); Department dep12 = new Department() { Name = "维修部门", ShowOrder = 0, Parent = dep11 }; Departments.Add(dep12); Department dep13 = new Department() { Name = "发电部门", ShowOrder = 1, Parent = dep11 }; Departments.Add(dep13); Department dep14 = new Department() { Name = "外委人员", ShowOrder = 2, Parent = dep11 }; Departments.Add(dep14); Department dep15 = new Department() { Name = "访客", ShowOrder = 0, Parent = dep11 }; Departments.Add(dep15); //Departments.AddRange(dep11, dep12, dep13, dep14, dep15); List <Tag> tagsT = Tags.DbSet.ToList(); if (tagsT.Count >= 1) { Post post = new Post() { Name = "前台" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "蔡小姐", Sex = "女", Tag = tagsT[0], Parent = dep11, Pst = post, WorkNumber = 1, PhoneNumber = "13546849866" }; Personnels.Add(Personnel1); } if (tagsT.Count >= 2) { Post post = new Post() { Name = "电工" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "刘先生", Sex = "男", Tag = tagsT[1], Parent = dep12, Pst = post, WorkNumber = 2, PhoneNumber = "13543544345" }; Personnels.Add(Personnel1); } if (tagsT.Count >= 3) { Post post = new Post() { Name = "维修工" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "陈先生", Sex = "男", Tag = tagsT[2], Parent = dep12, Pst = post, WorkNumber = 11, PhoneNumber = "13546849116" }; Personnels.Add(Personnel1); } if (tagsT.Count >= 4) { Post post = new Post() { Name = "保安" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "刘先生", Sex = "男", Tag = tagsT[3], Parent = dep11, Pst = post, WorkNumber = 12, PhoneNumber = "13546414256" }; Personnels.Add(Personnel1); } if (tagsT.Count >= 5) { Post post = new Post() { Name = "经理" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "邱先生", Sex = "男", Tag = tagsT[4], Parent = dep11, Pst = post, WorkNumber = 13, PhoneNumber = "13546578656" }; Personnels.Add(Personnel1); } if (tagsT.Count >= 6) { Post post = new Post() { Name = "电工" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "赵一男", Sex = "男", Tag = tagsT[5], Parent = dep11, Pst = post, WorkNumber = 14, PhoneNumber = "13546578656" }; Personnels.Add(Personnel1); } if (tagsT.Count >= 7) { Post post = new Post() { Name = "经理" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "刘清风", Sex = "男", Tag = tagsT[6], Parent = dep11, Pst = post, WorkNumber = 15, PhoneNumber = "13546578656" }; Personnels.Add(Personnel1); } if (tagsT.Count >= 8) { Post post = new Post() { Name = "经理" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "王依含", Sex = "女", Tag = tagsT[7], Parent = dep11, Pst = post, WorkNumber = 16, PhoneNumber = "13546578656" }; Personnels.Add(Personnel1); } for (int i = 0; i < 100; i++) { Post post = new Post() { Name = "访客" }; Posts.Add(post); Personnel Personnel1 = new Personnel() { Name = "张先生", Sex = "男", Parent = dep15, Pst = post, WorkNumber = 17 + i, PhoneNumber = "13546842227" }; Personnels.Add(Personnel1); } }