Пример #1
0
        public void CreateListLoadGroup()
        {
            foreach (LoadGroup loadGroup in listLoadGroup)
            {
                User user = new User();
                user.LastName = loadGroup.name;
                user.Id       = loadGroup.id;
                UserGroupRedmine userGroupRedmine = new UserGroupRedmine(loadGroup.name, loadGroup.id);

                LoadUser loadUserGroup = new LoadUser(redmineData, user);
                loadUserGroup.listGroup.Add(userGroupRedmine);
                loadGroup.listLoadUser.Insert(0, loadUserGroup);
            }

            foreach (LoadGroup loadGroup in listLoadGroup)
            {
                int    countWorkUser       = loadGroup.CountUser;
                double maxYearHumansHours  = countWorkUser * 12;
                double maxMonthHumansHours = countWorkUser;

                foreach (LoadUser loadUser in loadGroup.listLoadUser)
                {
                    foreach (int year in listYear)
                    {
                        if (loadUser.listLoadYWH.Count < listYear.Count)
                        {
                            loadUser.AddYear(maxYearHumansHours, maxMonthHumansHours, year, redmineData.listProject, loadGroup.listLoadUser);
                        }
                    }
                }
            }
        }
Пример #2
0
        public void GetUser_GroupFromRedmine()
        {
            NameValueCollection parametr;

            redmineData.listUser.Clear();
            listLoadUser.Clear();
            listLoadGroup.Clear();

            try
            {
                parametr = new NameValueCollection {
                    { "user_id", "*" }
                };
                foreach (User user in redmineManager.GetObjects <User>(parametr))
                {
                    redmineData.listUser.Add(user);
                    LoadUser loadUser = new LoadUser(redmineData, user);
                    listLoadUser.Add(loadUser);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error - " + ex.Message);
            }

            try
            {
                parametr = new NameValueCollection {
                    { "group_id", "*" }
                };
                foreach (Group group in redmineManager.GetObjects <Group>(parametr))
                {
                    UserGroupRedmine userGroup     = new UserGroupRedmine(group.Name, group.Id);
                    LoadGroup        loadGroup     = new LoadGroup(group.Name, group.Id, redmineData.listIssue);
                    LoadGroup        findLoadGroup = listLoadGroup.Find(x => x.id == loadGroup.id);

                    if (findLoadGroup == null)
                    {
                        listLoadGroup.Add(loadGroup);
                        findLoadGroup = loadGroup;
                    }

                    foreach (User user in redmineManager.GetObjects <User>(new NameValueCollection {
                        { "group_id", group.Id.ToString() }
                    }))
                    {
                        LoadUser loadUser = listLoadUser.Find(x => x.user.Id == user.Id);

                        if (loadUser != null)
                        {
                            loadUser.listGroup.Add(userGroup);

                            LoadUser findLoadUser = findLoadGroup.listLoadUser.Find(x => x.user.Id == loadUser.user.Id);
                            if (findLoadUser == null)
                            {
                                findLoadGroup.listLoadUser.Add(loadUser);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error -" + ex.Message);
            }
        }