private void cbBlad_SelectedIndexChanged(object sender, EventArgs e) { if (processId != -1) { List <List <string> > solutionsData = gujacz2.ExecuteStoredProcedure("GetSolutions", new string[] { }, DatabaseName.SupportCP); foreach (var a in solutionsData) { Entities.ProcessSolution solution = new ProcessSolution(); solution.id = int.Parse(a[0]); solution.nameCP = a[1]; solution.nameBuissness = a[2]; solutions.Add(solution); } Entities.ProcessError errorInfo = errors.Where(x => x.description == cbBlad.SelectedItem.ToString()).First(); List <List <string> > topSolution = gujacz2.ExecuteStoredProcedure("GetTopErrorAndSolutionForProcess", new string[] { processId.ToString(), errorInfo.id.ToString() }, DatabaseName.SupportCP); cbRozwiazanie.Items.Clear(); foreach (Entities.ProcessSolution so in solutions) { cbRozwiazanie.Items.Add(so.nameCP); } if (topSolution.Count > 0) { cbRozwiazanie.SelectedItem = solutions.Where(x => x.id == int.Parse(topSolution[0][2])).FirstOrDefault().nameCP; } } }
private void cbTypProcesu_SelectedIndexChanged(object sender, EventArgs e) { processId = -1; string procType = cbTypProcesu.SelectedItem.ToString().Split(' ').First(); List <List <string> > processInfo = gujacz2.ExecuteStoredProcedure("GetProcessByName", new string[] { procType }, DatabaseName.SupportCP); if (processInfo != null && processInfo.Count > 0) { processId = int.Parse(processInfo[0][0]); } else { return; } List <List <string> > topErrorSolution = gujacz2.ExecuteStoredProcedure("GetTopErrorAndSolutionForProcess", new string[] { processId.ToString(), "-1" }, DatabaseName.SupportCP); int topError = -1; //int topSolution = -1; try { topError = int.Parse(topErrorSolution[0][1]); //topSolution = int.Parse(topErrorSolution[0][2]); } catch { } List <List <string> > errorsData = gujacz2.ExecuteStoredProcedure("GetErrorsForProcess", new string[] { processId.ToString() }, DatabaseName.SupportCP); foreach (var a in errorsData) { Entities.ProcessError error = new ProcessError(); error.id = int.Parse(a[0]); error.idErrorType = int.Parse(a[1]); error.description = a[2]; error.descriptionFull = a[3]; errors.Add(error); } cbBlad.Items.Clear(); foreach (Entities.ProcessError er in errors) { cbBlad.Items.Add(er.description); } if (topErrorSolution.Count > 0) { cbBlad.SelectedItem = errors.Where(x => x.id == int.Parse(topErrorSolution[0][1])).FirstOrDefault().description; Entities.ProcessError errorInfo = errors.Where(x => x.description == cbBlad.SelectedItem.ToString()).First(); List <List <string> > topSolution = gujacz2.ExecuteStoredProcedure("GetTopErrorAndSolutionForProcess", new string[] { processId.ToString(), errorInfo.id.ToString() }, DatabaseName.SupportCP); cbRozwiazanie.SelectedItem = solutions.Where(x => x.id == int.Parse(topSolution[0][2])).FirstOrDefault().nameCP; } dodatkoweDane[2] = ((Entities.BillingDthLBItem)cbTypProcesu.SelectedItem).Value; dodatkoweInfo(); }