public override bool agregarContrato() { string sql = "INSERT INTO Contrato VALUES ('" + NumeroContrato + "', GETDATE(), " + "convert(date, '" + FechaFinVigencia + "'), '" + RutCliente + "',(SELECT idPlan FROM [Plan] WHERE Nombre = '" + CodigoPlan + "'), " + TipoContrato + ", convert(date, '" + FechaInicioVigencia + "'), convert(date, '" + FechaFinVigencia + "'), " + Vigente + ", 0," + PrimaAnual.Replace(",", ".") + "," + PrimaMensual.Replace(",", ".") + ",'" + Observaciones + "');"; string sql1 = "INSERT INTO Vivienda VALUES ('" + CodigoPostal + "', " + Anio + ",'" + Direccion + "', " + ValorInmu + "," + ValorConte + "," + Region + ",(SELECT idComuna FROM Comuna WHERE NombreComuna = '" + Comuna + "'));"; string sql2 = "INSERT INTO Contrato_vivienda VALUES ('" + NumeroContrato + "', '" + CodigoPostal + "');"; bool guarda = objConec.insertar(sql); bool guarda1 = objConec.insertar(sql1); bool guarda2 = objConec.insertar(sql2); if (guarda == true) { return(guarda); } else { return(guarda); } }
public override bool agregarContrato() { string sql = "INSERT INTO Contrato VALUES ('" + NumeroContrato + "', GETDATE(), " + "convert(date, '" + FechaFinVigencia + "'), '" + RutCliente + "',(SELECT idPlan FROM [Plan] WHERE Nombre = '" + CodigoPlan + "'), " + TipoContrato + ", convert(date, '" + FechaInicioVigencia + "'), convert(date, '" + FechaFinVigencia + "'), " + Vigente + ", 0," + PrimaAnual.Replace(",", ".") + "," + PrimaMensual.Replace(",", ".") + ",'" + Observaciones + "');"; string sql1 = "INSERT INTO Vehiculo VALUES ('" + Patente + "'," + Marca + ", (SELECT IdModelo FROM ModeloVehiculo WHERE Descripcion = '" + Modelo + "')," + Anio + ");"; string sql2 = "INSERT INTO contratoVehiculo VALUES ('" + NumeroContrato + "', '" + Patente + "');"; bool guarda = objConec.insertar(sql); bool guarda1 = objConec.insertar(sql1); bool guarda2 = objConec.insertar(sql2); if (guarda == true) { return(guarda); } else { return(guarda); } }
public override bool editarContrato() { string campos = "CodigoPlan = (SELECT idPlan FROM [Plan] WHERE Nombre = '" + CodigoPlan + "') " + ", PrimaAnual = " + PrimaAnual.Replace(",", ".") + ", " + "PrimaMensual = " + PrimaMensual.Replace(",", ".") + ", Observaciones = '" + Observaciones + "' "; string condicion = " Numero = '" + NumeroContrato + "';"; bool edita = objConec.actualizar("Contrato", campos, condicion); string campos1 = "IdMarca =" + Marca + ", IdModelo = (SELECT IdModelo FROM ModeloVehiculo WHERE Descripcion = '" + Modelo + "')," + "Anho = " + Anio + ""; string condicion1 = "Patente = '" + Patente + "';"; bool edita1 = objConec.actualizar("Vehiculo", campos1, condicion1); if (edita == true) { return(edita); } else { return(edita); } }
public override bool editarContrato() { string campos = "CodigoPlan = (SELECT idPlan FROM [Plan] WHERE Nombre = '" + CodigoPlan + "') " + ", PrimaAnual = " + PrimaAnual.Replace(",", ".") + ", " + "PrimaMensual = " + PrimaMensual.Replace(",", ".") + ", Observaciones = '" + Observaciones + "' "; string condicion = " Numero = '" + NumeroContrato + "';"; bool edita = objConec.actualizar("Contrato", campos, condicion); string campos1 = "Anho = " + Anio + ", Direccion = '" + Direccion + "', ValorInmueble= " + ValorInmu + ", ValorContenido = " + ValorConte + ", IdRegion = " + Region + ", idComuna = (SELECT idComuna FROM Comuna WHERE NombreComuna = '" + Comuna + "') "; string condicion1 = "CodigoPostal = '" + CodigoPostal + "';"; bool edita1 = objConec.actualizar("Vivienda", campos1, condicion1); if (edita == true) { return(edita); } else { return(edita); } }
public override bool agregarContrato() { string sql = "INSERT INTO Contrato VALUES ('" + NumeroContrato + "', GETDATE(), " + "convert(date, '" + FechaFinVigencia + "'), '" + RutCliente + "',(SELECT idPlan FROM [Plan] WHERE Nombre = '" + CodigoPlan + "'), " + TipoContrato + ", convert(date, '" + FechaInicioVigencia + "'), convert(date, '" + FechaFinVigencia + "'), " + Vigente + ", " + DeclaracionSalud + "," + PrimaAnual.Replace(",", ".") + "," + PrimaMensual.Replace(",", ".") + ",'" + Observaciones + "');"; bool guarda = objConec.insertar(sql); if (guarda == true) { return(guarda); } else { return(guarda); } }
public override bool editarContrato() { string campos = "CodigoPlan = (SELECT idPlan FROM [Plan] WHERE Nombre = '" + CodigoPlan + "'), " + "DeclaracionSalud = " + DeclaracionSalud + ", PrimaAnual = " + PrimaAnual.Replace(",", ".") + ", " + "PrimaMensual = " + PrimaMensual.Replace(",", ".") + ", Observaciones = '" + Observaciones + "' "; string condicion = " Numero = '" + NumeroContrato + "';"; bool edita = objConec.actualizar("Contrato", campos, condicion); if (edita == true) { return(edita); } else { return(edita); } }