private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e) { if (a == 0) { MessageBox.Show(string.Format("Latitud: {0}, Longitud: {1}", e.Position.Location.Latitude, e.Position.Location.Longitude, MessageBoxButtons.OK, MessageBoxIcon.Information)); latitud = e.Position.Location.Latitude.ToString(); longitud = e.Position.Location.Longitude.ToString(); CLsNsocket so = new CLsNsocket(); so.SendEvent("userLocation", latitud.ToString().Replace('.', ',') + "/" + longitud.ToString().Replace('.', ',') + "/" + FormCliente_Menu_UsuarioCliente.usuario.Rows[0][0].ToString()); //guardar alerta en basa de datos ClsEalerta E = new ClsEalerta(); ClsNalerta N = new ClsNalerta(); E.Dni = FormCliente_Menu_UsuarioCliente.usuario.Rows[0][0].ToString(); E.Latitud = latitud.Replace('.', ','); E.Longitud = longitud.Replace('.', ','); E.Fecha = Convert.ToDateTime(DateTime.Now.ToShortDateString()); E.Hora = DateTime.Now.ToLongTimeString(); E.Turno = MtdObtenerTurno(); E.Estado = "0"; N.MtdAgregarAlerta(E); a++; MessageBox.Show(string.Format("Datos enviados, JeanNET", "JeaNet - Informa", MessageBoxButtons.OK, MessageBoxIcon.Information)); } }
internal bool MtdAgregarAlerta(ClsEalerta e) { try { ClsConexionSQL objConexion = new ClsConexionSQL(); SqlCommand command = new SqlCommand(); SqlDataAdapter adapter = new SqlDataAdapter(); command.Connection = objConexion.Conectar(); command.CommandText = "USP_I_AgregarAlerta"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("dni", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("lat", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("lon", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("fec", SqlDbType.Date)); command.Parameters.Add(new SqlParameter("hor", SqlDbType.VarChar)); command.Parameters.Add(new SqlParameter("turn", SqlDbType.Int)); command.Parameters.Add(new SqlParameter("est", SqlDbType.VarChar)); command.Parameters["dni"].Value = e.Dni; command.Parameters["lat"].Value = e.Latitud; command.Parameters["lon"].Value = e.Longitud; command.Parameters["fec"].Value = e.Fecha; command.Parameters["hor"].Value = e.Hora; command.Parameters["turn"].Value = e.Turno; command.Parameters["est"].Value = e.Estado; command.ExecuteNonQuery(); command.Connection = objConexion.Desconectar(); return(true); } catch (Exception ex) { return(false); throw ex; } }
public void testAgregarAlerta_returnTrue() { ClsNalerta objN = new ClsNalerta(); ClsEalerta objE = ClsEalerta.crear("70707070", "2020", "2022020", Convert.ToDateTime("1/1/2020"), "12:30", 2, "activo"); bool result = objN.agregarAlerta(objE); Assert.IsFalse(result); }
public ArrayList listarIncidencias() { ArrayList empleados = new ArrayList(); foreach (var item in datos.listarAlerta()) { ClsEalerta empleado = ClsEalerta.crear(item.DniCli, item.Latitud, item.Longitud, (DateTime)item.Fecha, item.Hora, (int)item.idTurno, item.estado); empleados.Add(empleado); } return(empleados); }
public ArrayList listarAlertas(string dni) { ArrayList cargos = new ArrayList(); foreach (var item in datos.listarAlertas(dni)) { ClsEalerta cargo = ClsEalerta.crear(item.DniCli, item.Latitud, item.Longitud, (DateTime)item.Fecha, item.Hora, (int)item.idTurno, item.estado); cargos.Add(cargo); } return(cargos); }
private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e) { if (a == 0) { a++; latitud = e.Position.Location.Latitude.ToString(); longitud = e.Position.Location.Longitude.ToString(); CLsNsocket so = new CLsNsocket(); so.SendEvent("userLocation", latitud.ToString().Replace('.', ',') + "/" + longitud.ToString().Replace('.', ',') + "/" + FormCliente_Menu_UsuarioCliente.cliente.DniCliente + "/" + FormCliente_Menu_UsuarioCliente.cliente.Nombres + "/" + FormCliente_Menu_UsuarioCliente.cliente.Apellidos); //guardar alerta en basa de datos ClsEalerta E = ClsEalerta.crear(FormCliente_Menu_UsuarioCliente.cliente.DniCliente, latitud.Replace('.', ','), longitud.Replace('.', ','), Convert.ToDateTime(DateTime.Now.ToShortDateString()), DateTime.Now.ToLongTimeString(), MtdObtenerTurno(), "0"); ClsNalerta N = new ClsNalerta(); N.agregarAlerta(E); MessageBox.Show("Datos enviados, JeanNET", "JeaNet - Informa", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public bool agregarAlerta(ClsEalerta alerta) { tbAlertas tbl = tbAlertas.crear(alerta.DniCli, alerta.Latitud, alerta.Longitud, alerta.Fecha, alerta.Hora, alerta.idTurno, alerta.estado); return(datos.agregarAlerta(tbl)); }