public PartialViewResult LastChart(int type, int min, int max, string[] checkedValues, string graphType, string typeCountSum) { TheLastChart lastChart = new TheLastChart(); int[] all = null, bad = null, good = null; if (graphType == "1") { ViewBag.MainTitle = "Новые расчеты"; if (typeCountSum == "count") { if (type == 1) { lastChart.First_Type_Graph_Per_Month_Count(min, max, out good, out bad, checkedValues); } else { lastChart.First_Type_Graph_Per_Week_Count(min, max, out good, out bad, checkedValues); } } else { if (type == 1) { lastChart.First_Type_Graph_Per_Month_Sum(min, max, out good, out bad, checkedValues); } else { lastChart.First_Type_Graph_Per_Week_Sum(min, max, out good, out bad, checkedValues); } } } else if (graphType == "2") { ViewBag.MainTitle = "Корректировки расчетов"; if (typeCountSum == "count") { if (type == 1) { lastChart.Second_Type_Graph_Per_Month_Count(min, max, out good, out bad, checkedValues); } else { lastChart.Second_Type_Graph_Per_Week_Count(min, max, out good, out bad, checkedValues); } } else { if (type == 1) { lastChart.Second_Type_Graph_Per_Month_Sum(min, max, out good, out bad, checkedValues); } else { lastChart.Second_Type_Graph_Per_Week_Sum(min, max, out good, out bad, checkedValues); } } } else { ViewBag.MainTitle = "Сумма новых и корректировок"; if (typeCountSum == "count") { if (type == 1) { lastChart.Third_Type_Graph_Per_Month_Count(min, max, out good, out bad, checkedValues); } else { lastChart.Third_Type_Graph_Per_Week_Count(min, max, out good, out bad, checkedValues); } } else { if (type == 1) { lastChart.Third_Type_Graph_Per_Month_Sum(min, max, out good, out bad, checkedValues); } else { lastChart.Third_Type_Graph_Per_Week_Sum(min, max, out good, out bad, checkedValues); } } } all = new int[good.Length]; for (int i = 0; i < all.Length; i++) { all[i] = good[i] + bad[i]; } 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; temp = good[j]; good[j] = good[j + 1]; good[j + 1] = temp; string t = checkedValues[j]; checkedValues[j] = checkedValues[j + 1]; checkedValues[j + 1] = t; } } } ViewBag.AllValuesWeek = all; ViewBag.GoodValuesWeek = good; ViewBag.Titles = checkedValues; ViewBag.Type = 6; if (typeCountSum == "count") { ViewBag.OyTitle = 3; } else { ViewBag.OyTitle = 0; } return(PartialView("ChartDrawLast")); }
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")); }