Example #1
0
        public static int GetDumpFileAreaId(string mdbPath)
        {
            DumpDataSet ds = new DumpDataSet();

            OleDbConnection  conn = new OleDbConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", mdbPath));
            OleDbCommand     cmd  = new OleDbCommand("select * from config", conn);
            OleDbDataAdapter adap = new OleDbDataAdapter(cmd);

            adap.Fill(ds.Config);

            conn.Close();

            int?ret = null;

            if (ds.Config.Any(x => x.Key == "AreaId"))
            {
                ret = Convert.ToInt32(ds.Config.Where(x => x.Key == "AreaId").First().Val);
            }

            if (ret.HasValue)
            {
                return(ret.Value);
            }
            else
            {
                return(0);
            }
        }
Example #2
0
        public static void BuildStoryFlowDump(DumpDataSet ds, string saveFilePath)
        {
            XLWorkbook wb = new XLWorkbook();

            DataTable table = CreateTransformedUserFlowTable(ds);

            wb.Worksheets.Add(table, "UserStoryFlowByDay");

            wb.SaveAs(saveFilePath);
        }
Example #3
0
        public static DumpDataSet.WorkItemMetricsDataTable LoadWorkItemMetricsTable(string mdbFilePath, string sql)
        {
            DumpDataSet ds = new DumpDataSet();

            OleDbConnection  conn = new OleDbConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", mdbFilePath));
            OleDbCommand     cmd  = new OleDbCommand(sql, conn);
            OleDbDataAdapter adap = new OleDbDataAdapter(cmd);

            adap.Fill(ds.WorkItemMetrics);

            return(ds.WorkItemMetrics);
        }
Example #4
0
        private static string GetTags(DumpDataSet ds, int id)
        {
            string ret = "none";

            DumpDataSet.WorkItemRow wiRow = ds.WorkItem.FirstOrDefault(x => x.ID == id);
            if (wiRow != null && !wiRow.IsTagsNull())
            {
                ret = wiRow.Tags;
            }

            return(ret);
        }
Example #5
0
        public frmDynamicChart(string mdbFilePath, Connect conn, int areaId, string projectName) : this()
        {
            this.filePath = mdbFilePath;
            this.connect = conn;
            ds = VSCommon.LoadDumpDataset(filePath);

            lastDumpDate = ds.Config.Where(x => x.Key == "DumpDate").First().Val;

            dtStartDt.Value = new DateTime(2017,9,1);

            BuildCheckboxes();

        }
Example #6
0
        public static DumpDataSet.VW_All_CurrentDataTable LoadVW_All_CurrentTable(string mdbFilePath, string sql)
        {
            DumpDataSet ds = new DumpDataSet();

            OleDbConnection  conn = new OleDbConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", mdbFilePath));
            OleDbCommand     cmd  = new OleDbCommand(sql, conn);
            OleDbDataAdapter adap = new OleDbDataAdapter(cmd);

            ds.EnforceConstraints = false;
            adap.Fill(ds.VW_All_Current);

            return(ds.VW_All_Current);
        }
Example #7
0
        public static DumpDataSet LoadDumpDataset(string mdbFilePath)
        {
            DumpDataSet ds = new DumpDataSet();

            foreach (DataTable table in ds.Tables)
            {
                if (table.TableName.ToLower().StartsWith("vw"))
                {
                    table.PrimaryKey = null;
                }

                OleDbConnection  conn = new OleDbConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", mdbFilePath));
                OleDbCommand     cmd  = new OleDbCommand("select * from " + table.TableName, conn);
                OleDbDataAdapter adap = new OleDbDataAdapter(cmd);
                adap.Fill(table);
            }

            return(ds);
        }
Example #8
0
        public static DateTime?GetDumpDate(string mdbPath)
        {
            DumpDataSet ds = new DumpDataSet();

            OleDbConnection  conn = new OleDbConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", mdbPath));
            OleDbCommand     cmd  = new OleDbCommand("select * from config", conn);
            OleDbDataAdapter adap = new OleDbDataAdapter(cmd);

            adap.Fill(ds.Config);

            conn.Close();

            DateTime?ret = null;

            if (ds.Config.Any(x => x.Key == "DumpDate"))
            {
                ret = Convert.ToDateTime(ds.Config.Where(x => x.Key == "DumpDate").First().Val);
            }

            return(ret);
        }
Example #9
0
        public frmDevMetrics(string mdbFilePath, Connect conn, int areaId, string projectName) : this()
        {
            this.ProjectName = projectName;
            this.AreaID      = areaId;
            this.filePath    = mdbFilePath;
            this.connect     = conn;
            ds = VSCommon.LoadDumpDataset(filePath);

            lastDumpDate = ds.Config.Where(x => x.Key == "DumpDate").First().Val;

            chartDevelopment.Titles.Add(string.Format("{0} Stories (as of {1})", ProjectName, lastDumpDate));

            lstBoxCompletedWorkTFSStateList.DataSource = StaticUtil.CurrentFuzzFile.States.Select(x => x.Category).Distinct().ToList();

            GetFeatureOptions();

            RenderBugs();

            Render();

            SetStoryCumulativeFlowDefaultColors();
        }
Example #10
0
        private static DataTable CreateTransformedUserFlowTable(DumpDataSet ds)
        {
            DataTable table = new DataTable("Table1");


            table.Columns.Add(new DataColumn("ID", typeof(Int32)));
            table.Columns.Add(new DataColumn("Type", typeof(string)));
            table.Columns.Add(new DataColumn("Title", typeof(string)));
            table.Columns.Add(new DataColumn("Tags", typeof(string)));
            table.Columns.Add(new DataColumn("DayEnding", typeof(DateTime)));
            table.Columns.Add(new DataColumn("NewThisDay", typeof(bool)));
            table.Columns.Add(new DataColumn("ActiveThisDay", typeof(bool)));
            table.Columns.Add(new DataColumn("DayEndingState", typeof(string)));

            DumpDataSet.UserStoryFlow_ByDayRow row = ds.UserStoryFlow_ByDay.FirstOrDefault(x => x.ID > 0);

            for (int i = 1; i <= 15; i++)
            {
                string colName1 = string.Format("State{0}Desc", i);
                if (row.IsNull(colName1))
                {
                    continue;
                }
                else
                {
                    string newColName1 = $"Was_{row[colName1]}";
                    string newColName2 = $"Entered_{row[colName1]}";
                    table.Columns.Add(new DataColumn(newColName1, typeof(bool)));
                    table.Columns.Add(new DataColumn(newColName2, typeof(bool)));
                }
            }

            foreach (DataColumn col in table.Columns)
            {
                col.AllowDBNull = true;
            }

            foreach (DumpDataSet.UserStoryFlow_ByDayRow dayRow in ds.UserStoryFlow_ByDay)
            {
                DataRow newRow = table.NewRow();
                newRow["ID"]             = dayRow.ID;
                newRow["Type"]           = dayRow.Type;
                newRow["Title"]          = dayRow.Title;
                newRow["Tags"]           = GetTags(ds, dayRow.ID);
                newRow["DayEnding"]      = dayRow.DayEnding;
                newRow["NewThisDay"]     = dayRow.NewThisDay == 1;
                newRow["ActiveThisDay"]  = dayRow.ActiveThisDay == 1;
                newRow["DayEndingState"] = StaticUtil.CurrentFuzzFile.GetStates(dayRow.DayEndingState).First().Category;

                for (int i = 1; i <= 15; i++)
                {
                    string colName1    = string.Format("State{0}Desc", i);
                    string colNameBase = dayRow[colName1].ToString();

                    if (dayRow.IsNull(colName1))
                    {
                        continue;
                    }
                    else
                    {
                        string wasInCol   = string.Format("State{0}", i);
                        string enteredCol = string.Format("State{0}Entered", i);

                        string newColName1 = $"Was_{colNameBase}";
                        string newColName2 = $"Entered_{colNameBase}";

                        if (!dayRow.IsNull(wasInCol))
                        {
                            newRow[newColName1] = Convert.ToBoolean(dayRow[wasInCol]);
                        }
                        if (!dayRow.IsNull(enteredCol))
                        {
                            newRow[newColName2] = Convert.ToBoolean(dayRow[enteredCol]);
                        }
                    }
                }

                table.Rows.Add(newRow);
            }

            table.AcceptChanges();

            FillInBetweenStates(table);

            return(table);
        }
Example #11
0
        public static void CreateUserStoryCumulativeData(Connect connect, DumpDataSet ds, int areaId)
        {
            List <int> workItemClosed = new List <int>();

            var workItemRevisions = WorkItemUtil.GetWorkItemRevisions(ds.WorkItemRevision);

            if (StaticUtil.CurrentFuzzFile.MaxStateIndex > 15)
            {
                throw new Exception("UserStoryCumulativeFlow.CreateUserStoryCumulativeData cannot support more than 15 states.");
            }

            DateTime currentWeekEnding = FirstFriday(ds.WorkItem);

            while (currentWeekEnding <= LastFriday())
            {
                DateTime searchDate = new DateTime(currentWeekEnding.Year, currentWeekEnding.Month, currentWeekEnding.Day, 23, 59, 59);

                DateTime searchBeginning = searchDate.AddDays(-7);

                foreach (var workItem in Enumerable.Where(ds.WorkItem, x => x.CreatedDate <= searchDate))
                {
                    if (workItem.Type != "User Story" && workItem.Type != "Bug")
                    {
                        continue;
                    }

                    //all revisions up to searchDate
                    var revisions = workItemRevisions.Where(x => x.ID == workItem.ID && x.ChangedDate <= searchDate).OrderBy(y => y.Rev).ToList();

                    if (!revisions.Any())
                    {
                        continue;
                    }

                    DumpDataSet.UserStoryFlowRow row = ds.UserStoryFlow.NewUserStoryFlowRow();

                    row.ID              = workItem.ID;
                    row.Title           = workItem.Title;
                    row.Type            = workItem.Type;
                    row.WeekEndingState = StaticUtil.CurrentFuzzFile.GetCurrentWorkItemState(revisions.Last()).CategoryIndex;

                    if (workItem.CreatedDate <= searchDate && workItem.CreatedDate >= searchBeginning)
                    {
                        row.NewThisWeek = 1;
                    }


                    for (int i = StaticUtil.CurrentFuzzFile.MinStateIndex; i <= StaticUtil.CurrentFuzzFile.MaxStateIndex; i++)
                    {
                        row[string.Format("State{0}Desc", i)] = StaticUtil.CurrentFuzzFile.GetStates(i).First().Category;

                        if (StaticUtil.CurrentFuzzFile.WasInState(revisions, i, searchBeginning, searchDate))
                        {
                            row[string.Format("State{0}", i)] = 1;
                        }
                        else
                        {
                            row[string.Format("State{0}", i)] = 0;
                        }

                        if (StaticUtil.CurrentFuzzFile.EnteredState(revisions, i, searchBeginning, searchDate))
                        {
                            row[string.Format("State{0}Entered", i)] = 1;
                        }
                        else
                        {
                            row[string.Format("State{0}Entered", i)] = 0;
                        }
                    }

                    row.WeekEnding = currentWeekEnding;

                    if (row.IsNewThisWeekNull())
                    {
                        row.NewThisWeek = 0;
                    }

                    if (!row.IsState2Null() && row.State2 == 1)
                    {
                        row.ActiveThisWeek = 1;
                    }
                    if (!row.IsState4Null() && row.State4 == 1)
                    {
                        row.ActiveThisWeek = 1;
                    }

                    if (row.IsActiveThisWeekNull())
                    {
                        row.ActiveThisWeek = 0;
                    }

                    //closed logic should be:  state was <=4 before this week, and >=5 by the end of this week
                    bool wasInClosedDuringThisWeek = row.WeekEndingState >= 5;
                    bool wasClosedBeforeThisWeek   = false;

                    var latestRevFromLastWeek = revisions.Where(x => x.ChangedDate < searchBeginning)
                                                .OrderBy(x => x.Rev).LastOrDefault();
                    if (latestRevFromLastWeek != null)
                    {
                        if (latestRevFromLastWeek.LifecycleState >= 5)
                        {
                            wasClosedBeforeThisWeek = true;
                        }
                    }

                    row.Closed = (wasInClosedDuringThisWeek || wasClosedBeforeThisWeek) ? 1 : 0;

                    if (!wasClosedBeforeThisWeek && wasInClosedDuringThisWeek)
                    {
                        row.ClosedThisWeek = 1;
                    }
                    else
                    {
                        row.ClosedThisWeek = 0;
                    }


                    ds.UserStoryFlow.AddUserStoryFlowRow(row);
                }

                currentWeekEnding = currentWeekEnding.AddDays(7);
            }
        }