private void btnDash_Click(object sender, EventArgs e) { ConDashboard conDashboard = new ConDashboard(); UnresolvedIncidents(conDashboard); IncidentsPastDeadline(conDashboard); TypeOfIncidents(conDashboard); MostCommonWords(conDashboard); IncidentsSolvedByYou(conDashboard); CloseAllPanelsExcept(panelDash); }
private void TypeOfIncidents(ConDashboard conDashboard) { int[] incidentTypeOfInc = conDashboard.CalculateTypeOfIncidents(); ChartTypeOfInc.Series["s1"].Points.Clear(); ChartTypeOfInc.Series["s1"].Points.AddXY("Software: " + incidentTypeOfInc[0], incidentTypeOfInc[0]); ChartTypeOfInc.Series["s1"].Points.AddXY("Hardware: " + incidentTypeOfInc[1], incidentTypeOfInc[1]); ChartTypeOfInc.Series["s1"].Points.AddXY("Service: " + incidentTypeOfInc[2], incidentTypeOfInc[2]); ChartTypeOfInc.Series["s1"].Points[0].Color = ColorTranslator.FromHtml("#b7f842"); ChartTypeOfInc.Series["s1"].Points[1].Color = ColorTranslator.FromHtml("#8efe6b"); ChartTypeOfInc.Series["s1"].Points[2].Color = ColorTranslator.FromHtml("#28da6a"); ChartTypeOfInc.Series["s1"].IsVisibleInLegend = false; }
private void Form1_Load(object sender, EventArgs e) { panelDash.BringToFront(); ConSession session = new ConSession(); string name = session.GetUsername(); lblUser.Text = name; ConDashboard conDashboard = new ConDashboard(); UnresolvedIncidents(conDashboard); IncidentsPastDeadline(conDashboard); TypeOfIncidents(conDashboard); MostCommonWords(conDashboard); IncidentsSolvedByYou(conDashboard); }
private void UnresolvedIncidents(ConDashboard conDashboard) { ChartUnresInc.Series["s1"].Points.Clear(); int[] incidentDataFinished = conDashboard.CalculateUsersFinishedIncidents(); double solvedIncidentPercentage = 0; if (incidentDataFinished[0] != 0) { solvedIncidentPercentage = (double)incidentDataFinished[1] / (double)incidentDataFinished[0]; } ChartUnresInc.Series["s1"].Points.AddXY("", solvedIncidentPercentage); ChartUnresInc.Series["s1"].Points.AddXY("", 1 - solvedIncidentPercentage); ChartUnresInc.Series["s1"].Points[0].Color = ColorTranslator.FromHtml("#b7f842"); ChartUnresInc.Series["s1"].Points[1].Color = ColorTranslator.FromHtml("#e2e2e2"); ChartUnresInc.Series["s1"].IsVisibleInLegend = false; lblUnresInc.Text = incidentDataFinished[1] + "/" + incidentDataFinished[0]; }
private void IncidentsSolvedByYou(ConDashboard conDashboard) { int[] incidentsByYou = conDashboard.CalculateYourIncidents(); double incidentsByYouPercentage = 0; if (incidentsByYou[0] != 0) { incidentsByYouPercentage = (double)incidentsByYou[1] / (double)incidentsByYou[0]; } ChartIncSolvedByYou.Series["s1"].Points.Clear(); ChartIncSolvedByYou.Series["s1"].Points.AddXY("", incidentsByYouPercentage); ChartIncSolvedByYou.Series["s1"].Points.AddXY("", 1 - incidentsByYouPercentage); ChartIncSolvedByYou.Series["s1"].Points[0].Color = ColorTranslator.FromHtml("#28da6a"); ChartIncSolvedByYou.Series["s1"].Points[1].Color = ColorTranslator.FromHtml("#e2e2e2"); ChartIncSolvedByYou.Series["s1"].IsVisibleInLegend = false; lblIncSolvedByYou.Text = incidentsByYou[1] + "/" + incidentsByYou[0]; }
private void MostCommonWords(ConDashboard conDashboard) { Dictionary <string, int> wordList = conDashboard.CalculateMostOccWords(); lblWordList.Text = ""; int loopCounter = 0; foreach (KeyValuePair <string, int> word in wordList.OrderByDescending(key => key.Value)) { if (loopCounter == 10) { break; } lblWordList.Text += word.Key + " = " + word.Value + "\n"; loopCounter++; } }
private void IncidentsPastDeadline(ConDashboard conDashboard) { int[] incidentDataExpired = conDashboard.CalculateIncidentsPastDeadline(); double incidentExpiredPercentage = 0; if (incidentDataExpired[0] != 0) { incidentExpiredPercentage = (double)incidentDataExpired[1] / (double)incidentDataExpired[0]; } ChartUnresIncExp.Series["s1"].Points.Clear(); ChartUnresIncExp.Series["s1"].Points.AddXY("", incidentExpiredPercentage); ChartUnresIncExp.Series["s1"].Points.AddXY("", 1 - incidentExpiredPercentage); ChartUnresIncExp.Series["s1"].Points[0].Color = ColorTranslator.FromHtml("#7cf461"); ChartUnresIncExp.Series["s1"].Points[1].Color = ColorTranslator.FromHtml("#e2e2e2"); ChartUnresIncExp.Series["s1"].IsVisibleInLegend = false; lblUnresIncExp.Text = incidentDataExpired[1] + "/" + incidentDataExpired[0]; }