public AccidentView() { InitializeComponent(); init(); AccidentAlgorytm.startAlgorytm(); AccidentAlgorytm.checkCritics(); }
public void init() { int totalRegisters; int totalAccidents; var accidents = new List <AccidentsVM>(); var accidentes = new List <accident>(); var employees = new List <employee>(); var modas = AccidentAlgorytm.startAlgorytm(); List <AccidentsVM> posibleAccidents = null; using (var ctx = new EmployeeEntity()) employees = ctx.employees.ToList(); int i = 0; foreach (var employee in employees) { var birthDate = DataCalc.getBirthDate(employee.curp); var LivingDays = DataCalc.daysLived(birthDate); accidents.Add(new AccidentsVM(i, employee.curp, employee.fecha_nacimiento, CalcBiorrytm(LivingDays, BiorytmDays.biorritmo_fisico), CalcBiorrytm(LivingDays, BiorytmDays.biorritmo_emocional), CalcBiorrytm(LivingDays, BiorytmDays.biorritmo_intelectual), CalcBiorrytm(LivingDays, BiorytmDays.biorritmo_intuicional))); i++; } if (modas != null) { posibleAccidents = accidents.Where(x => x.residuo_fisico == modas.biorritmoFisico && x.residuo_emocional == modas.biorritmoEmocional && x.residuo_intelectual == modas.biorritmoIntelectual && x.residuo_intuicional == modas.biorritmoIntuicional).ToList(); } using (var ctx = new EmployeeEntity()) totalRegisters = ctx.employees.totalRegisters(); using (var ctx = new EmployeeEntity()) totalAccidents = ctx.accidents.totalAccidents(); lbAccidentNum.Content = totalAccidents.ToString(); lbEmployeeNum.Content = totalRegisters.ToString(); empleado.ItemsSource = posibleAccidents; var totalriskEmployees = empleado.Items.Count; lbltotalRiskEmployees.Content = totalriskEmployees; }
public void init() { var critics = AccidentAlgorytm.checkCritics(); var avgs = AccidentAlgorytm.startAlgorytm(); try { lblTotalAccidents.Content = critics[0].ToString(); lblTotalCriticFisic.Content = critics[1].ToString(); lblTotalCriticFisicPercent.Content = "(" + ((critics[1] * 100) / critics[0]).ToString() + "%)"; lblTotalCriticEmotional.Content = critics[2].ToString(); lblTotalCriticEmotionalPercent.Content = "(" + ((critics[2] * 100) / critics[0]).ToString() + "%)"; lblTotalCriticIntuitional.Content = critics[3].ToString(); lblTotalCriticIntuitionalPercent.Content = "(" + ((critics[3] * 100) / critics[0]).ToString() + "%)"; lblTotalCriticIntelectual.Content = critics[4].ToString(); lblTotalCriticIntelectualPercent.Content = "(" + ((critics[4] * 100) / critics[0]).ToString() + "%)"; lblTotalAllCriticsAccidents.Content = critics[5].ToString(); lblTotalAllCriticsAccidentsPercent.Content = "(" + ((critics[5] * 100) / critics[0]).ToString() + "%)"; lblTotalCriticAccidents.Content = critics[6].ToString(); lblTotalCriticAccidentsPercent.Content = "(" + ((critics[6] * 100) / critics[0]).ToString() + "%)"; lblAvgFisic.Content = avgs.biorritmoFisico.ToString(); lblAvgFisicTotal.Content = "(" + avgs.totalBiorritmoFisico.ToString() + ")"; lblAvgEmotional.Content = avgs.biorritmoEmocional.ToString(); lblAvgEmotionalTotal.Content = "(" + avgs.totalBiorritmoEmocional.ToString() + ")"; lblAvgIntelectual.Content = avgs.biorritmoIntelectual.ToString(); lblAvgIntelectualTotal.Content = "(" + avgs.totalBiorritmoIntelectual.ToString() + ")"; lblAvgIntuitional.Content = avgs.biorritmoIntuicional.ToString(); lblAvgIntuitionalTotal.Content = "(" + avgs.totalBiorritmoIntuicional.ToString() + ")"; } catch (Exception) { MessageBox.Show("No se cuenta con la suficiente informacion"); Close(); } }