Esempio n. 1
0
        public int Alta()
        {
            string huella1, huella2, fechaBaja;

            if (this.Dedo1Huella == null)
            {
                huella1 = "null";
            }
            else
            {
                huella1 = "'" + this.Dedo1Huella.ToString() + "'";
            }
            if (this.Dedo2Huella == null)
            {
                huella2 = "null";
            }
            else
            {
                huella2 = "'" + this.Dedo2Huella.ToString() + "'";
            }
            if (this.FechaBaja == null)
            {
                fechaBaja = "null";
            }
            else
            {
                fechaBaja = "'" + DateToSQL(this.FechaBaja) + "'";
            }
            string sqlsentencia = "INSERT INTO Personas"
                                  + "(nombre, imagen, apellido, idRolesPersonas, idTiposDocumento, FechaNacimiento, FechaBaja, FechaAlta, Celular, Dedo1Huella, Dedo2Huella, " +
                                  "Dedo1Checksum, Dedo2Checksum, Dedos, Activo, Masculino, Administrador, idNivelesSeguridad, NumeroDocumento) "
                                  + "values ("
                                  + " '" + this.Nombre + "',"
                                  + " @Imagen,"
                                  + " '" + this.Apellido + "',"
                                  + " '" + this.idRolesPersonas + "',"
                                  + " '" + this.idTiposDocumento + "',"
                                  + " '" + this.DateToSQL(FechaNacimiento) + "',"
                                  + " " + fechaBaja + ","
                                  + " '" + this.DateToSQL(FechaAlta) + "',"
                                  + " '" + this.Celular + "',"
                                  + " " + huella1 + ","
                                  + " " + huella2 + ","
                                  + " '" + this.Dedo1Checksum + "',"
                                  + " '" + this.Dedo2Checksum + "',"
                                  + " '" + this.Dedos + "',"
                                  + " '" + this.Activo + "',"
                                  + " '" + this.Masculino + "',"
                                  + " '" + this.Administrador + "',"
                                  + " '" + this.idNivelesSeguridad + "',"
                                  + " '" + this.NumeroDocumento + " ')";

            Persistence.Database oDatos = new Persistence.Database();
            oDatos.conectar();
            int ID = oDatos.Ejecutar_Sentencia_Imagen(sqlsentencia, this.Imagen);

            oDatos.Desconectar();
            return(ID);
        }
Esempio n. 2
0
        public void Modificacion()
        {
            string huella1, huella2, fechaBaja;

            if (this.Dedo1Huella == null)
            {
                huella1 = "null";
            }
            else
            {
                huella1 = "'" + this.Dedo1Huella.ToString() + "'";
            }
            if (this.Dedo2Huella == null)
            {
                huella2 = "null";
            }
            else
            {
                huella2 = "'" + this.Dedo2Huella.ToString() + "'";
            }
            if (this.FechaBaja == null)
            {
                fechaBaja = "null";
            }
            else
            {
                fechaBaja = "'" + DateToSQL(this.FechaBaja) + "'";
            }
            string sqlsentencia = "UPDATE Personas SET "
                                  + "nombre = " + this.Nombre + ","
                                  + "imagen = @Imagen,"
                                  + "apellido = " + this.Apellido + ","
                                  + "idRolesPersonas = " + this.idRolesPersonas + ","
                                  + "idTiposDocumento = " + this.idTiposDocumento + ","
                                  + "FechaNacimiento = " + this.FechaNacimiento + ","
                                  + "FechaBaja = " + this.FechaBaja + ","
                                  + "FechaAlta = " + this.FechaAlta + ","
                                  + "Celular = " + this.Celular + ","
                                  + "Dedo1Huella = " + this.Dedo1Huella + ","
                                  + "Dedo2Huella = " + this.Dedo2Huella + ","
                                  + "Dedo1Checksum = " + this.Dedo1Checksum + ","
                                  + "Dedo2Checksum = " + this.Dedo2Checksum + ","
                                  + "Dedos = " + this.Dedos + ","
                                  + "Activo = " + this.Activo + ","
                                  + "Masculino = " + this.Masculino + ","
                                  + "Administrador = " + this.Administrador + ","
                                  + "idNivelesSeguridad = " + this.idNivelesSeguridad + ","
                                  + "NumeroDocumento = " + this.NumeroDocumento
                                  + " WHERE idPersonas = " + this.idPersonas;

            Persistence.Database oDatos = new Persistence.Database();
            oDatos.conectar();
            oDatos.Desconectar();
            oDatos.Ejecutar_Sentencia_Imagen(sqlsentencia, this.Imagen);
        }