public PartialViewResult ChartDraw5(string[] checkedValues, int min, int max)
        {
            ReasonsChart cart = new ReasonsChart();

            int[] all = null;
            cart.Values_per_reasons_for5graph(min, max, checkedValues, out all);
            // <Sort>
            for (int i = 0; i < all.Length - 1; i++)
            {
                for (int j = 0; j < all.Length - 1; j++)
                {
                    if (all[j] < all[j + 1])
                    {
                        int temp = all[j];
                        all[j]     = all[j + 1];
                        all[j + 1] = temp;
                        string t = checkedValues[j];
                        checkedValues[j]     = checkedValues[j + 1];
                        checkedValues[j + 1] = t;
                    }
                }
            }
            // <Sort/>
            ViewBag.All    = all;
            ViewBag.Titles = checkedValues;
            return(PartialView("Chart45"));
        }
Beispiel #2
0
        public PartialViewResult Formatting(int min, int max, string division, DateTime date)
        {
            ViewBag.date = date;
            ViewBag.min  = min;
            ViewBag.max  = max;

            int[]    ALLWeekvalues  = null;
            int[]    GoodWeekvalues = null;
            string[] titles         = null;
            string[] titlesM        = { "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь" };
            titles = new string[max - min + 1];
            for (int i = 0; i < max - min + 1; i++)
            {
                titles[i] = "W" + (min + i).ToString();
            }
            ViewBag.Titles = titles;

            // --- 1 ----
            FirstTypeChart chart = new FirstTypeChart(37);

            chart.return_all_values_weekly(min, max, out ALLWeekvalues);
            chart.return_good_values_weekly(min, max, out GoodWeekvalues);
            ViewBag.all1  = ALLWeekvalues;
            ViewBag.good1 = GoodWeekvalues;
            // ---- 2 -------
            chart = new FirstTypeChart(38);
            chart.return_all_values_weekly(min, max, out ALLWeekvalues);
            chart.return_good_values_weekly(min, max, out GoodWeekvalues);
            ViewBag.all2  = ALLWeekvalues;
            ViewBag.good2 = GoodWeekvalues;
            // ---- 3--------
            chart = new FirstTypeChart(39);
            chart.return_all_values_weekly(min, max, out ALLWeekvalues);
            chart.return_good_values_weekly(min, max, out GoodWeekvalues);
            ViewBag.all3  = ALLWeekvalues;
            ViewBag.good3 = GoodWeekvalues;
            // -----4--------
            chart.return_good_values_per_month(1, 12, out GoodWeekvalues);
            chart.return_all_values_per_month(1, 12, out ALLWeekvalues);
            ViewBag.all4    = ALLWeekvalues;
            ViewBag.good4   = GoodWeekvalues;
            ViewBag.titlesM = titlesM;
            // ------ 5--------
            ReasonsChart         reasonChart = new ReasonsChart();
            IEnumerable <string> reasons = null;
            int local_min = max - 1, local_max = max;

            if (max <= 1)
            {
                local_min = 1;
            }
            reasons = reasonChart.Return_all_reasons4(local_min, local_max);
            string[] r = reasons.ToArray();
            reasonChart.Values_per_reasons_for4graph(local_min, local_max, reasons.ToArray(), out ALLWeekvalues);

            for (int i = 0; i < ALLWeekvalues.Length - 1; i++)
            {
                for (int j = 0; j < ALLWeekvalues.Length - 1; j++)
                {
                    if (ALLWeekvalues[j] < ALLWeekvalues[j + 1])
                    {
                        int temp = ALLWeekvalues[j];
                        ALLWeekvalues[j]     = ALLWeekvalues[j + 1];
                        ALLWeekvalues[j + 1] = temp;
                        string t = r[j];
                        r[j]     = r[j + 1];
                        r[j + 1] = t;
                    }
                }
            }

            ViewBag.all5    = ALLWeekvalues;
            ViewBag.titlesR = r;
            // ------ 6 ----------
            reasons = reasonChart.Return_all_reasons5(local_min, local_max);
            reasonChart.Values_per_reasons_for5graph(local_min, local_max, reasons.ToArray(), out ALLWeekvalues);

            r = reasons.ToArray();

            for (int i = 0; i < ALLWeekvalues.Length - 1; i++)
            {
                for (int j = 0; j < ALLWeekvalues.Length - 1; j++)
                {
                    if (ALLWeekvalues[j] < ALLWeekvalues[j + 1])
                    {
                        int temp = ALLWeekvalues[j];
                        ALLWeekvalues[j]     = ALLWeekvalues[j + 1];
                        ALLWeekvalues[j + 1] = temp;
                        string t = r[j];
                        r[j]     = r[j + 1];
                        r[j + 1] = t;
                    }
                }
            }


            ViewBag.all6     = ALLWeekvalues;
            ViewBag.titlesR2 = r;
            // ------- 7 ----------
            //string[] cities = null;
            //if (division == divisions[0])
            //{
            //    cities = Cities;
            //}
            //if (division == divisions[1])
            //{
            //    cities = DivisionJug;
            //}
            //else if (division == divisions[2])
            //{
            //    cities = DivisionDalniiVostok;
            //}
            //else if (division == divisions[3])
            //{
            //    cities = DivisionZapadnayaSibir;
            //}
            //else if (division == divisions[4])
            //{
            //    cities = DivisionSeveroZapad;
            //}
            //else if (division == divisions[5])
            //{
            //    cities = DivisionUral;
            //}
            //else if (division == divisions[6])
            //{
            //    cities = DivisionMoskva;
            //}
            //else if (division == divisions[7])
            //{
            //    cities = DivisionPovolje;
            //}
            //else if (division == divisions[8])
            //{
            //    cities = DivisionCentr;
            //}
            //List<int> all = null;
            //List<int> good = null;
            //ChartFormat7 chart7 = new ChartFormat7();
            //all = chart7.return_all_values_per_week_COUNT(min, max, cities);
            //good = chart7.return_good_values_per_week_COUNT(min, max, cities);

            //ALLWeekvalues = new int[all.Count];
            //GoodWeekvalues = new int[good.Count];

            //for (int i = 0; i < ALLWeekvalues.Length; i++)
            //{
            //    ALLWeekvalues[i] = all[i];
            //    GoodWeekvalues[i] = good[i];
            //}

            //ViewBag.all7 = ALLWeekvalues;
            //ViewBag.good7 = GoodWeekvalues;
            //ViewBag.TitlesC = cities;

            Chart7WithoutDivisions chart7 = new Chart7WithoutDivisions();
            List <int>             all = new List <int>(), good = new List <int>();

            ViewBag.OyTitle = "Количество кодовых номеров";
            good            = chart7.return_good_values_per_week_SUM(min, max, null);
            all             = chart7.return_all_values_per_week_SUM(min, max, null);

            ALLWeekvalues  = new int[all.Count];
            GoodWeekvalues = new int[good.Count];
            for (int i = 0; i < ALLWeekvalues.Length; i++)
            {
                ALLWeekvalues[i]  = all[i];
                GoodWeekvalues[i] = good[i];
            }
            ViewBag.all7  = ALLWeekvalues;
            ViewBag.good7 = GoodWeekvalues;

            // ------ 7_2-----------------
            ViewBag.OyTitle = "Количество задач";
            all             = chart7.return_all_values_per_week_COUNT(min, max, null);
            good            = chart7.return_good_values_per_week_COUNT(min, max, null);

            ALLWeekvalues  = new int[all.Count];
            GoodWeekvalues = new int[good.Count];
            for (int i = 0; i < ALLWeekvalues.Length; i++)
            {
                ALLWeekvalues[i]  = all[i];
                GoodWeekvalues[i] = good[i];
            }
            ViewBag.all72  = ALLWeekvalues;
            ViewBag.good72 = GoodWeekvalues;


            return(PartialView());
        }
        public PartialViewResult ChartDraw(string filename, int min, int max, string chartNumber, int minMonth, int maxMonth, int month, string division, string tp, string filterType, string spin)
        {
            ViewBag.FilterType = filterType;
            ViewBag.MainTitle  = chartNumber;
            int[]    ALLWeekvalues  = null;
            int[]    GoodWeekvalues = null;
            string[] titles         = null;

            string MainTitle = "";

            string[] titlesMonth = new string[maxMonth - minMonth + 1];
            for (int i = 0; i < titlesMonth.Length; i++)
            {
                titlesMonth[i] = (i + minMonth - 1).ToString();
            }

            FirstTypeChart chart = null;


            if (chartNumber == "1")
            {
                chart = new FirstTypeChart(37);
                //MainTitle = "Новые расчеты БТП";
            }
            else if (chartNumber == "2")
            {
                chart = new FirstTypeChart(38);
                //MainTitle = "Корректировки расчетов БТП";
            }
            else if (chartNumber == "3")
            {
                chart = new FirstTypeChart(39);
                //MainTitle = "Новые расчеты и корректировки БТП";
            }
            else if (chartNumber == "4")
            {
                ReasonsChart         fourChart = new ReasonsChart();
                IEnumerable <string> reasons   = null;
                reasons           = fourChart.Return_all_reasons4(min, max);
                ViewBag.min       = min;
                ViewBag.max       = max;
                ViewBag.Function  = "ChartDraw45";
                MainTitle         = "Причины просроченных задач";
                ViewBag.MainTitle = MainTitle;
                return(PartialView("Draw45", reasons));
            }
            else if (chartNumber == "5")
            {
                ReasonsChart         fiveChart = new ReasonsChart();
                IEnumerable <string> reasons   = null;
                reasons           = fiveChart.Return_all_reasons5(min, max);
                ViewBag.min       = min;
                ViewBag.max       = max;
                ViewBag.Function  = "ChartDraw5";
                MainTitle         = "Причины корректировок";
                ViewBag.MainTitle = MainTitle;
                return(PartialView("Draw45", reasons));
            }
            else if (chartNumber == "6")
            {
                ChartFormat67 chart6 = new ChartFormat67();
                string[]      cities = null;
                if (division == divisions[0])
                {
                    cities = Cities;
                }
                if (division == divisions[1])
                {
                    cities = DivisionJug;
                }
                else if (division == divisions[2])
                {
                    cities = DivisionDalniiVostok;
                }
                else if (division == divisions[3])
                {
                    cities = DivisionZapadnayaSibir;
                }
                else if (division == divisions[4])
                {
                    cities = DivisionSeveroZapad;
                }
                else if (division == divisions[5])
                {
                    cities = DivisionUral;
                }
                else if (division == divisions[6])
                {
                    cities = DivisionMoskva;
                }
                else if (division == divisions[7])
                {
                    cities = DivisionPovolje;
                }
                else if (division == divisions[8])
                {
                    cities = DivisionCentr;
                }
                ViewBag.OyTitle        = 2;
                titles                 = cities;
                ALLWeekvalues          = chart6.return_all_values_for_reasons_in_month_range(minMonth, maxMonth, cities);
                GoodWeekvalues         = chart6.return_good_values_for_reasons_in_month_range(minMonth, maxMonth, cities);
                ViewBag.GoodValuesWeek = GoodWeekvalues;
                ViewBag.AllValuesWeek  = ALLWeekvalues;
                ViewBag.Titles         = titles;
                ViewBag.Type           = 3;
                //MainTitle = "Расчеты БТП по дивизионам";
                //ViewBag.MainTitle = MainTitle;
                return(PartialView("ChartDraw"));
            }
            else if (chartNumber == "7")
            {
                if (spin == "with")
                {
                    ChartFormat7 chart7 = new ChartFormat7();
                    int          ty     = 0;
                    string[]     cities = null;
                    if (division == divisions[0])
                    {
                        cities = Cities;
                    }
                    if (division == divisions[1])
                    {
                        cities = DivisionJug;
                    }
                    else if (division == divisions[2])
                    {
                        cities = DivisionDalniiVostok;
                    }
                    else if (division == divisions[3])
                    {
                        cities = DivisionZapadnayaSibir;
                    }
                    else if (division == divisions[4])
                    {
                        cities = DivisionSeveroZapad;
                    }
                    else if (division == divisions[5])
                    {
                        cities = DivisionUral;
                    }
                    else if (division == divisions[6])
                    {
                        cities = DivisionMoskva;
                    }
                    else if (division == divisions[7])
                    {
                        cities = DivisionPovolje;
                    }
                    else if (division == divisions[8])
                    {
                        cities = DivisionCentr;
                    }
                    List <int> all  = null;
                    List <int> good = null;

                    if (tp == "задачи")
                    {
                        ViewBag.OyTitle = 1;

                        if (filterType == "2")
                        {
                            good = chart7.return_good_values_per_week_SUM(min, max, cities);
                            all  = chart7.return_all_values_per_week_SUM(min, max, cities);
                        }
                        //chart7.CreateGraphWithWeekFilterSumY(out ALLWeekvalues, out GoodWeekvalues, min, max);
                        else
                        {
                            all  = chart7.return_all_values_per_month_SUM(minMonth, maxMonth, cities);
                            good = chart7.return_good_values_per_month_SUM(minMonth, maxMonth, cities);
                        }
                        ty = 3;
                        // chart7.CreateGraphWithMonthFilterSumY(out ALLWeekvalues, out GoodWeekvalues, minMonth, maxMonth);
                    }
                    else
                    {
                        ViewBag.OyTitle = 0;
                        if (filterType == "2")
                        {
                            all  = chart7.return_all_values_per_week_COUNT(min, max, cities);
                            good = chart7.return_good_values_per_week_COUNT(min, max, cities);
                        }
                        //chart7.CreateGraphWithWeekFilterCountY(out ALLWeekvalues, out GoodWeekvalues, min, max);
                        else
                        {
                            all  = chart7.return_all_values_per_month_COUNT(minMonth, maxMonth, cities);
                            good = chart7.return_good_values_per_month_COUNT(minMonth, maxMonth, cities);
                        }
                        ty = 3;
                    }
                    ALLWeekvalues  = new int[all.Count];
                    GoodWeekvalues = new int[good.Count];

                    for (int i = 0; i < ALLWeekvalues.Length; i++)
                    {
                        ALLWeekvalues[i]  = all[i];
                        GoodWeekvalues[i] = good[i];
                    }



                    ViewBag.GoodValuesWeek = GoodWeekvalues;
                    ViewBag.AllValuesWeek  = ALLWeekvalues;
                    ViewBag.Titles         = cities;
                    ViewBag.Type           = ty;
                    //MainTitle = "Заказы БТП";
                    //ViewBag.MainTitle = MainTitle;
                    return(PartialView("ChartDraw"));
                }
                else
                {
                    Chart7WithoutDivisions chart7 = new Chart7WithoutDivisions();
                    int      ty     = 0;
                    string[] cities = null;
                    //if (division == divisions[0])
                    //{
                    //    cities = Cities;
                    //}
                    //if (division == divisions[1])
                    //{
                    //    cities = DivisionJug;
                    //}
                    //else if (division == divisions[2])
                    //{
                    //    cities = DivisionDalniiVostok;
                    //}
                    //else if (division == divisions[3])
                    //{
                    //    cities = DivisionZapadnayaSibir;
                    //}
                    //else if (division == divisions[4])
                    //{
                    //    cities = DivisionSeveroZapad;
                    //}
                    //else if (division == divisions[5])
                    //{
                    //    cities = DivisionUral;
                    //}
                    //else if (division == divisions[6])
                    //{
                    //    cities = DivisionMoskva;
                    //}
                    //else if (division == divisions[7])
                    //{
                    //    cities = DivisionPovolje;
                    //}
                    //else if (division == divisions[8])
                    //{
                    //    cities = DivisionCentr;
                    //}
                    List <int> all  = null;
                    List <int> good = null;

                    if (tp == "задачи")
                    {
                        ViewBag.OyTitle = 1;

                        if (filterType == "2")
                        {
                            good = chart7.return_good_values_per_week_SUM(min, max, cities);
                            all  = chart7.return_all_values_per_week_SUM(min, max, cities);
                        }
                        //chart7.CreateGraphWithWeekFilterSumY(out ALLWeekvalues, out GoodWeekvalues, min, max);
                        else
                        {
                            all  = chart7.return_all_values_per_month_SUM(minMonth, maxMonth, cities);
                            good = chart7.return_good_values_per_month_SUM(minMonth, maxMonth, cities);
                        }
                        ty = 3;
                        // chart7.CreateGraphWithMonthFilterSumY(out ALLWeekvalues, out GoodWeekvalues, minMonth, maxMonth);
                    }
                    else
                    {
                        ViewBag.OyTitle = 0;
                        if (filterType == "2")
                        {
                            all  = chart7.return_all_values_per_week_COUNT(min, max, cities);
                            good = chart7.return_good_values_per_week_COUNT(min, max, cities);
                        }
                        //chart7.CreateGraphWithWeekFilterCountY(out ALLWeekvalues, out GoodWeekvalues, min, max);
                        else
                        {
                            all  = chart7.return_all_values_per_month_COUNT(minMonth, maxMonth, cities);
                            good = chart7.return_good_values_per_month_COUNT(minMonth, maxMonth, cities);
                        }
                        ty = 3;
                    }
                    ALLWeekvalues  = new int[all.Count];
                    GoodWeekvalues = new int[good.Count];

                    for (int i = 0; i < ALLWeekvalues.Length; i++)
                    {
                        ALLWeekvalues[i]  = all[i];
                        GoodWeekvalues[i] = good[i];
                    }

                    string[] tit = null;

                    if (filterType == "1")
                    {
                        tit = new string[maxMonth - minMonth + 1];
                        for (int i = 0; i < titlesMonth.Length; i++)
                        {
                            tit[i] = months[i + minMonth - 1];
                        }
                    }
                    else
                    {
                        tit = new string[max - min + 1];
                        for (int i = 0; i < tit.Length; i++)
                        {
                            tit[i] = "W" + (min + i).ToString();
                        }
                    }


                    ViewBag.GoodValuesWeek = GoodWeekvalues;
                    ViewBag.AllValuesWeek  = ALLWeekvalues;
                    ViewBag.Titles         = tit;
                    ViewBag.Type           = ty;
                    //MainTitle = "Заказы БТП";
                    //ViewBag.MainTitle = MainTitle;
                    return(PartialView("ChartDraw"));
                }
            }
            else if (chartNumber == "8")
            {
                TheLastChart         lastChart = new TheLastChart();
                IEnumerable <string> surnames  = new List <string>();
                if (filterType == "1")
                {
                    surnames     = lastChart.Get_Surnames_Per_Month(minMonth, maxMonth);
                    ViewBag.Type = 0;
                    ViewBag.min  = minMonth;
                    ViewBag.max  = maxMonth;
                }
                else
                {
                    surnames     = lastChart.Get_Surnames_Per_Week(min, max);
                    ViewBag.Type = 2;
                    ViewBag.min  = min;
                    ViewBag.max  = max;
                }



                return(PartialView("LastDraw", surnames));
            }
            int t = 0;

            // First Chart
            if (filterType == "2")
            {
                chart.return_all_values_weekly(min, max, out ALLWeekvalues);
                chart.return_good_values_weekly(min, max, out GoodWeekvalues);
                titles = new string[max - min + 1];
                for (int i = 0; i < max - min + 1; i++)
                {
                    titles[i] = "W" + (min + i).ToString();
                }
                t = 1;
            }
            else
            {
                chart.return_all_values_per_month(minMonth, maxMonth, out ALLWeekvalues);
                chart.return_good_values_per_month(minMonth, maxMonth, out GoodWeekvalues);
                titles = titlesMonth;
                t      = 2;
            }
            //

            ViewBag.GoodValuesWeek = GoodWeekvalues;
            ViewBag.AllValuesWeek  = ALLWeekvalues;
            ViewBag.Titles         = titles;
            ViewBag.Type           = t;
            //ViewBag.MainTitle = MainTitle;
            return(PartialView("ChartDraw"));
        }