コード例 #1
0
        static void AgregarChofer()
        {
            try
            {
                Console.Clear();
                Choferes chofer = new Choferes();

                Console.WriteLine("                                        ~~~~~~~~~~ Creando Chofer ~~~~~~~~~~\n");
                Console.Write("                                           > Ingrese el nombre del chofer: ");
                chofer.Nombre = Console.ReadLine();
                Console.Write("\n                                           > Ingrese el apellido del chofer: ");
                chofer.Apellido = Console.ReadLine();
                Console.Write("\n                                           > Ingrese el numero telefonico del chofer: ");
                chofer.Telefono = Console.ReadLine();
                Random rnd         = new Random();
                int    NumEmpleado = Convert.ToInt32(rnd.Next(1000, 7000));
                chofer.NumeroDeEmpleado = NumEmpleado;
                Console.Write("\n                                           > Su numero de empleado generado automaticamente es: " + NumEmpleado);

                TheChoferes.Add(chofer);
                Console.ReadKey();
                menu();
            }
            catch (Exception error)
            {
                Console.WriteLine("\n***        " + error.Message + "        ***");
                Console.ReadKey();
                menu();
            }
        }
コード例 #2
0
        /** Choferes **/

        public Choferes ObtenerChofer(int idChofer)
        {
            Choferes objeto = new Choferes();
            Type     clase  = objeto.GetType();

            return((Choferes)this.Obtener(idChofer, clase));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Choferes choferes = db.Choferes.Find(id);

            db.Choferes.Remove(choferes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "Id_chofer,Rut_chofer,Nombres_Chofer,Apellido_Chofer")] Choferes choferes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(choferes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(choferes));
 }
コード例 #5
0
        public ActionResult Create([Bind(Include = "Id_chofer,Rut_chofer,Nombres_Chofer,Apellido_Chofer")] Choferes choferes)
        {
            if (ModelState.IsValid)
            {
                db.Choferes.Add(choferes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(choferes));
        }
コード例 #6
0
        // GET: Choferes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Choferes choferes = db.Choferes.Find(id);

            if (choferes == null)
            {
                return(HttpNotFound());
            }
            return(View(choferes));
        }
コード例 #7
0
        private void CargarDatos()
        {
            Choferes chofer = mapper.ObtenerChofer(idChofer);



            textBox_Nombre.Text            = chofer.GetNombre();
            textBox_Mail.Text              = chofer.GetMail();
            textBox_DNI.Text               = chofer.GetDNI();
            this.dniViejo                  = chofer.GetDNI();
            textBox_Apellido.Text          = chofer.GetApellido();
            textBox_FechaDeNacimiento.Text = Convert.ToString(chofer.GetFechaDeNacimiento());
            textBox_Telefono.Text          = chofer.GetTelefono();
            textBox_Direccion.Text         = Convert.ToString(chofer.GetDireccion());
            checkBox_Habilitado.Checked    = Convert.ToBoolean(mapper.SelectFromWhere("usuario_habilitado", "Usuario", "usuario_id", chofer.GetIdUsuario()));//creo que aca deberia traer chofer_estado cambiar
        }
コード例 #8
0
        public void fingerPrintRegUserControl_RegistrationCompleted(object sender, StatusChangedEventArgs e)
        {
            try
            {
                dato   = fingerPrintRegUserControl.datos();
                imagen = fingerPrintRegUserControl.imagenregreso();


                if (v == "socios")
                {
                    Socios soc = Owner as Socios;
                    soc.asignarhuella(dato, imagen);
                }
                if (v == "Usuarios")
                {
                    Usuarios us = Owner as Usuarios;
                    us.asignarhuella(dato, imagen);
                }
                if (v == "Choferes")
                {
                    Choferes chof = Owner as Choferes;
                    chof.asignarhuella(dato, imagen);
                }
                if (v == "Socioalterno")
                {
                    Socios soc = Owner as Socios;
                    soc.asignarhuellaalterno(dato, imagen);
                }
            }
            catch (Exception err)
            {
                string error = err.Message;
                MessageBox.Show("Ocurrio un Error, intente de nuevo.");
                string funcion = "fingerprint";
                Utilerias.LOG.write(_clase, funcion, error);
            }
        }
コード例 #9
0
        private void button_Guardar_Click(object sender, EventArgs e)
        {
            // Guarda en variables todos los campos de entrada
            String   Nombre    = textBox_Nombre.Text;
            String   Apellido  = textBox_Apellido.Text;
            String   DNI       = textBox_DNI.Text;
            String   Direccion = textBox_Direccion.Text;
            String   Telefono  = textBox_Telefono.Text;
            String   Mail      = textBox_Mail.Text;
            DateTime fechaDeNacimiento;

            DateTime.TryParse(textBox_FechaDeNacimiento.Text, out fechaDeNacimiento);



            // Crea Chofer

            try
            {
                Choferes chofer = new Choferes();

                chofer.SetNombre(Nombre);
                chofer.SetApellido(Apellido);
                chofer.SetDNI(DNI);
                chofer.SetDireccion(Direccion);
                chofer.SetTelefono(Telefono);
                chofer.SetMail(Mail);
                chofer.SetActivo(true);
                if (username != "" && contrasena != "")
                {
                    idUsuario = mapper.CrearUsuarioConValores(username, contrasena);
                }
                else
                {
                    idUsuario = mapper.CrearUsuarioConValores(DNI, DNI);
                }

                chofer.SetFechaDeNacimiento(fechaDeNacimiento);
                chofer.SetIdUsuario(idUsuario);
                idChofer = mapper.CrearChofer(chofer);


                if (idChofer > 0)
                {
                    MessageBox.Show("Chofer agregado correctamente");
                }
            }

            catch (CampoVacioException exceptionCampoVacio)
            {
                MessageBox.Show("Falta completar campo: " + exceptionCampoVacio.Message);
                return;
            }
            catch (FormatoInvalidoException exceptionFormato)
            {
                MessageBox.Show("Los datos fueron mal ingresados en: " + exceptionFormato.Message);
                return;
            }
            catch (TelefonoYaExisteException)
            {
                MessageBox.Show("Telefono ya existe");
                return;
            }
            catch (SqlException error)
            {
                switch (error.Number)
                {
                case 2627: MessageBox.Show("El DNI o el Telefono ya se encuentra registrado", "DNI Duplicado", MessageBoxButtons.OK, MessageBoxIcon.Error);     //Violacion de restriccion UNIQUE
                    return;

                case 8114: MessageBox.Show("Error de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);     //ERROR de conversion de datos
                    return;
                }
            }

            catch (FechaInvalidaException)
            {
                MessageBox.Show("Fecha no valida");
                return;
            }
            if (idUsuario != 0)
            {
                mapper.AsignarRolAUsuario(this.idUsuario, "Chofer");
            }

            if (creadoDesdeRegistrarUsuario)
            {
                this.Hide();
                new Login.LoginForm().ShowDialog();
                this.Close();
            }
            else
            {
                VolverAlMenu();
            }
        }
コード例 #10
0
ファイル: Parser.cs プロジェクト: jesumarquez/lt
        public override IMessage Decode(IFrame frame)
        {
            if (ParserUtils.IsInvalidDeviceId(Id))
            {
                return(null);
            }

            //Debug.Assert(Frame.Payload[5] == 0x77);
            //var SENDOK = Frame.Payload[7];
            //var IDLETIME = Frame.Payload[13] + Frame.Payload[14] << 8;

            var msgId       = BitConverter.ToUInt32(frame.Payload, 87);
            var tipoReporte = frame.Payload[4];

            var vel = Speed.KnotToKm(frame.Payload[26]);

            var hour8 = frame.Payload[27];

            if (hour8 < 0x80)
            {
                STrace.Trace(GetType().FullName, Id, "Descartando reporte por hora invalida");
                return(null);
            }

            var year   = Convert.ToInt32(frame.Payload[25].ToString("X2")) + ((DateTime.UtcNow.Year / 100) * 100);
            var month  = Convert.ToInt32(frame.Payload[24].ToString("X2"));
            var day    = Convert.ToInt32(frame.Payload[23].ToString("X2"));
            var minute = Convert.ToInt32(frame.Payload[28].ToString("X2"));
            var second = Convert.ToInt32(frame.Payload[29].ToString("X2"));

            var hour = Convert.ToInt32((hour8 - 0x80).ToString("X2"));
            var date = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc);
            var lat  = (float)(BitConverter.ToInt32(frame.Payload, 30) / (-600000.0));
            var lon  = (float)(BitConverter.ToInt32(frame.Payload, 34) / (-600000.0));

            var pos = GPSPoint.Factory(date, lat, lon, vel);

            //var TIMESPEED = Frame.Payload[38];
            //var SPEED = Frame.Payload[39-49];

            var chofer = (frame.Payload[62] + frame.Payload[63] << 8).ToString("X10");

            lock (ChoferesLock)
            {
                if (Choferes.ContainsKey(Id))
                {
                    var lastChofer = Choferes[Id];
                    ProcessChoferState(pos, date, msgId, lastChofer, 1);                 //logout
                    ProcessChoferState(pos, date, msgId, chofer, 0);                     //login
                }
                else
                {
                    Choferes.Add(Id, chofer);
                }
            }

            switch (tipoReporte)
            {
            case 0x17:     //Reset del equipo completo.
                return(MessageIdentifier.DeviceShutdown.FactoryEvent(MessageIdentifier.GenericMessage, Id, msgId, pos, date, chofer, null));

            case 0x18:     //Inicio (power up) del equipo.
                return(MessageIdentifier.DeviceTurnedOn.FactoryEvent(MessageIdentifier.GenericMessage, Id, msgId, pos, date, chofer, null));

            case 0x19:     //Intento de reconexión del modulo GSM.
                return(MessageIdentifier.GsmSignalOn.FactoryEvent(MessageIdentifier.GenericMessage, Id, msgId, pos, date, chofer, null));

            case 0x25:     //Reset del modulo GPS.
                return(MessageIdentifier.GpsSignalOff.FactoryEvent(MessageIdentifier.GenericMessage, Id, msgId, pos, date, chofer, null));

            case 0x63:     //Recupero de información.//posicion encolada
            case 0x64:     //Información actual.//posicion online
            case 0x65:     //Información actual conectado a capturador de datos.//posicion online
                return(pos.ToPosition(Id, msgId));

            default:
                STrace.Debug(GetType().FullName, Id, String.Format("Llego reporte de tipo no soportado: tipo=0x{0:X2} lat={1} lon={2} date={3} chofer={4}", tipoReporte, pos.Lat, pos.Lon, date, chofer));
                return(null);
            }
        }
コード例 #11
0
        /** Chofer **/

        public int CrearChofer(Choferes chofer)
        {
            return(this.Crear(chofer));
        }
コード例 #12
0
        private void button_Guardar_Click(object sender, EventArgs e)
        {
            // Guarda en variables todos los campos de entrada

            String   Nombre   = textBox_Nombre.Text;
            String   Mail     = textBox_Mail.Text;
            String   DNI      = textBox_DNI.Text;
            String   Apellido = textBox_Apellido.Text;
            DateTime fechaDeNacimiento;

            DateTime.TryParse(textBox_FechaDeNacimiento.Text, out fechaDeNacimiento);
            String  telefono = textBox_Telefono.Text;
            Boolean activo   = checkBox_Habilitado.Checked; //La variable activo que esta en el checkbox es para saber si esta habilitado a nivel usuario
            Boolean pudoModificar;
            String  Direccion = textBox_Direccion.Text;

            try
            {
                Choferes chofer = new Choferes();

                chofer.SetNombre(Nombre);
                chofer.SetApellido(Mail);
                chofer.SetDNI(DNI);
                chofer.SetApellido(Apellido);
                chofer.SetFechaDeNacimiento(fechaDeNacimiento);
                chofer.SetActivo(activo);
                chofer.SetMail(Mail);
                chofer.SetDireccion(Direccion);
                chofer.SetIdUsuario(idUsuario);
                chofer.SetTelefono(telefono);
                mapper.ActualizarEstadoUsuario(idChofer, activo);

                pudoModificar = mapper.Modificar(idChofer, chofer);
                if (pudoModificar)
                {
                    MessageBox.Show("Chofer modificado correctamente");
                    String usernameIgualAlDNI = Convert.ToString(mapper.SelectFromWhere("usuario_name", "Usuario", "usuario_id", this.idUsuario));
                    if (DNI != this.dniViejo && dniViejo == usernameIgualAlDNI)
                    {
                        mapper.ActualizarUsuarioyPassword(this.idUsuario, DNI, DNI);//solo le cambio usuario y contraseña cuando se modifica el dni de alguno de los choferes migrados ,cualquier chofer agregado a la migracion no
                        MessageBox.Show("Contraseña modificada", "Actulizacion Contraseña", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }



            catch (CampoVacioException exception)
            {
                MessageBox.Show("Falta completar campo: " + exception.Message);
                return;
            }
            catch (FormatoInvalidoException exception)
            {
                MessageBox.Show("Datos mal ingresados en: " + exception.Message);
                return;
            }
            catch (TelefonoYaExisteException exception)
            {
                MessageBox.Show("Telefono ya existe" + exception.Message);
                return;
            }

            catch (FechaInvalidaException exception)
            {
                MessageBox.Show("Fecha no valida" + exception.Message);
                return;
            }
            catch (SqlException error)
            {
                switch (error.Number)
                {
                case 2627: MessageBox.Show("El DNI o el Telefono ya se encuentra registrado", "DNI Duplicado", MessageBoxButtons.OK, MessageBoxIcon.Error);     //Violacion de restriccion UNIQUE
                    return;

                case 8114: MessageBox.Show("Error de datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);     //ERROR de conversion de datos
                    return;
                }
            }

            this.Close();
        }
コード例 #13
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (pictureBox1.Image != null)
                {
                    if (_dato == "Usuarios")
                    {
                        Bitmap img = new Bitmap(pictureBox1.Image, 320, 240);

                        Usuarios usuarios = Owner as Usuarios;

                        usuarios.AsignarFoto(img);

                        this.Close();
                    }
                    if (_dato == "Choferes")
                    {
                        Bitmap img = new Bitmap(pictureBox1.Image, 320, 240);

                        Choferes chofer = Owner as Choferes;

                        chofer.AsignarFoto(img);

                        this.Close();
                    }
                    if (_dato == "Socios")
                    {
                        Bitmap img = new Bitmap(pictureBox1.Image, 320, 240);

                        Socios socios = Owner as Socios;

                        socios.AsignarFoto(img);

                        this.Close();
                    }
                    if (_dato == "socioalterno")
                    {
                        this.WindowState = FormWindowState.Minimized;
                        Bitmap img = new Bitmap(pictureBox1.Image, 320, 240);

                        Socios socios = Owner as Socios;

                        socios.AsignarFotoalterno(img);

                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("El driver de la webcam no esta instalado .");
                }
            }
            catch (Exception err)
            {
                string error = err.Message;
                MessageBox.Show("Ocurrio un Error, intente de nuevo.");
                string funcion = "button2(seleccionarfoto)";
                Utilerias.LOG.write(_clase, funcion, error);
            }
        }