Пример #1
0
        private void LoadSuspectedCurrentProject(ArrayList alProjects)
        {
            if (alProjects.Count > 0)
            {
                // Ok we have projects but which one is the Current project?
                // probably the last written to?
                FileInfo finfoLatest = null;

                foreach (FileInfo finfo in alProjects)
                {
                    if (finfoLatest == null)
                    {
                        finfoLatest = finfo;
                    }

                    if (finfo.LastWriteTime > finfoLatest.LastWriteTime)
                    {
                        finfoLatest = finfo;
                    }
                }

                // finfoLatest should now be the Current Project !!
                // so save the information to Properties so that the rest of the app can get the information easily
                frmMainLog("Loading Suspected Current Project", LoggingEnumerations.LogEventTypes.Warning);
                LoadProject.OpenProject(finfoLatest);
            }
            else
            {
                frmMainLog("There are no projects currently available.");
            }
        }
Пример #2
0
 public void SetHeadUser(List <LoadIssue> listLoadOpenIssue)
 {
     foreach (LoadIssue loadOpenIssue in listLoadOpenIssue)
     {
         LoadProject loadProject = listLoadProject.Find(x => x.userProject.Id == loadOpenIssue.issue.Project.Id);
         if (loadProject != null)
         {
             loadOpenIssue.NameHeadUser  = loadProject.userProject.NameHeadUser;
             loadOpenIssue.EmailHeadUser = loadProject.userProject.EmailHeadUser;
         }
     }
 }
Пример #3
0
        public IssueDayForm(LoadProject loadProject, Manager manager, TypeView typeView, TypeView typeViewSelect, string tracker)
        {
            InitializeComponent();
            this.IDLoadProject  = loadProject.userProject.Id;
            this.tracker        = tracker;
            this.manager        = manager;
            this.typeView       = typeView;
            this.typeViewSelect = typeViewSelect;

            MakeCaptionColumnsDWH();
            ShowLoad_TimeDWH();
        }
Пример #4
0
        private void ShowIssueDayForm(LoadProject loadProject, TypeView typeView)
        {
            string text = "Просроченные задачи по проекту ";

            //if (typeView == TypeView.LoadIssueDWH)
            //    text = "Запланировано на ";
            //if (typeView == TypeView.LoadTimeDWH)
            //    text = "Факт на ";

            issueMonthForm  = new IssueDayForm(loadProject, manager, typeView, typeViewSelect, "");
            manager.Update += issueMonthForm.UpdateIssueInfo;
            //DateTime dateText = new DateTime(year, month, 1);
            issueMonthForm.Text = text + loadProject.userProject.Name;
            issueMonthForm.Show();
        }
Пример #5
0
        private void MakeLineTrackerToListView(ref int iLine, int numberYear, LoadProject loadProject)
        {
            List <string> listLine   = new List <string>();
            LoadYWH       loadYWHcur = loadProject.listLoadYWH.Find(x => x.NumberYear == numberYear);

            if (loadYWHcur != null)
            {
                foreach (string tracker in loadYWHcur.listEstimTracker)
                {
                    listLine.Add(tracker);
                    SetLineToListView(listLine, loadYWHcur, listLoadMWH);
                    iLine++;
                    listLine.Clear();
                }
            }
        }
Пример #6
0
        private void emailSend_Click(object sender, EventArgs e)
        {
            if (listLoadMWH.Items.Count > 0)
            {
                manager.listEmailMessage.Clear();
                if (listLoadMWH.SelectedIndices.Count > 0)
                {
                    for (int i = 0; i < listLoadMWH.SelectedIndices.Count; i++)
                    {
                        ListViewItem lvi = listLoadMWH.Items[listLoadMWH.SelectedIndices[i]];
                        if (lvi.Tag is LoadProject)
                        {
                            LoadProject loadProject = (LoadProject)lvi.Tag;
                            string      title       = "Redmine просроченные задания по проекту " + loadProject.userProject.Name;
                            manager.MakeEmailMessages(loadProject.listLoadOpenIssue, title);

                            ReportForm report = new ReportForm(manager, title, TypeView.ReportEmail);
                            report.Text = title;

                            //foreach (var note in manager.EmailSaveIssue.Journals)
                            //{
                            //    MessageBox.Show(note.Notes);
                            //}

                            report.Show();
                        }

                        if (lvi.Tag is LoadUser)
                        {
                            LoadUser loadUser = (LoadUser)lvi.Tag;
                            string   title    = "Redmine просроченные задания специалиста " + loadUser.user.LastName + " " +
                                                loadUser.user.FirstName;
                            manager.MakeEmailMessages(loadUser.listLoadOpenIssue, title);

                            ReportForm report = new ReportForm(manager, title, TypeView.ReportEmail);
                            report.Text = title;
                            report.Show();
                        }
                    }
                    manager.SendEmail();
                    manager.SaveDateToRedmineEmailIssue();
                }
            }
        }
Пример #7
0
        public void CreateListLoadProject()
        {
            listLoadProject.Clear();

            int    countWorkUser       = GetCountWorkUsers();
            double maxYearHumansHours  = countWorkUser * 12;
            double maxMonthHumansHours = countWorkUser;

            foreach (Project project in redmineData.listProject)
            {
                UserProject userProject = new UserProject(redmineData, project.Name, project.Id);
                LoadProject loadProject = new LoadProject(redmineData, userProject);

                foreach (int year in listYear)
                {
                    loadProject.AddYear(maxYearHumansHours, maxMonthHumansHours, year);
                }

                listLoadProject.Add(loadProject);
                SetHeadUser(loadProject.listLoadOpenIssue);
            }
        }
Пример #8
0
 private void LoadReportedCurrentProject()
 {
     frmMainLog("Loading Reported Current Project", LoggingEnumerations.LogEventTypes.Success);
     LoadProject.OpenProject(Properties.Settings.Default.CurrentProjectPath);
 }
Пример #9
0
        private void ShowLoad_TimeDWH()
        {
            List <string> list = new List <string>();

            listLoadDWH.Items.Clear();
            ListViewItem lvi;

            string[] array;
            int      iLine = 0;

            if (item is LoadProject)
            {
                LoadProject loadProject = manager.listLoadProject.Find(x => x.Id == this.IDitem);
                if (loadProject != null)
                {
                    LoadYWH loadYWH = loadProject.listLoadYWH.Find(x => x.NumberYear == this.year);
                    loadMWH = loadYWH.listLoadMWH.Find(x => x.numberMonth == this.month);
                }
            }

            if (item is LoadUser)
            {
                LoadUser loadUser_cur = (item as LoadUser);
                if (loadUser_cur.GroupName.Trim() == loadUser_cur.Name.Trim())
                {
                    LoadGroup loadGroup = manager.listLoadGroup.Find(x => x.Name.Equals(loadUser_cur.GroupName));
                    if (loadGroup != null)
                    {
                        LoadUser loadUser = loadGroup.listLoadUser.Find(x => x.Id == loadUser_cur.Id);
                        if (loadUser != null)
                        {
                            LoadYWH loadYWH = manager.FindLoadYWH(year, loadUser.listLoadYWH);
                            loadMWH = loadYWH.listLoadMWH.Find(x => x.numberMonth == this.month);
                        }
                    }
                }
                else
                {
                    LoadUser loadUser = manager.listLoadUser.Find(x => x.Id == this.IDitem);
                    if (loadUser != null)
                    {
                        LoadYWH loadYWH = loadUser.listLoadYWH.Find(x => x.NumberYear == this.year);
                        loadMWH = loadYWH.listLoadMWH.Find(x => x.numberMonth == this.month);
                    }
                }
            }

            if (item is LoadYWH)
            {
                LoadYWH loadYWH = manager.listLoadYWH.Find(x => x.NumberYear == (item as LoadYWH).NumberYear);
                if (loadYWH != null)
                {
                    loadMWH = loadYWH.listLoadMWH.Find(x => x.numberMonth == this.month);
                }
            }

            if (loadMWH != null)
            {
                loadMWH.GetListLoadProject(this.tracker);
                loadMWH.listLoadIssue.Sort();
                loadMWH.listLoadTimeEntry.Sort();
            }

            switch (typeView)
            {
            case TypeView.LoadShortExpUser:
                LoadUser loadUser = manager.listLoadUser.Find(x => x.user.Id == IDLoadUser);
                if (loadUser != null)
                {
                    foreach (LoadIssue loadIssue in loadUser.listLoadOpenIssue)
                    {
                        if (loadIssue.isExperied)
                        {
                            AddLineLoadExperiedIssue(loadIssue);
                        }
                    }
                }
                break;

            case TypeView.LoadShortExpProject:
                LoadProject loadProject = manager.listLoadProject.Find(x => x.userProject.Id == IDLoadProject);
                if (loadProject != null)
                {
                    foreach (LoadIssue loadIssue in loadProject.listLoadOpenIssue)
                    {
                        if (loadIssue.isExperied)
                        {
                            AddLineLoadExperiedIssue(loadIssue);
                        }
                        iLine++;
                    }
                }
                break;

            case TypeView.LoadShortIssueDWH:
                foreach (LoadProject loadProject_cur in loadMWH.listLoadProject)
                {
                    list.Clear();

                    string[] line = { loadProject_cur.userProject.Id.ToString(),
                                      loadProject_cur.userProject.Name,
                                      loadProject_cur.EstimatedMWH(this.tracker).ToString("0.0") };
                    foreach (string s in line)
                    {
                        list.Add(s);
                    }

                    array = list.Select(i => i.ToString()).ToArray();
                    lvi   = new ListViewItem(array);
                    listLoadDWH.Items.Add(lvi);

                    SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal);

                    iLine++;
                }

                list.Clear();



                string[] lineSumShortIssue = { "",
                                               "Итого",
                                               loadMWH.EstimatedMonthHours(this.tracker).ToString("0.0") };

                foreach (string s in lineSumShortIssue)
                {
                    list.Add(s);
                }

                array = list.Select(i => i.ToString()).ToArray();
                lvi   = new ListViewItem(array);
                listLoadDWH.Items.Add(lvi);

                SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal);

                AutoFitColumn(listLoadDWH);

                break;

            case TypeView.LoadShortTimeDWH:
                foreach (LoadProject loadProject_cur in loadMWH.listLoadProject)
                {
                    list.Clear();

                    string[] line = { loadProject_cur.userProject.Id.ToString(),
                                      loadProject_cur.userProject.Name,
                                      loadProject_cur.FactMWH(this.tracker).ToString("0.0") };
                    foreach (string s in line)
                    {
                        list.Add(s);
                    }

                    array = list.Select(i => i.ToString()).ToArray();
                    lvi   = new ListViewItem(array);
                    listLoadDWH.Items.Add(lvi);

                    SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal);

                    iLine++;
                }

                list.Clear();



                string[] lineSumShortTime = { "",
                                              "Итого",
                                              loadMWH.FactMonthHours(this.tracker).ToString("0.0") };

                foreach (string s in lineSumShortTime)
                {
                    list.Add(s);
                }

                array = list.Select(i => i.ToString()).ToArray();
                lvi   = new ListViewItem(array);
                listLoadDWH.Items.Add(lvi);

                SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal);

                AutoFitColumn(listLoadDWH);

                break;

            case TypeView.LoadIssueDWH:
                foreach (LoadIssue loadIssue in loadMWH.listLoadIssue)
                {
                    if (this.tracker.Contains(loadIssue.issue.Tracker.Name) || this.tracker.Equals("план"))
                    {
                        User user = manager.redmineData.listUser.Find(x => x.Id == loadIssue.issue.AssignedTo.Id);
                        list.Clear();

                        string userName = "";
                        if (user != null)
                        {
                            userName = user.LastName + " " + user.FirstName;
                        }
                        else
                        {
                            userName = loadIssue.issue.AssignedTo.Name;
                        }

                        string[] line = { loadIssue.issue.Id.ToString(),
                                          loadIssue.issue.Project.Name,
                                          loadIssue.issue.Subject,
                                          loadIssue.dateStartIssue.ToShortDateString(),
                                          loadIssue.dateFinishIssue.ToShortDateString(),
                                          loadIssue.estimatedIssueHours.ToString("0.0"),
                                          userName };
                        foreach (string s in line)
                        {
                            list.Add(s);
                        }

                        foreach (LoadDWH loadDWH in loadIssue.listLoadDWH)
                        {
                            list.Add(loadDWH.hoursDay.ToString("0.0"));
                        }
                        array = list.Select(i => i.ToString()).ToArray();
                        lvi   = new ListViewItem(array);
                        listLoadDWH.Items.Add(lvi);

                        SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal);

                        if (this.typeViewSelect == TypeView.LoadUser)
                        {
                            SetColorValue(listLoadDWH, iLine, array, 8, Color.Red, Operation.More);
                        }

                        iLine++;
                    }
                }

                list.Clear();



                string[] lineSum = { "",
                                     "Итого в день",
                                     "",
                                     loadMWH.dateStartMonth.ToShortDateString(),
                                     loadMWH.dateFinishMonth.ToShortDateString(),
                                     loadMWH.EstimatedMonthHours(this.tracker).ToString("0.0"),
                                     "" };

                foreach (string s in lineSum)
                {
                    list.Add(s);
                }

                foreach (LoadDWH loadDWH in loadMWH.listLoadDWH)
                {
                    list.Add(loadDWH.hoursDay.ToString("0.0"));
                }

                array = list.Select(i => i.ToString()).ToArray();
                lvi   = new ListViewItem(array);
                listLoadDWH.Items.Add(lvi);

                SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal);

                if (this.typeViewSelect == TypeView.LoadUser)
                {
                    SetColorValue(listLoadDWH, iLine, array, 8, Color.Red, Operation.More);
                }

                AutoFitColumn(listLoadDWH);

                break;

            case TypeView.LoadTimeDWH:

                foreach (LoadTimeEntry loadTime in loadMWH.listLoadTimeEntry)
                {
                    if (this.tracker.Contains(loadTime.userTime.time.Activity.Name) || this.tracker.Equals("факт"))
                    {
                        User user = manager.redmineData.listUser.Find(x => x.Id == loadTime.userTime.time.User.Id);
                        list.Clear();

                        string userName = "";
                        if (user != null)
                        {
                            userName = user.LastName + " " + user.FirstName;
                        }
                        else
                        {
                            userName = loadTime.userTime.nameUser;
                        }

                        string[] line = { loadTime.userTime.time.Id.ToString(),
                                          loadTime.userTime.nameProject,
                                          loadTime.userTime.subject,
                                          loadTime.dateStart.ToShortDateString(),
                                          loadTime.dateFinish.ToShortDateString(),
                                          loadTime.factMonthHours.ToString("0.0"),
                                          userName };
                        foreach (string s in line)
                        {
                            list.Add(s);
                        }

                        foreach (LoadDWH loadDWH in loadTime.listLoadDWH)
                        {
                            list.Add(loadDWH.factDayHours.ToString("0.0"));
                        }
                        array = list.Select(i => i.ToString()).ToArray();
                        lvi   = new ListViewItem(array);
                        listLoadDWH.Items.Add(lvi);

                        SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal);

                        if (this.typeViewSelect == TypeView.LoadUser)
                        {
                            SetColorValue(listLoadDWH, iLine, array, 8, Color.Red, Operation.More);
                        }

                        iLine++;
                    }
                }

                list.Clear();



                string[] lineSumTime = { "",
                                         "Итого в день",
                                         "",
                                         loadMWH.dateStartMonth.ToShortDateString(),
                                         loadMWH.dateFinishMonth.ToShortDateString(),
                                         loadMWH.FactMonthHours(this.tracker).ToString("0.0"),
                                         "" };

                foreach (string s in lineSumTime)
                {
                    list.Add(s);
                }

                foreach (LoadDWH loadDWH in loadMWH.listLoadDWH)
                {
                    list.Add(loadDWH.factDayHours.ToString("0.0"));
                }

                array = list.Select(i => i.ToString()).ToArray();
                lvi   = new ListViewItem(array);
                listLoadDWH.Items.Add(lvi);

                SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal);

                if (this.typeViewSelect == TypeView.LoadUser)
                {
                    SetColorValue(listLoadDWH, iLine, array, 8, Color.Red, Operation.More);
                }

                AutoFitColumn(listLoadDWH);

                break;
            }
        }
Пример #10
0
        private void AddLineNameGroup(ref int iLine,
                                      int numberYear,
                                      int numItem,
                                      ListView listOut,
                                      LoadYWH loadYWH   = null,
                                      LoadUser loadUser = null, LoadGroup loadGroup = null, LoadProject loadProject = null)
        {
            List <string> listLine = new List <string>();
            bool          isGroup  = false;

            if (loadGroup != null)
            {
                if (loadUser.user.LastName.Equals(loadGroup.name))
                {
                    isGroup = true;
                    string[]     lineGroup = { numItem.ToString() /*numGroup.ToString()*/, loadUser.user.LastName, "", loadGroup.CountUser.ToString(), "" };
                    ListViewItem lvi_group = new ListViewItem(lineGroup);
                    lvi_group.Font = new Font(lvi_group.Font, FontStyle.Bold);
                    lvi_group.Tag  = loadUser;
                    listOut.Items.Add(lvi_group);
                    iLine++;

                    MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadUser: loadUser);

                    LoadYWH loadYWHcur = loadUser.listLoadYWH.Find(x => x.NumberYear == numberYear);
                    if (loadYWHcur != null)
                    {
                        foreach (string tracker in loadYWHcur.listEstimTracker)
                        {
                            MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadUser: loadUser);
                        }
                    }

                    MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadUser: loadUser);
                    if (loadYWHcur != null)
                    {
                        foreach (string tracker in loadYWHcur.listTimeTracker)
                        {
                            MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadUser: loadUser);
                        }
                    }
                }
            }

            if ((loadUser != null) & (!isGroup) & (loadGroup == null))
            {
                string groupName = "";

                if (loadGroup == null)
                {
                    foreach (UserGroupRedmine group in loadUser.listGroup)
                    {
                        if (groupName == "")
                        {
                            groupName += group.name;
                        }
                        else
                        {
                            groupName += ";" + group.name;
                        }
                    }
                }

                string[]     lineName = { numItem.ToString() /*numUser.ToString()*/, loadUser.user.LastName + " " + loadUser.user.FirstName,
                                          groupName,                                     "", "" };
                ListViewItem lvi_name = new ListViewItem(lineName);
                lvi_name.Font = new Font(lvi_name.Font, FontStyle.Bold);
                lvi_name.Tag  = loadUser;
                listOut.Items.Add(lvi_name);
                iLine++;

                if (typeView != TypeView.LoadExperiedUser)
                {
                    //вывод на следующей строке данных по факту и плану
                    MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadUser: loadUser);

                    LoadYWH loadYWHcur = loadUser.listLoadYWH.Find(x => x.NumberYear == numberYear);
                    if (loadYWHcur != null)
                    {
                        foreach (string tracker in loadYWHcur.listEstimTracker)
                        {
                            MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadUser: loadUser);
                        }
                    }

                    MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadUser: loadUser);

                    if (loadYWHcur != null)
                    {
                        foreach (string tracker in loadYWHcur.listTimeTracker)
                        {
                            MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadUser: loadUser);
                        }
                    }
                }
            }

            if (loadProject != null)
            {
                DateTime startProject = loadProject.StartProject;
                DateTime finishProject = loadProject.FinishProject;
                string   start, finish;

                if (startProject.CompareTo(DateTime.MaxValue) == 0)
                {
                    start = "-";
                }
                else
                {
                    start = startProject.ToShortDateString();
                }

                if (finishProject.CompareTo(DateTime.MinValue) == 0)
                {
                    finish = "-";
                }
                else
                {
                    finish = finishProject.ToShortDateString();
                }

                string[] lineName = { numItem.ToString() /*numUser.ToString()*/,                   loadProject.userProject.Name, loadProject.userProject.NameHeadUser,
                                      start,                                                       finish,
                                      loadProject.PercentFinance(numberYear).ToString("0") + " %",
                                      loadProject.PercentWork(numberYear).ToString("0") + " %",    "" };

                ListViewItem lvi_name = new ListViewItem(lineName);
                lvi_name.Font = new Font(lvi_name.Font, FontStyle.Bold);
                lvi_name.Tag  = loadProject;
                listOut.Items.Add(lvi_name);
                iLine++;

                MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadProject: loadProject);
                LoadYWH loadYWHcur = loadProject.listLoadYWH.Find(x => x.NumberYear == numberYear);
                if (loadYWHcur != null)
                {
                    foreach (string tracker in loadYWHcur.listEstimTracker)
                    {
                        MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadProject: loadProject);
                    }
                }
                //MakeLineTrackerToListView(ref iLine, numberYear, loadProject);
                MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadProject: loadProject);
                if (loadYWHcur != null)
                {
                    foreach (string tracker in loadYWHcur.listTimeTracker)
                    {
                        MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadProject: loadProject);
                    }
                }

                //MakeLineTrackerToListView(ref iLine, numberYear, loadProject);

                //if (typeView == TypeView.LoadProject)
                //{

                //}

                if (typeView == TypeView.LoadProjectUser)
                {
                    foreach (LoadUser lU in loadProject.listLoadUser)
                    {
                        string[] lineNameU = { numItem.ToString() /*numUser.ToString()*/, lU.user.LastName + " " + lU.user.FirstName,
                                               lU.GroupName,
                                               "",                                        "",
                                               "",                                        "", "" };

                        ListViewItem lvi_nameU = new ListViewItem(lineNameU);
                        lvi_nameU.Font = new Font(lvi_nameU.Font, FontStyle.Bold);
                        lvi_nameU.Tag  = lU;
                        listOut.Items.Add(lvi_nameU);
                        iLine++;

                        MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadUser: lU);

                        loadYWHcur = lU.listLoadYWH.Find(x => x.NumberYear == numberYear);
                        if (loadYWHcur != null)
                        {
                            foreach (string tracker in loadYWHcur.listEstimTracker)
                            {
                                MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadUser: lU);
                            }
                        }

                        MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadUser: lU);

                        if (loadYWHcur != null)
                        {
                            foreach (string tracker in loadYWHcur.listTimeTracker)
                            {
                                MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadUser: lU);
                            }
                        }
                    }
                }
            }

            if (loadYWH != null)
            {
                string[]     lineName = { numItem.ToString(), "Планирование план/факт на " + numberYear.ToString(), "" };
                ListViewItem lvi_name = new ListViewItem(lineName);
                lvi_name.Font = new Font(lvi_name.Font, FontStyle.Bold);
                listOut.Items.Add(lvi_name);
                iLine++;

                MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadYWH: loadYWH);

                if (loadYWH != null)
                {
                    foreach (string tracker in loadYWH.listEstimTracker)
                    {
                        MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadYWH: loadYWH);
                    }
                }

                MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadYWH: loadYWH);

                if (loadYWH != null)
                {
                    foreach (string tracker in loadYWH.listTimeTracker)
                    {
                        MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadYWH: loadYWH);
                    }
                }
            }
        }
Пример #11
0
        private void MakeLineToListView(ref int iLine,
                                        int numberYear, string value, ref List <string> listLine, ListView listOut,
                                        LoadYWH loadYWH = null, LoadUser loadUser = null, LoadProject loadProject = null)
        {
            LoadYWH loadYWHcur;
            int     num = 1;

            if (loadUser != null)
            {
                loadYWHcur = manager.FindLoadYWH(numberYear, loadUser.listLoadYWH);
            }
            else
            {
                if (loadProject != null)
                {
                    loadYWHcur = manager.FindLoadYWH(numberYear, loadProject.listLoadYWH);
                }
                else
                {
                    loadYWHcur = loadYWH;
                }
            }

            string sl   = "";
            string perc = "";

            if (value.Contains("план"))
            {
                sl   = loadYWHcur.EstimatedYHumans(value).ToString("0.0") + "/" + loadYWHcur.EstimatedYWH(value).ToString("0.0");
                perc = loadYWHcur.EstimatedPercentYHumans(value).ToString("0") + " %";
            }
            else
            {
                sl   = loadYWHcur.FactYHumans(value).ToString("0.0") + "/" + loadYWHcur.FactYWH(value).ToString("0.0");
                perc = loadYWHcur.FactPercentYHumans(value).ToString("0") + " %";
            }

            listLine = new List <string>();

            switch (typeView)
            {
            case TypeView.LoadGroup:
                listLine.Add("");
                listLine.Add(value);
                listLine.Add(perc);
                listLine.Add("");
                listLine.Add(sl);
                break;

            case TypeView.LoadProject:
                listLine.Add("");
                listLine.Add(value);
                listLine.Add("");
                listLine.Add("");
                listLine.Add("");
                listLine.Add("");
                listLine.Add("");
                listLine.Add(sl);
                break;

            case TypeView.LoadProjectUser:
                listLine.Add("");
                listLine.Add(value);
                listLine.Add("");
                listLine.Add("");
                listLine.Add("");
                listLine.Add("");
                listLine.Add("");
                listLine.Add(sl);
                break;

            case TypeView.LoadExperiedProject:
                listLine.Add("");
                listLine.Add(value);
                listLine.Add("");
                listLine.Add("");
                listLine.Add("");
                listLine.Add(sl);
                break;

            case TypeView.LoadUser:
                listLine.Add("");
                listLine.Add(value);
                listLine.Add("");
                listLine.Add("");
                listLine.Add(sl);
                break;

            case TypeView.LoadExperiedUser:
                listLine.Add("");
                listLine.Add(value);
                listLine.Add("");
                listLine.Add("");
                listLine.Add(sl);
                break;

            case TypeView.LoadYWH:
                listLine.Add("");
                listLine.Add(value);
                listLine.Add(perc);
                listLine.Add(sl);
                break;
            }

            AddLineLoad(loadYWHcur, ref listLine);

            SetLineToListView(listLine, loadYWHcur, listOut);

            //string[] lineLoadColor = listLine.Select(i => i.ToString()).ToArray();

            List <Color> listColor = new List <Color>();

            if (value.Contains("план"))
            {
                listColor.Add(loadYWHcur.YearEstimatedColor(value));
                foreach (LoadMWH loadMWH in loadYWHcur.listLoadMWH)
                {
                    listColor.Add(loadMWH.MonthEstimatedColor(value));
                }
            }

            if (value.Contains("факт"))
            {
                listColor.Add(loadYWHcur.YearFactColor(value));
                foreach (LoadMWH loadMWH in loadYWHcur.listLoadMWH)
                {
                    listColor.Add(loadMWH.MonthFactColor(value));
                }
            }

            SetColorValue(listOut, iLine, listColor);
            num++;
            iLine++;

            //------------------------------------------------//
        }
Пример #12
0
        //private void ShowUser_GroupDWH(int year, int month)
        //{
        //    LoadYWH loadYWH;
        //    if (listDescription.Items.Count > 0)
        //    {
        //        for (int i = 0; i < listDescription.SelectedIndices.Count; i++)
        //        {
        //            //MessageBox.Show(((LoadUser)listItems.Items[listItems.SelectedIndices[i]].Tag).user.LastName);
        //            LoadUser loadUser = (LoadUser)listDescription.Items[listDescription.SelectedIndices[i]].Tag;
        //            if (loadUser != null)
        //            {
        //                loadYWH = manager.FindLoadYWH(year, loadUser.listLoadYWH);
        //                if (loadYWH != null)
        //                {
        //                    LoadMWH loadMWH = loadYWH.FindLoadMWH(month);
        //                    if (loadMWH != null)
        //                    {
        //                        ShowIssueDayForm(loadMWH, year, month);
        //                    }
        //                    else
        //                        MessageBox.Show(month.ToString() + " месяца не существует!");
        //                }
        //            }
        //        }
        //    }
        //}

        //private void ShowYearDWH(int year, int month)
        //{
        //    LoadYWH loadYWH = manager.FindLoadYWH(year, manager.listLoadYWH);
        //    if (loadYWH != null)
        //    {
        //        LoadMWH loadMWH = loadYWH.FindLoadMWH(month);
        //        if (loadMWH != null)
        //        {
        //            ShowIssueDayForm(loadMWH, year, month);
        //        }
        //        else
        //            MessageBox.Show(month.ToString() + " месяца не существует!");
        //    }
        //}

        private void listLoad_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            int colIndex;

            if (typeView == TypeView.LoadExperiedProject | typeView == TypeView.LoadExperiedUser)
            {
                colIndex = Convert.ToInt16(e.Column.ToString());
                if (listLoadMWH.Items.Count > 0)
                {
                    if (listLoadMWH.SelectedIndices.Count > 0)
                    {
                        for (int i = 0; i < listLoadMWH.SelectedIndices.Count; i++)
                        {
                            ListViewItem lvi = listLoadMWH.Items[listLoadMWH.SelectedIndices[i]];
                            if (lvi.Tag is LoadProject)
                            {
                                LoadProject loadProject = (LoadProject)lvi.Tag;
                                ShowIssueDayForm(loadProject, TypeView.LoadShortExpProject);
                            }
                            if (lvi.Tag is LoadUser)
                            {
                                LoadUser loadUser = (LoadUser)lvi.Tag;
                                ShowIssueDayForm(loadUser, TypeView.LoadShortExpUser);
                            }
                        }
                    }
                }
            }
            else
            {
                if (comboYear.Items.Count != 0)
                {
                    colIndex = Convert.ToInt16(e.Column.ToString());
                    int month = ++colIndex - tabIndex;
                    //MessageBox.Show(colIndex.ToString());
                    int year = Convert.ToInt16(comboYear.SelectedItem.ToString());

                    if (listLoadMWH.Items.Count > 0)
                    {
                        if (listLoadMWH.SelectedIndices.Count > 0)
                        {
                            for (int i = 0; i < listLoadMWH.SelectedIndices.Count; i++)
                            {
                                ListViewItem lvi = listLoadMWH.Items[listLoadMWH.SelectedIndices[i]];
                                if (lvi.Tag is LoadYWH)
                                {
                                    LoadYWH loadYWH = (LoadYWH)lvi.Tag;
                                    LoadMWH loadMWH = loadYWH.FindLoadMWH(month);
                                    if (loadMWH != null)
                                    {
                                        //loadMWH.GetListLoadProject();
                                        string tracker = listLoadMWH.Items[listLoadMWH.SelectedIndices[i]].SubItems[1].Text;
                                        if (tracker.Contains("план"))
                                        {
                                            //ShowIssueDayForm(loadMWH, year, month, TypeView.LoadShortIssueDWH);
                                            //MessageBox.Show("plan");
                                            ShowIssueDayForm(loadMWH, year, month, TypeView.LoadIssueDWH, tracker);
                                        }

                                        if (tracker.Contains("факт"))
                                        {
                                            //ShowIssueDayForm(loadMWH, year, month, TypeView.LoadShortTimeDWH);
                                            //MessageBox.Show("plan");
                                            ShowIssueDayForm(loadMWH, year, month, TypeView.LoadTimeDWH, tracker);
                                        }
                                    }
                                    //MessageBox.Show("i = " + i.ToString() + "lvi.index = " + lvi.Index.ToString());
                                }
                            }
                        }
                    }
                }
            }
        }