Beispiel #1
0
        //makes a group object with all
        public Models.Group GetSingleGroup(int id, Dal.AD ad, Dal.SQL sql)
        {
            List <Models.Person> members      = new List <Models.Person>();
            List <Models.Person> membersSmall = new List <Models.Person>();
            List <Models.Task>   tasks        = new List <Models.Task>();

            //makes the list of members
            membersSmall = sql.GetMemberList(id);
            foreach (Models.Person p in membersSmall)
            {
                Models.Person person = ad.GetUserInfo(p.UNI);
                members.Add(new Models.Person(person.Name, p.UNI, person.Studing, p.Admin));
            }

            //makes the list of tasks
            tasks = sql.GetTaskList(id, DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd HH:mm:ss"));

            //gets the base info about the group
            Models.Group group = sql.GetbasicInfoAboutGroup(id);

            //gets all the comments for that group
            List <Models.Comment> comments = sql.GetCommentList(id);

            for (int i = 0; i < comments.Count; i++)
            {
                comments[i] = new Models.Comment(comments[i].ID, ad.GetUserInfo(comments[i].Name).Name, comments[i].Datetime, comments[i].CommentText, true);
            }

            return(new Models.Group(group.Name, group.Id, group.Description, group.Complete, group.StartDate, members, tasks, comments, group.EndDate));
        }