private void AddTFSItemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmRecalculateHours oRec = new frmRecalculateHours
            {
                Location = Cursor.Position
            };

            oRec.openType = frmRecalculateHours.OpenType.TFS;
            if (oRec.ShowDialog() == DialogResult.OK)
            {
                if (int.TryParse(oRec.dHours.ToString(), out int iId))
                {
                    WorkItemRegister oWi = null;
                    foreach (var oDataSource in oDataSources.Where(x => x.Type == Datasourcetype.TFS))
                    {
                        if (oWi == null)
                        {
                            oWi = WorkItemMapper.GetHistoricalWorkitemsByIDs(oDataSource.ServerUrl, oDataSource.ProjectName, oDataSource.User, new int[] { iId }).FirstOrDefault();
                            if (oWi != null)
                            {
                                lvwHistory.Items.Add(WorkItemHoursToLVWItem(lvwHistory.SelectedItems[0].Group, WorkItemToWIHours(oWi, null, oDataSource, 0)));
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Coulnd't parse the TFS ID, please try again with an integer");
                }
            }
        }
        private void LoadTFSCSV()
        {
            frmLoginSendHaxCom oLogin = new frmLoginSendHaxCom {
                LoginURL = TimeKeeperBaseURL
            };

            oLogin.openMode        = frmLoginSendHaxCom.OpenMode.Search;
            oLogin.optDays.Enabled = false;
            oLogin.optSel.Enabled  = false;
            if (oLogin.ShowDialog() == DialogResult.OK)
            {
                List <WorkItemsDay> oItems = new List <WorkItemsDay>();
                List <CsvReg>       regs   = getHaxComTFSTime(oLogin.PHPSession, dtpFrom.Value, DateTime.Today, oLogin.chkAll.Checked, (oLogin.CHKBug.Checked || oLogin.chkPBI.Checked || oLogin.chkOther.Checked), oLogin.chkMeeting.Checked, oLogin.chkPrjtLess.Checked, oLogin.chkNonBillable.Checked, oLogin.chkCapitalized.Checked);
                var oDataSource            = oDataSources.First(x => x.Type == Datasourcetype.TFS);
                var outlookDataSource      = oDataSources.FirstOrDefault(x => x.Type == Datasourcetype.Outlook);
                //gets rest of TFS data using the TFS IDS
                var tfsItems = WorkItemMapper.GetHistoricalWorkitemsByIDs(oDataSource.ServerUrl, oDataSource.ProjectName, oDataSource.User, regs.Select(x => x.TFSId).Distinct());
                //assembles the listview
                foreach (DateTime dDate in regs.Select(x => x.Date).Distinct())
                {
                    var oTemp = new WorkItemsDay(dDate);
                    foreach (CsvReg oReg in regs.Where(x => x.Date == dDate))
                    {
                        if (oReg.TFSId == 0) //meetings
                        {
                            var oWI = new WorkItemHours();
                            oWI.HaxComID       = oReg.EntryID;
                            oWI.ID             = "meeting";
                            oWI.ProjectId      = 0;
                            oWI.ClientId       = 166;
                            oWI.SubClientId    = 5;
                            oWI.Function       = 41; //dev meeting
                            oWI.Description    = oReg.Title;
                            oWI.Title          = oReg.Title;
                            oWI.FromDatasource = outlookDataSource;
                            oWI.BillingType    = BillingType.Capitalized;
                            oWI.HaxComHours    = oReg.Hours;
                            oTemp.WorkItems.Add(oWI);
                        }
                        else
                        {
                            var oTFSI = tfsItems.FirstOrDefault(x => x.ID == oReg.TFSId.ToString());
                            if (oTFSI != null)
                            {
                                string sType = oTFSI.Type.ToUpperInvariant();
                                if (oLogin.chkAll.Checked || (sType == "BUG" && oLogin.CHKBug.Checked) || (sType == "USER STORY" && oLogin.chkPBI.Checked) ||
                                    (sType != "BUG" && sType != "PRODUCT BACKLOG ITEM" && oLogin.chkOther.Checked))
                                {
                                    oTemp.WorkItems.Add(WorkItemToWIHours(oTFSI, oReg.EntryID, oDataSource, oReg.Hours));
                                }
                            }
                        }
                    }
                    oItems.Add(oTemp);
                }
                UpdateListview(oItems, false);
            }
        }