////Version para superadminaaaaaaaaaaaaaaaaaa public List <TempSerial> listar_ultima_posicion(string placa) { //List<sp_obtenerUltimaPosicion_Result> lista = new List<sp_obtenerUltimaPosicion_Result>(); List <TempSerial> lista = new List <TempSerial>(); var collection = db.sp_obtenerUltimaPosicion(placa); foreach (var item in collection) { TempSerial obt = new TempSerial { ID = item.ID, EstadoGPS = item.EstadoGPS, EstadoMotor = item.EstadoMotor, Velocidad = (float)item.Velocidad, Latitud = (float)item.Latitud, Longitud = (float)item.Longitud, FechaGPS = item.FechaGPS.Date.ToString(), NroPlaca = item.NroPlaca, Nombre = item.Nombre }; lista.Add(obt); } return(lista); }
protected void btnExportar_Click(object sender, EventArgs e) { List <TempSerial> li = new List <TempSerial>(); foreach (GridViewRow row in gdvSeguimiento.Rows) { CheckBox check = (CheckBox)row.FindControl("ckbseguimiento"); if (check.Checked == true) { TempSerial rptSeguimiento = new TempSerial(); rptSeguimiento.EstadoMotor = Convert.ToInt32(row.Cells[3].Text); rptSeguimiento.NroPlaca = row.Cells[4].Text; rptSeguimiento.Velocidad = (float)Convert.ToDouble(row.Cells[5].Text); rptSeguimiento.Latitud = (float)Convert.ToDouble(row.Cells[6].Text); rptSeguimiento.Longitud = (float)Convert.ToDouble(row.Cells[7].Text); rptSeguimiento.FechaGPS = row.Cells[8].Text; string strestado = row.Cells[9].Text; rptSeguimiento.EstadoGPS = (strestado.Equals("Encendido")) ? 1 : 0; rptSeguimiento.Temperatura = (float)Convert.ToDouble(row.Cells[10].Text); rptSeguimiento.EstadoPuerta = row.Cells[11].Text; rptSeguimiento.VoltajeBateria = (float)Convert.ToDouble(row.Cells[12].Text); if (row.Cells[13].Text != " ") { rptSeguimiento.Nombre = row.Cells[13].Text; } else { rptSeguimiento.Nombre = "No Asignado"; } li.Add(rptSeguimiento); } } ReporteSeguimiento(li); }