public void insertarCanje(string ID, string TipoDoc, string NroDoc, string Id_Catalogo, string Id_Planta, string Fecha, string Puntos_Necesarios) { string insert_Canje = "INSERT INTO Canje (ID, TipoDoc, NroDoc, Id_Catalogo, Id_Planta, Fecha, Puntos_a_Restar) VALUES ("; insert_Canje += ID + ", " + TipoDoc + ", " + NroDoc + ", " + Id_Catalogo + ", " + Id_Planta + ", CONVERT(VARCHAR(30), GETDATE(), 113) , " + Puntos_Necesarios + ")"; _BD.Insertar(insert_Canje); }
public string Insertar(Es_Producto datos) { string sqlInsert = @"INSERT INTO Producto(Codigo, Nombre, Tipo, Stock, Costo, Precio , Composicion, Estado) VALUES ("; sqlInsert += "'" + datos.Codigo + "'"; sqlInsert += ",'" + datos.Nombre + "'"; sqlInsert += ", '" + datos.Tipo + "'"; sqlInsert += ", '" + datos.Stock + "'"; sqlInsert += ", '" + datos.Costo + "'"; sqlInsert += ", '" + datos.Precio + "'"; sqlInsert += ", '" + datos.Composicion + "'"; sqlInsert += ", '" + datos.Estado + "')"; return(_BD.Insertar(sqlInsert)); }
// metodo para cargar la transaccion public void insertar(string Tipo_Factura, string Nro_Factura, string TipoDoc, string NroDoc, string fecha, string Id_Empleado, string monto, Grid01 plantas, Grid01 productos) { _BD.IniciarTransaccion(); string insert_factura = "INSERT INTO Factura (Tipo_Factura, Nro_Factura, TipoDoc, NroDoc, fecha, Id_Empleado,monto) VALUES ("; insert_factura += Tipo_Factura + ", " + Nro_Factura + ", " + TipoDoc + ", " + NroDoc + ", " + _BD.FormatearDato(fecha, "DateTime") + ", " + Id_Empleado + ", " + monto + ")"; _BD.Insertar(insert_factura); string insert_Detalle_factura = "INSERT INTO DetalleFactura (Tipo_Factura, Nro_Factura, Id_Planta," + " Id_Producto, Cantidad, Precio ) VALUES ("; for (int i = 0; i < plantas.Rows.Count; i++) { string datos_plantas = Tipo_Factura + ", " + Nro_Factura; datos_plantas += ", " + plantas.Rows[i].Cells[0].Value.ToString(); datos_plantas += ", " + 0; datos_plantas += ", " + plantas.Rows[i].Cells[2].Value.ToString(); datos_plantas += ", " + plantas.Rows[i].Cells[3].Value.ToString() + ")"; string insert_final = insert_Detalle_factura + datos_plantas; _BD.Insertar(insert_final); } for (int i = 0; i < productos.Rows.Count; i++) { string datos_productos = Tipo_Factura + ", " + Nro_Factura; datos_productos += ", " + 0; datos_productos += ", " + productos.Rows[i].Cells[0].Value.ToString(); datos_productos += ", " + productos.Rows[i].Cells[2].Value.ToString(); datos_productos += ", " + productos.Rows[i].Cells[3].Value.ToString() + ")"; string insert_final = insert_Detalle_factura + datos_productos; _BD.Insertar(insert_final); } if (_BD.CerrarTransaccion() == Be_BaseDeDatos.EstadoTransaccion.correcta) { MessageBox.Show("La factura se generó correctamente"); } else { MessageBox.Show("No se grabó nada hubo error"); } }
public void insertar(string TipoDoc, string NroDoc, string Tipo_Factura, string Nro_Factura, string Cantidad, string fecha) { string sqlInsert = "INSERT INTO Puntos (TipoDoc, NroDoc, Tipo_Factura, Nro_Factura, Cantidad, fecha) VALUES ("; sqlInsert += TipoDoc + ", " + NroDoc + ", " + Tipo_Factura + ", " + Nro_Factura + ", " + Cantidad + ", " + _BD.FormatearDato(fecha, "DateTime") + ")"; _BD.Insertar(sqlInsert); }
public string Insertar(Es_TipoProducto datos) { string sqlInsert = @"INSERT INTO TipoProducto(ID, Nombre, Descripcion, Estado) VALUES ("; sqlInsert += "'" + datos.ID + "'"; sqlInsert += ",'" + datos.Nombre + "'"; sqlInsert += ", '" + datos.Descripcion + "'"; sqlInsert += ", '" + datos.Estado + "')"; return(_BD.Insertar(sqlInsert)); }
public string Insertar(Es_Catalogo datos) { string sqlInsert = @"INSERT INTO Catalogo(ID,Id_Planta, Puntos_Necesarios, Estado) VALUES ("; sqlInsert += "'" + datos.ID + "'"; sqlInsert += ",'" + datos.Id_Planta + "'"; sqlInsert += ", '" + datos.Puntos_Necesarios + "'"; sqlInsert += ", '" + datos.Estado + "')"; return(_BD.Insertar(sqlInsert)); }
public string Insertar(Es_Planta datos) { string sqlInsert = @"INSERT INTO Plantas(Codigo, NombreCientifico, NombreComun, Tipo, Precio, Stock,Estado) VALUES ("; sqlInsert += "'" + datos.Codigo + "'"; sqlInsert += ",'" + datos.NombreCientifico + "'"; sqlInsert += ", '" + datos.NombreComun + "'"; sqlInsert += ", '" + datos.Tipo + "'"; sqlInsert += ", '" + datos.Precio + "'"; sqlInsert += ", '" + datos.Stock + "'"; sqlInsert += ", '" + datos.Estado + "')"; return(_BD.Insertar(sqlInsert)); }
public string Insertar(Es_Proveedor datos) { string sqlInsert = @"INSERT INTO Proveedor(ID,Nombre, Calle, Nro_Calle , Barrio, Localidad, Telefono, Razon_Social, Estado) VALUES ("; sqlInsert += "'" + datos.ID + "'"; sqlInsert += ",'" + datos.Nombre + "'"; sqlInsert += ", '" + datos.Calle + "'"; sqlInsert += ", '" + datos.Nro_Calle + "'"; sqlInsert += ", '" + datos.Barrio + "'"; sqlInsert += ", '" + datos.Localidad + "'"; sqlInsert += ", '" + datos.Telefono + "'"; sqlInsert += ", '" + datos.Razon_Social + "'"; sqlInsert += ", '" + datos.Estado + "')"; return(_BD.Insertar(sqlInsert)); }
public string Insertar(Es_Empleado datos) { string sqlInsert = @"INSERT INTO Empleado(ID,Nombre, Apellido, Telefono, Calle, Nro_Calle , Barrio, Localidad, Contraseña, Estado) VALUES ("; sqlInsert += " '" + datos.ID + "'"; sqlInsert += ", '" + datos.Nombre + "'"; sqlInsert += ", '" + datos.Apellido + "'"; sqlInsert += ", '" + datos.Telefono + "'"; sqlInsert += ", '" + datos.Calle + "'"; sqlInsert += ", '" + datos.Nro_Calle + "'"; sqlInsert += ", '" + datos.Barrio + "'"; sqlInsert += ", '" + datos.Localidad + "'"; sqlInsert += ", '" + datos.Contraseña + "'"; sqlInsert += ", '" + datos.Estado + "')"; return(_BD.Insertar(sqlInsert)); }
public string Insertar(Es_Cliente datos) { string sqlInsert = @"INSERT INTO Cliente(TipoDoc, NroDoc, Nombre, Apellido, Calle, NroCalle, Barrio , Localidad, Telefono, Email, Estado) VALUES ("; sqlInsert += " '" + datos.TipoDoc + "'"; sqlInsert += ", '" + datos.NroDoc + "'"; sqlInsert += ", '" + datos.Nombre + "'"; sqlInsert += ", '" + datos.Apellido + "'"; sqlInsert += ", '" + datos.Calle + "'"; sqlInsert += ", '" + datos.NroCalle + "'"; sqlInsert += ", '" + datos.Barrio + "'"; sqlInsert += ", '" + datos.Localidad + "'"; sqlInsert += ", '" + datos.Telefono + "'"; sqlInsert += ", '" + datos.Email + "'"; sqlInsert += ", '" + datos.Estado + "')"; return(_BD.Insertar(sqlInsert)); }