コード例 #1
0
ファイル: Chart.cs プロジェクト: lijielife/PerfectTrade
        /// <summary>
        /// Add a new data set to the chart.
        /// </summary>
        /// <param name="data">The datacontainer that contains the data to be visualized.</param>
        /// <param name="LineType">The color of the pen used to draw this data on the chart.</param>
        /// <param name="strLabel">A label, that describes the data in the chart's legend.</param>
        public void Add(DataContainer data, LineType type, string strLabel)
        {
            PlotSet plotset = new PlotSet();

            plotset.Label    = strLabel;
            plotset.Data     = data;
            plotset.LineType = type;

            m_plotsets.Add(plotset);

            if (m_fromDate == null || m_fromDate > data.OldestDate)
            {
                m_fromDate = data.OldestDate.Clone();
            }

            if (m_toDate == null || m_toDate < data.YoungestDate)
            {
                m_toDate = data.YoungestDate.Clone();
            }

            foreach (WorkDate workdate in data.Dates)
            {
                if (m_dMinValue > data[workdate])
                {
                    m_dMinValue = data[workdate];
                }

                if (m_dMaxValue < data[workdate])
                {
                    m_dMaxValue = data[workdate];
                }
            }
        }
コード例 #2
0
ファイル: VNAScreen.cs プロジェクト: 101010b/AudioProcessor2
 public void saveTrace()
 {
     if (current == null)
     {
         return;
     }
     if (root.running)
     {
         return;
     }
     current.absA.color.color = Color.Gray;
     current.logA.color.color = Color.Gray;
     for (int i = 0; i < current.absB.Length; i++)
     {
         current.absB[i].color.color  = Color.Gray;
         current.absBA[i].color.color = Color.Gray;
         current.phiBA[i].color.color = Color.Gray;
         current.logB[i].color.color  = Color.Gray;
         current.logBA[i].color.color = Color.Gray;
     }
     plotSet.Insert(0, current);
     root.vnaMemoryList.Items.Insert(0, current.name);
     root.vnaMemoryList.SelectedIndex = 0;
     current = null;
     updatePlot1();
     updatePlot2();
     Invalidate();
 }
コード例 #3
0
ファイル: VNAScreen.cs プロジェクト: 101010b/AudioProcessor2
        private PlotTrace[] getTrace(PlotSet p, VNA.vnaconfig.PlotMode mode)
        {
            if (p == null)
            {
                return(null);
            }
            switch (mode)
            {
            case VNA.vnaconfig.PlotMode.absA: return(new PlotTrace[1] {
                    p.absA
                });

            case VNA.vnaconfig.PlotMode.absB: return(p.absB);

            case VNA.vnaconfig.PlotMode.absBA: return(p.absBA);

            case VNA.vnaconfig.PlotMode.phiBA: return(p.phiBA);

            case VNA.vnaconfig.PlotMode.logA: return(new PlotTrace[1] {
                    p.logA
                });

            case VNA.vnaconfig.PlotMode.logB: return(p.logB);

            case VNA.vnaconfig.PlotMode.logBA: return(p.logBA);

            case VNA.vnaconfig.PlotMode.phiA: return(new PlotTrace[1] {
                    p.phiA
                });

            case VNA.vnaconfig.PlotMode.phiB: return(p.phiB);
            }
            return(null);
        }
コード例 #4
0
ファイル: VNAScreen.cs プロジェクト: 101010b/AudioProcessor2
        public VNAScreen()
        {
            InitializeComponent();

            DoubleBuffered = true;

            ylableSize = GraphicsUtil.sizeText(_axesFont, "199.0", 2, 0, 0).boundingDim();
            xlableSize = GraphicsUtil.sizeText(_axesFont, "20.00k", 2, 0, 0).boundingDim();

            newSize();

            dualDisplay = false;
            plot1Mode   = VNA.vnaconfig.PlotMode.logBA;
            plot2Mode   = VNA.vnaconfig.PlotMode.phiBA;

            logX = true;

            brushBack = new SolidBrush(_colorBack);
            penSelect = new Pen(_colorSelect);

            if (root == null)
            {
                x = new GridCalculator(0.1, 100000, 1, 0.1, 1.1, 100, 20000, logX, xleft, xright, xlableSize.x);
            }
            else
            {
                x = new GridCalculator(0.1, 100000, 1, 0.1, 1.1, root.vna.config.sweepFMin, root.vna.config.sweepFMax, logX, xleft, xright, xlableSize.x);
            }

            y1 = new GridCalculator(-200, 200, 1, 1, 1.1, -100, 20, false, yd1bottom, yd1top, ylableSize.y);
            y2 = new GridCalculator(-200, 200, 1, 1, 1.1, -180, 180, false, yd2bottom, yd2top, ylableSize.y);

            plot1 = new Plot(x, y1);
            plot2 = new Plot(x, y2);

            plot1.fontText       = _axesFont;
            plot1.colorBack      = _colorBack;
            plot1.colorFrame     = _colorFrame;
            plot1.colorGrid      = _colorGrid;
            plot1.colorGridMajor = _colorGridMajor;
            plot1.colorText      = _colorText;

            plot2.fontText       = _axesFont;
            plot2.colorBack      = _colorBack;
            plot2.colorFrame     = _colorFrame;
            plot2.colorGrid      = _colorGrid;
            plot2.colorGridMajor = _colorGridMajor;
            plot2.colorText      = _colorText;

            plotSet = new List <PlotSet>();
            current = null;
        }
コード例 #5
0
 public static void Plot(GraphPane gp, DataSet ds, int x, int y, PlotSet ps)
 {
     if (x < 0 || y < 0 || x >= ds.AttributesCount || y >= ds.AttributesCount)
     {
         MessageBox.Show("Invalid x or y axis values");
         return;
     }
     gp.XAxis.Title.Text = gp.XAxis.Title.Text = "Attribute #" + (x + 1);
     gp.YAxis.Title.Text = gp.YAxis.Title.Text = "Attribute #" + (y + 1);
     if (ps == PlotSet.Data)
     {
         PointPairList ppl = new PointPairList();
         foreach (Obj o in ds.Objects)
         {
             ppl.Add(o.Attributes[x], o.Attributes[y]);
         }
         LineItem li = gp.AddCurve(null, ppl, Color.Gray, SymbolType.Diamond);
         li.Line.IsVisible = false;
     }
     else if (ps == PlotSet.Hierarchy)
     {
         for (int i = 0; i < ds.Hierarchy.Count; i++)
         {
             PointPairList ppl = new PointPairList();
             foreach (Obj o in ds.Hierarchy[i].Objects)
             {
                 ppl.Add(o.Attributes[x], o.Attributes[y]);
             }
             LineItem li = gp.AddCurve(null, ppl, colors[i], SymbolType.Diamond);
             li.Line.IsVisible = false;
         }
     }
     else
     {
         for (int i = 0; i < ds.KMeans.Count; i++)
         {
             PointPairList ppl = new PointPairList();
             foreach (Obj o in ds.KMeans[i].Objects)
             {
                 ppl.Add(o.Attributes[x], o.Attributes[y]);
             }
             LineItem li = gp.AddCurve(null, ppl, colors[i], SymbolType.Diamond);
             li.Line.IsVisible = false;
         }
     }
 }
コード例 #6
0
ファイル: VNAScreen.cs プロジェクト: 101010b/AudioProcessor2
        public void addTraces(
            PlotTrace _absA,
            PlotTrace[] _absB,
            PlotTrace[] _absBA,
            PlotTrace[] _phiBA,
            PlotTrace _logA,
            PlotTrace[] _logB,
            PlotTrace[] _logBA,
            PlotTrace _phiA,
            PlotTrace[] _phiB)
        {
            PlotSet t = new PlotSet();

            t.name  = DateTime.Now.ToLongDateString();
            t.absA  = _absA;
            t.absB  = (PlotTrace[])_absB.Clone();
            t.absBA = (PlotTrace[])_absBA.Clone();
            t.phiBA = (PlotTrace[])_phiBA.Clone();
            t.logA  = _logA;
            t.logB  = (PlotTrace[])_logB.Clone();
            t.logBA = (PlotTrace[])_logBA.Clone();
            t.phiA  = _phiA;
            t.phiB  = (PlotTrace[])_phiB.Clone();

            current = t;
            for (int i = 0; i < _absB.Length; i++)
            {
                current.absB[i].color.color  = getTraceColor(i);
                current.absBA[i].color.color = getTraceColor(i);
                current.phiBA[i].color.color = getTraceColor(i);
                current.logB[i].color.color  = getTraceColor(i);
                current.logBA[i].color.color = getTraceColor(i);
            }

            updatePlot1();
            updatePlot2();

            Invalidate();
        }
コード例 #7
0
        public PlotSet errorBercutWithOther(DateTime startDate, int stepBacklogTime, int stepLeadTime)
        {
            #region Запрос номеров таск из TFS, удовлетворяющих запросу
            var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://tfs.tele2.ru/tfs/Main/Tele2/_apis/wit/wiql?api-version=3.0");
            httpWebRequest.Method      = "POST";
            httpWebRequest.Credentials = new NetworkCredential("user", "password");
            httpWebRequest.ContentType = "application/json; charset=utf-8; api-version=3.0";
            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string ErrorBercutWithOther =
                    "{" + "\"query\":" + "\"" +
                    "select[System.Id], " +
                    "[System.CreatedDate], " +
                    "[Microsoft.VSTS.Common.ActivatedDate], " +
                    "[Microsoft.VSTS.Common.ClosedDate], " +
                    "[System.WorkItemType], " +
                    "[System.Title], " +
                    "[System.State], " +
                    "[System.AreaPath], " +
                    "[System.IterationPath], " +
                    "[System.Tags] from WorkItems where " +
                    "[System.TeamProject] = @project and " +
                    "([System.WorkItemType] = 'Ошибка' and " +
                    "[System.CreatedBy] in " +
                    @"('Гордеев Александр Валериевич <T2RU\\a.gordeev>', " +
                    @"'Муратов Михаил Александрович <T2RU\\mikhail.muratov>', " +
                    @"'Юренков Станислав Сергеевич <T2RU\\supp.Dynamics21>', " +
                    @"'Евланов Сергей Леонидович <T2RU\\sergey.evlanov>', " +
                    @"'Семенов Антон Юрьевич <T2RU\\anton.y.semenov>', " +
                    @"'Кораблёва Екатерина Викторовна <T2RU\\supp.Dynamics11>', " +
                    @"'Иванов Арсений Дмитриевич <T2RU\\Supp.Dynamics02>', " +
                    @"'Анисимов Максим Александрович <T2RU\\supp.Dynamics12>', " +
                    @"'Фокин Андрей Геннадьевич <T2RU\\supp.Dynamics19>', " +
                    @"'Свидэрский Николай Сергеевич <T2RU\\nikolay.svidersky>', " +
                    @"'Панфилова Наталья Геннадьевна <T2RU\\natalya.panfilova>', " +
                    @"'Смирнов Фёдор Леонидович <T2RU\\supp.Dynamics20>', " +
                    @"'Большакова Мария Владимировна <T2RU\\supp.Dynamics17>', " +
                    @"'Чубукина Татьяна Сергеевна <T2RU\\Supp.Dynamics10>', " +
                    @"'Нижников Виталий Сергеевич <T2RU\\vitaly.nizhnikov>', " +
                    @"'Недоступ Александр Николаевич <T2RU\\alexander.nedostup>', " +
                    @"'Курилюк Антон Викторович <T2RU\\anton.kurilyuk>', " +
                    @"'Бондарчук Евгений Маркович <T2RU\\Supp.Dynamics08>', " +
                    @"'Чистяков Максим Сергеевич <T2RU\\supp.Dynamics18>', " +
                    @"'Манукян Ашот Каренович <T2RU\\ashot.manukyan>', " +
                    @"'Моисеева Ольга Алексеевна <T2RU\\supp.DSuite29>', " +
                    @"'Струнников Артем Сергеевич <T2RU\\supp.bercut120>', " +
                    @"'Калашников Дмитрий Юрьевич <T2RU\\dmitry.y.kalashnikov>', " +
                    @"'Полях Виктор Васильевич <T2RU\\victor.polyakh>', " +
                    @"'Глушков Сергей Иванович <T2RU\\Supp.Dynamics05>', " +
                    @"'Остапенко Сергей Сергеевич <T2RU\\sergey.ostapenko>', " +
                    @"'Жиряков Дмитрий Владимирович <T2RU\\supp.Dynamics15>', " +
                    @"'Тришечкин Евгений Владимирович <T2RU\\Supp.Dynamics06>', " +
                    @"'Хромина Ольга Анатольевна <T2RU\\olga.khromina>', " +
                    @"'Арсеньева Юлия Андреевна <T2RU\\supp.Dynamics16>', " +
                    @"'Артюков Иван Алексеевич <T2RU\\Supp.Dynamics03>', " +
                    @"'Сибакова Евгения Александровна <T2RU\\evgenia.sibakova>', " +
                    @"'Хрупин Дмитрий Владимирович <T2RU\\dmitry.khrupin>', " +
                    @"'Сологуб Николай Сергеевич <T2RU\\Supp.Dynamics24>') and " +
                    @"[System.AreaPath] in ('Tele2\\Партнеры\\Беркут\\Product testing') and " +
                    "[System.Reason] <> 'Не является ошибкой' and " +
                    "[System.Reason] <> 'Отклонена' and " +
                    "not [System.Tags] contains 'Техническое' and " +
                    "[System.Tags] contains 'Other' or " +
                    "([System.WorkItemType] = 'Ошибка' and " +
                    @"[System.AreaPath] = 'Tele2\\CRM\\CRM Team Bercut' and " +
                    "[System.Reason] <> 'Отклонена' and " +
                    "[System.Reason] <> 'Не является ошибкой' and " +
                    "[System.Tags] contains 'Other' and " +
                    "not [System.Tags] contains 'Техническое')) " +
                    "order by[Microsoft.VSTS.Common.ClosedDate] " +
                    "\"" +
                    "}";

                streamWriter.Write(ErrorBercutWithOther);
                streamWriter.Flush();
                streamWriter.Close();
            }
            var     httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            dynamic resultOfQuery;
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                resultOfQuery = streamReader.ReadToEnd();
            }
            Report result = JsonConvert.DeserializeObject <Report>(resultOfQuery);
            #endregion

            FinalResult FINAL = new FinalResult();
            FINAL.resultItems = new List <ResultItem>();
            ResultItem finalResult = new ResultItem();

            ItemInfoHelper itemInfoHelper = new ItemInfoHelper();
            FINAL.resultItems = itemInfoHelper.getItemInfo(finalResult, result, FINAL);

            //Считаем LeadTime и BackLogTime для каждой таски
            foreach (ResultItem i in FINAL.resultItems)
            {
                if (i.value[0].fields.ActivatedDate != null && i.value[0].fields.CreatedDate != null)
                {
                    i.value[0].backlogTime = (int)(DateTime.Parse(i.value[0].fields.ActivatedDate) - DateTime.Parse(i.value[0].fields.CreatedDate)).TotalDays;
                }
                if (i.value[0].fields.ClosedDate != null && i.value[0].fields.ActivatedDate != null)
                {
                    i.value[0].leadTime = (int)(DateTime.Parse(i.value[0].fields.ClosedDate) - DateTime.Parse(i.value[0].fields.ActivatedDate)).TotalDays;
                }
            }

            TaskReportHelper    taskReportHelper    = new TaskReportHelper();
            BacklogReportHelper backlogReportHelper = new BacklogReportHelper();
            LeadReportHelper    leadReportHelper    = new LeadReportHelper();

            PlotSet plotResult = new PlotSet();
            plotResult.PlotList = new List <PlotData>();
            plotResult.PlotList.Add(taskReportHelper.formTaskReport(FINAL, startDate));
            plotResult.PlotList.Add(backlogReportHelper.fromBacklogReport(FINAL, stepBacklogTime, startDate));
            plotResult.PlotList.Add(leadReportHelper.formLeadReport(FINAL, stepLeadTime, startDate));
            return(plotResult);
        }
コード例 #8
0
        public PlotSet teamAS(DateTime startDate, int stepBacklogTime, int stepLeadTime)
        {
            #region Запрос номеров таск из TFS, удовлетворяющих запросу
            var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://tfs.tele2.ru/tfs/Main/Tele2/_apis/wit/wiql?api-version=3.0");
            httpWebRequest.Method      = "POST";
            httpWebRequest.Credentials = new NetworkCredential("user", "password");
            httpWebRequest.ContentType = "application/json; charset=utf-8; api-version=3.0";
            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string jsonTeamAS = "{" + "\"query\":" + "\"" +
                                    "SELECT[System.Id], " +
                                    "[System.CreatedDate], " +
                                    "[Microsoft.VSTS.Common.ActivatedDate], " +
                                    "[Microsoft.VSTS.Common.ClosedDate], " +
                                    "[System.State], " +
                                    "[System.IterationPath], " +
                                    "[System.WorkItemType], " +
                                    "[System.Title], " +
                                    "[System.AssignedTo], " +
                                    "[System.AreaPath], " +
                                    "[System.Tags] " +
                                    "FROM WorkItems WHERE[System.TeamProject] = @project and " +
                                    "[System.WorkItemType] = 'Требование' and " +
                                    @"[System.AreaPath] under 'Tele2\\CRM' and " +
                                    @"([System.AreaPath] = 'Tele2\\CRM\\CRM Team A' or " +
                                    @"[System.AreaPath] = 'Tele2\\CRM\\CRM Support') and " +
                                    @"not [System.IterationPath] under 'Tele2\\Партнеры\\CRM\\АРМ Troubleshooting' and " +
                                    @"[System.IterationPath] <> 'Tele2\\Партнеры\\CRM\\Отклоненные' and " +
                                    "not [System.Tags] contains 'Интеграция' and not[System.Tags] contains 'Биллинг' and " +
                                    "[System.State] <> 'New' and " +
                                    "not [System.Tags] contains 'Техническое' and " +
                                    "not [System.Tags] contains 'Без разработки' and " +
                                    "not [System.Tags] contains 'Орг вопросы' and " +
                                    "not [System.Tags] contains 'HLR' and " +
                                    "not [System.Tags] contains 'Trash' and " +
                                    "[System.Reason] <> 'Отклонено' and " +
                                    "not [System.Reason] contains 'Пропала необходимость'  " +
                                    "ORDER BY [Microsoft.VSTS.Common.ClosedDate] " +
                                    "\"" +
                                    "}";

                streamWriter.Write(jsonTeamAS);
                streamWriter.Flush();
                streamWriter.Close();
            }
            var     httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            dynamic resultOfQuery;
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                resultOfQuery = streamReader.ReadToEnd();
            }
            Report result = JsonConvert.DeserializeObject <Report>(resultOfQuery);
            #endregion

            FinalResult FINAL = new FinalResult();
            FINAL.resultItems = new List <ResultItem>();
            ResultItem finalResult = new ResultItem();

            ItemInfoHelper itemInfoHelper = new ItemInfoHelper();
            FINAL.resultItems = itemInfoHelper.getItemInfo(finalResult, result, FINAL);

            //Считаем LeadTime и BackLogTime для каждой таски
            foreach (ResultItem i in FINAL.resultItems)
            {
                if (i.value[0].fields.ActivatedDate != null && i.value[0].fields.CreatedDate != null)
                {
                    i.value[0].fields.CreatedDate   = i.value[0].fields.CreatedDate.Substring(0, 10);
                    i.value[0].fields.ActivatedDate = i.value[0].fields.ActivatedDate.Substring(0, 10);
                    i.value[0].backlogTime          = (int)(DateTime.Parse(i.value[0].fields.ActivatedDate) - DateTime.Parse(i.value[0].fields.CreatedDate)).TotalDays;
                }

                if (i.value[0].fields.ClosedDate != null && i.value[0].fields.ActivatedDate != null)
                {
                    i.value[0].fields.ActivatedDate = i.value[0].fields.ActivatedDate.Substring(0, 10);
                    i.value[0].fields.ClosedDate    = i.value[0].fields.ClosedDate.Substring(0, 10);
                    i.value[0].leadTime             = (int)(DateTime.Parse(i.value[0].fields.ClosedDate) - DateTime.Parse(i.value[0].fields.ActivatedDate)).TotalDays;
                }
            }

            TaskReportHelper    taskReportHelper    = new TaskReportHelper();
            BacklogReportHelper backlogReportHelper = new BacklogReportHelper();
            LeadReportHelper    leadReportHelper    = new LeadReportHelper();

            PlotSet plotResult = new PlotSet();
            plotResult.PlotList = new List <PlotData>();
            plotResult.PlotList.Add(taskReportHelper.formTaskReport(FINAL, startDate));
            plotResult.PlotList.Add(backlogReportHelper.fromBacklogReport(FINAL, stepBacklogTime, startDate));
            plotResult.PlotList.Add(leadReportHelper.formLeadReport(FINAL, stepLeadTime, startDate));
            return(plotResult);
        }
コード例 #9
0
        public PlotSet allIntegrationOnlyBilling(DateTime startDate, int stepBacklogTime, int stepLeadTime, string queryId)
        {
            #region Запрос номеров таск из TFS, удовлетворяющих запросу
            var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://tfs.tele2.ru/tfs/Main/Tele2/_apis/wit/wiql?api-version=3.0");
            httpWebRequest.Method      = "POST";
            httpWebRequest.Credentials = new NetworkCredential("service.crm.tfs", "$93aCZApFsW");
            httpWebRequest.ContentType = "application/json; charset=utf-8; api-version=3.0";
            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                QueryModel queryModel = new QueryHelper(Configuration).GetByIdHelper(queryId);
                string     AllIntegration_OnlyBilling =
                    "{" + "\"query\":" + "\"" +
                    "select [System.Id], " +
                    "[System.CreatedDate], " +
                    "[Microsoft.VSTS.Common.ActivatedDate], " +
                    "[Microsoft.VSTS.Common.ClosedDate], " +
                    "[System.WorkItemType], " +
                    "[System.Title], " +
                    "[System.AssignedTo], " +
                    "[System.State], " +
                    "[System.AreaPath], " +
                    "[System.Tags] from WorkItems where " +
                    "[System.TeamProject] = @project and " +
                    "[System.WorkItemType] = 'Требование' and " +
                    @"[System.AreaPath] under 'Tele2\\CRM' and " +
                    @"[System.AreaPath] <> 'Tele2\\CRM\\CRM Team Bercut' and " +
                    @"[System.AreaPath] <> 'Tele2\\CRM\\CRM Team AutoTests' and " +
                    @"not [System.IterationPath] under 'Tele2\\Партнеры\\CRM\\АРМ Troubleshooting\\Отклоненные' and " +
                    @"not [System.IterationPath] under 'Tele2\\Партнеры\\CRM\\Отклоненные' and " +
                    "([System.Tags] contains 'Беркут' or " +
                    "[System.Tags] contains 'Биллинг') and not " +
                    "[System.Tags] contains 'Trash' and " +
                    "[System.State] <> 'New' and not " +
                    "[System.Tags] contains 'Без разработки' and " +
                    "not [System.Tags] contains 'Техническое' and " +
                    "not [System.Reason] contains 'Пропала необходимость' and " +
                    "[System.Reason] <> 'Отклонено' " +
                    "order by[Microsoft.VSTS.Common.ClosedDate] " +
                    "\"" +
                    "}";

                streamWriter.Write(queryModel.Query);
                streamWriter.Flush();
                streamWriter.Close();
            }
            var     httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            dynamic resultOfQuery;
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                resultOfQuery = streamReader.ReadToEnd();
            }
            Report result = JsonConvert.DeserializeObject <Report>(resultOfQuery);
            #endregion

            FinalResult FINAL = new FinalResult();
            FINAL.resultItems = new List <ResultItem>();
            ResultItem finalResult = new ResultItem();

            //ItemInfoHelper itemInfoHelper = new ItemInfoHelper();
            FINAL.resultItems = new ItemInfoHelper().getItemInfo(finalResult, result, FINAL);

            //Считаем LeadTime и BackLogTime для каждой таски
            foreach (ResultItem i in FINAL.resultItems)
            {
                if (i.value[0].fields.ActivatedDate != null && i.value[0].fields.CreatedDate != null)
                {
                    i.value[0].backlogTime = (int)(DateTime.Parse(i.value[0].fields.ActivatedDate) - DateTime.Parse(i.value[0].fields.CreatedDate)).TotalDays;
                }
                if (i.value[0].fields.ClosedDate != null && i.value[0].fields.ActivatedDate != null)
                {
                    i.value[0].leadTime = (int)(DateTime.Parse(i.value[0].fields.ClosedDate) - DateTime.Parse(i.value[0].fields.ActivatedDate)).TotalDays;
                }
            }

            //TaskReportHelper taskReportHelper = new TaskReportHelper();
            //BacklogReportHelper backlogReportHelper = new BacklogReportHelper();
            //LeadReportHelper leadReportHelper = new LeadReportHelper();

            PlotSet plotResult = new PlotSet();
            plotResult.PlotList = new List <PlotData>();
            plotResult.PlotList.Add(new TaskReportHelper().formTaskReport(FINAL, startDate));
            plotResult.PlotList.Add(new BacklogReportHelper().fromBacklogReport(FINAL, stepBacklogTime, startDate));
            plotResult.PlotList.Add(new LeadReportHelper().formLeadReport(FINAL, stepLeadTime, startDate));
            return(plotResult);
        }
コード例 #10
0
        public PlotSet allTeam(DateTime startDate, int stepBacklogTime, int stepLeadTime)
        {
            #region Запрос номеров таск из TFS, удовлетворяющих запросу
            var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://tfs.tele2.ru/tfs/Main/Tele2/_apis/wit/wiql?api-version=3.0");
            httpWebRequest.Method      = "POST";
            httpWebRequest.Credentials = new NetworkCredential("victor.polyakh", "Zxcvbn123$");
            httpWebRequest.ContentType = "application/json; charset=utf-8; api-version=3.0";
            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string jsonAllTeam =
                    "{" + "\"query\":" + "\"" +
                    "select[System.Id], " +
                    "[System.AssignedTo], " +
                    "[System.Title], " +
                    "[System.State], " +
                    "[System.AreaPath], " +
                    "[System.IterationPath], " +
                    "[System.Tags], " +
                    "[System.CreatedDate], " +
                    "[Microsoft.VSTS.Common.ActivatedDate], " +
                    "[Microsoft.VSTS.Common.ClosedDate], " +
                    "[Microsoft.VSTS.Scheduling.Size] " +
                    "from WorkItems where " +
                    "[System.TeamProject] = @project and " +
                    "[System.WorkItemType] = 'Требование' and " +
                    @"([System.AreaPath] = 'Tele2\\CRM\\CRM Team DoC' or " +
                    @"[System.AreaPath] = 'Tele2\\CRM\\CRM Team A' or " +
                    @"[System.AreaPath] = 'Tele2\\CRM\\CRM Team B' or " +
                    @"[System.AreaPath] = 'Tele2\\CRM\\CRM Support') and " +
                    "[System.State] = 'Closed' and " +
                    "[System.Reason] <> 'Отклонено' and " +
                    "not [System.Tags] contains 'Техническое' and " +
                    "not [System.Tags] contains 'Орг вопросы' and " +
                    "not [System.Tags] contains 'Backend' and " +
                    "not [System.Reason] contains 'Пропала необходимость' " +
                    "order by [Microsoft.VSTS.Common.ClosedDate]" +
                    "\"" +
                    "}";

                streamWriter.Write(jsonAllTeam);
                streamWriter.Flush();
                streamWriter.Close();
            }
            var     httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            dynamic resultOfQuery;
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                resultOfQuery = streamReader.ReadToEnd();
            }
            Report result = JsonConvert.DeserializeObject <Report>(resultOfQuery);
            #endregion

            FinalResult FINAL = new FinalResult();
            FINAL.resultItems = new List <ResultItem>();
            ResultItem finalResult = new ResultItem();

            ItemInfoHelper itemInfoHelper = new ItemInfoHelper();
            FINAL.resultItems = itemInfoHelper.getItemInfo(finalResult, result, FINAL);

            //Считаем LeadTime и BackLogTime для каждой таски
            foreach (ResultItem i in FINAL.resultItems)
            {
                if (i.value[0].fields.ActivatedDate != null && i.value[0].fields.CreatedDate != null)
                {
                    i.value[0].backlogTime = (int)(DateTime.Parse(i.value[0].fields.ActivatedDate) - DateTime.Parse(i.value[0].fields.CreatedDate)).TotalDays;
                }
                if (i.value[0].fields.ClosedDate != null && i.value[0].fields.ActivatedDate != null)
                {
                    i.value[0].leadTime = (int)(DateTime.Parse(i.value[0].fields.ClosedDate) - DateTime.Parse(i.value[0].fields.ActivatedDate)).TotalDays;
                }
            }

            TaskReportHelper    taskReportHelper    = new TaskReportHelper();
            BacklogReportHelper backlogReportHelper = new BacklogReportHelper();
            LeadReportHelper    leadReportHelper    = new LeadReportHelper();

            PlotSet plotResult = new PlotSet();
            plotResult.PlotList = new List <PlotData>();
            plotResult.PlotList.Add(taskReportHelper.formTaskReport(FINAL, startDate));
            plotResult.PlotList.Add(backlogReportHelper.fromBacklogReport(FINAL, stepBacklogTime, startDate));
            plotResult.PlotList.Add(leadReportHelper.formLeadReport(FINAL, stepLeadTime, startDate));
            return(plotResult);
        }