public bool Consultar() { if (iCodigo == 0) { strError = "No definió el código de la cabaña"; return(false); } clsConexion oConexion = new clsConexion(); strSQL = "SELECT [IdCabaña] " + ",[IdServicio]" + ",[IdTarifa]" + ",[IdImplementos]" + ",[Descripcion]" + ",[Nombre]" + "FROM [DBHosteria_Tesoro].[dbo].[Cabaña]" + "WHERE [IdCabaña] = " + iCodigo + ""; //Se debe pasar la propiedad SQL al objeto conexion oConexion.SQL = strSQL; //Se invoca el método de consultar de la clase conexión if (oConexion.Consultar()) { //Verificar si hay datos if (oConexion.Reader.HasRows) { //Hay que invocar el método Read oConexion.Reader.Read(); strNombre = oConexion.Reader.GetString(4); strDescripción = oConexion.Reader.GetString(5); oConexion = null; return(true); } else { //No hay datos, se debe generar un mensaje de error strError = "El documento del empleado no existe en la base de datos"; oConexion = null; return(false); } } else { //Hubo un error al consultar, se lee el error, se libera memoria y se retorna strError = oConexion.Error; oConexion = null; return(false); } }
public frmLogin() { InitializeComponent(); fuente = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.5d, 0.5d); gris = null; listaEntranamientoImagen = new List<Image<Gray, byte>>(); listaEtiqueta = new List<string>(); objCon = new clsConexion(); liveCam.ImageLocation = "img/default.png"; rostro = new HaarCascade("haarcascade_frontalface_default.xml"); //cargo la deteccion de rostros por cascada cargarDatos(); }
public bool Consultar1() { if (string.IsNullOrEmpty(strDocumento)) { strError = "No definió el documento del Cliente"; return(false); } clsConexion oConexion = new clsConexion(); strSQL = "SELECT strNombre_CLIE, strPrimerApellido_CLIE, strSegundoApellido_CLIE, strDireccion_CLIE " + " " + " FROM dbo.Cliente" + " WHERE strDocumento_CLIE = '" + strDocumento + "'"; //Se debe pasar la propiedad SQL al objeto conexion oConexion.SQL = strSQL; //Se invoca el método de consultar de la clase conexión if (oConexion.Consultar()) { //Verificar si hay datos if (oConexion.Reader.HasRows) { //Hay que invocar el método Read oConexion.Reader.Read(); strNombre = oConexion.Reader.GetString(0); strPrimerApellido = oConexion.Reader.GetString(1); strSegundoApellido = oConexion.Reader.GetString(2); strDireccion = oConexion.Reader.GetString(3); oConexion = null; return(true); } else { //No hay datos, se debe generar un mensaje de error strError = "El documento del cliente no existe en la base de datos"; oConexion = null; return(false); } } else { //Hubo un error al consultar, se lee el error, se libera memoria y se retorna strError = oConexion.Error; oConexion = null; return(false); } }
public frmAgregarProductos(clsConexion cone, clsEntidadUsuario pEntidadUsuario, clsEntidadVista vista) { materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.DeepOrange700, Primary.DeepOrange900, Primary.DeepOrange500, Accent.DeepOrange200, TextShade.WHITE); this.conexion = cone; this.pEntidadVista = vista; this.usuarios = pEntidadUsuario; this.productos = new clsEntidadProducto(); this.clProductos = new clsProducto(); this.clVistas = new clsVistas(); InitializeComponent(); }
public bool ConsultarVehiculo() { SQL = "SELECT PLACA FROM TBL_VEHICULO WHERE PLACA = @prPlaca"; /* SQL = "SELECT strNombre_CLIE, strPrimerApellido_CLIE, " + * "strSegundoApellido_CLIE, strDireccion_CLIE " + * "FROM tblCliente " + * "WHERE strDocumento_CLIE = @prDocumento";*/ clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.AgregarParametro("@prPlaca", Placa); //Se invoca el método consultar if (oConexion.Consultar()) { //Se verifica si hay datos if (oConexion.Reader.HasRows) { //Tiene filas, se debe leer la información oConexion.Reader.Read(); //Se captura la información Placa = oConexion.Reader.GetString(0); //Libera memoria oConexion.CerrarConexion(); oConexion = null; return(true); } else { //No tiene filas, se levanta un error Error = "La Placa " + Placa + " no está en la base de datos. \n O no tiene un reserva activa \n Verifique la información ingresada"; //Cerrar la conexión oConexion.CerrarConexion(); oConexion = null; return(false); } } else { Error = oConexion.Error; //Se debe cerrar la conexión oConexion.CerrarConexion(); oConexion = null; return(false); } }
public frmAcceso() { materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.DeepOrange700, Primary.DeepOrange900, Primary.DeepOrange500, Accent.DeepOrange200, TextShade.WHITE); conexion = new clsConexion(); intContador = 0; pEntidadUsuario = new clsEntidadUsuario(); usuario = new clsUsuario(); InitializeComponent(); }
public bool Consultar() { SQL = "Propietario_Consultar"; clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.StoredProcedure = true; oConexion.AgregarParametro("@prCedula", System.Data.SqlDbType.Int, 20, Cedula); //Se invoca el método consultar if (oConexion.Consultar()) { //Se verifica si hay datos if (oConexion.Reader.HasRows) { //Tiene filas, se debe leer la información oConexion.Reader.Read(); //Se captura la información Nombre = oConexion.Reader.GetString(0); Edad = oConexion.Reader.GetInt32(1); Telefono = oConexion.Reader.GetString(2); //Libera memoria oConexion.CerrarConexion(); oConexion = null; return(true); } else { //No tiene filas, se levanta un error Error = "El cliente con el Cedula " + Cedula + " no está en la base de datos. \nVerifique la información " + "o ingréselo al sistema"; //Cerrar la conexión oConexion.CerrarConexion(); oConexion = null; return(false); } } else { Error = oConexion.Error; //Se debe cerrar la conexión oConexion.CerrarConexion(); oConexion = null; return(false); } }
public MainForm(clsConexion cone, clsEntidadUsuario pEntidadUsuario) { InitializeComponent(); materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.DeepOrange700, Primary.DeepOrange900, Primary.DeepOrange500, Accent.DeepOrange200, TextShade.WHITE); this.conexion = cone; this.pEntidadUsuario = pEntidadUsuario; this.pEntidadVista = new clsEntidadVista(); this.clUsuario = new clsUsuario(); }
public frmListadoFacturas(clsConexion cone, clsEntidadUsuario pEntidadUsuario, clsEntidadVista vista) { materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.DeepOrange700, Primary.DeepOrange900, Primary.DeepOrange500, Accent.DeepOrange200, TextShade.WHITE); this.clFactura = new clsFactura(); this.factura = new clsEntidadDetalleFactura(); facturaE = new clsEntidadFacturaEncabezado(); this.conexion = cone; usuario = pEntidadUsuario; this.clVistas = new clsVistas(); InitializeComponent(); }
public frmModificarRolesVistas(clsConexion cone, string tipo) { materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.DeepOrange700, Primary.DeepOrange900, Primary.DeepOrange500, Accent.DeepOrange200, TextShade.WHITE); this.conexion = cone; this.clRolVista = new clsRolVista(); this.clUsuarioVista = new clsUsuarioVista(); Tipo = tipo; InitializeComponent(); }
public bool Grabar() { if (Validar()) { //Debe grabar en la base de datos //Se debe agregar una referencia a la librería: libComunes //y agregar el using en la libreria //Creamos la instancia de la clase conexion clsConexion oConexion = new clsConexion(); //Debemos crear la instrucción SQL strSQL = "INSERT INTO [DBHosteria_Tesoro].[dbo].[Cliente]" + "([strDocumento_CLIE]" + ",[strNombre_CLIE]" + " ,[strPrimerApellido_CLIE]" + ",[strSegundoApellido_CLIE]" + ",[strDireccion_CLIE])" + "VALUES " + "('" + strDocumento + "','" + strNombre + "','" + strPrimerApellido + "','" + strSegundoApellido + "','" + strDireccion + "'" + ")"; //Se debe pasar la propiedad sql al objeto oConexion.SQL = strSQL; //Ejecutamos la sentencia SQL if (oConexion.EjecutarSentencia()) { //Ejecuto correctamente: Grabo los datos, debo liberar memoria //y retornar verdader oConexion = null; return(true); } else { //Hubo un error: Capturar el error, liberar y retornar strError = oConexion.Error; oConexion = null; return(false); } } else { return(false); } }
public bool Actualizar() { if (Validar()) { //Debe grabar en la base de datos //Se debe agregar una referencia a la librería: libComunes //y agregar el using en la libreria //Creamos la instancia de la clase conexion clsConexion oConexion = new clsConexion(); //Debemos crear la instrucción SQL strSQL = "UPDATE [DBHosteria_Tesoro].[dbo].[Cabaña]" + " SET [IdCabaña] = " + iCodigo + ", " + "[IdServicio] = " + iServicio + ", " + "[IdTarifa] = " + iTarifa + ", " + "[IdImplementos] = " + iImplemento + ", " + "[Descripcion] = '" + strDescripción + "' " + "WHERE [IdCabaña] = " + iCodigo + ""; //Se debe pasar la propiedad sql al objeto oConexion.SQL = strSQL; //Ejecutamos la sentencia SQL if (oConexion.EjecutarSentencia()) { //Ejecuto correctamente: Grabo los datos, debo liberar memoria //y retornar verdader oConexion = null; return(true); } else { //Hubo un error: Capturar el error, liberar y retornar strError = oConexion.Error; oConexion = null; return(false); } } else { return(false); } }
public MainWindow() { InitializeComponent(); CenterWindowOnScreen(); cone = new clsConexion(); user = "******"; password = "******"; database = "colegio"; port = "3306"; server = "localhost"; connStr = "server=" + server + ";user="******";database=" + database + ";port=" + port + ";password=" + password; mostrarAlumnos(); }
public frmAdmin(string nomAdmin) { InitializeComponent(); fuente = new MCvFont(FONT.CV_FONT_HERSHEY_TRIPLEX, 0.5d, 0.5d); rostroEntrenado = null; gris = null; listaEntranamientoImagen = new List <Image <Gray, byte> >(); listaEtiqueta = new List <string>(); listaNombres = new List <string>(); intNumFotoCap = 0; objCon = new clsConexion(); strNombreAdmin = nomAdmin; ucBuscar1.BringToFront(); liveCam.ImageLocation = "img/default.png"; rostro = new HaarCascade("haarcascade_frontalface_default.xml"); //cargo la detección de rostros por cascada cargarDatos(); }
private bool GrabarEncabezado() { SQL = "Factura_GrabarEncabezado"; clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.StoredProcedure = true; oConexion.AgregarParametro("@prCedulaPropietario", System.Data.SqlDbType.BigInt, 20, Cedula); oConexion.AgregarParametro("@prVendedor", System.Data.SqlDbType.Int, 4, Vendedor); //Ejecuta consultar if (oConexion.Consultar()) { //Guarda los datos en un objeto Reader, permite leer los datos hacia adelante (Cada fila) //En cada fila, el READER maneja los datos como un vector. //Lo primero que se revisa es si hay datos. if (oConexion.Reader.HasRows) { //Se debe leer el Reader oConexion.Reader.Read(); NumeroFactura = oConexion.Reader.GetInt32(0); //Cerrar conexion, liberar y retornar Error = " el número de factura: " + NumeroFactura; oConexion.CerrarConexion(); oConexion = null; return(true); } else { Error = "No pudo generar el número de factura"; oConexion.CerrarConexion(); oConexion = null; return(false); } } else { Error = oConexion.Error; oConexion.CerrarConexion(); oConexion = null; return(false); } }
public bool Actualizar() { if (Validar()) { //Debe grabar en la base de datos //Se debe agregar una referencia a la librería: libComunes //y agregar el using en la libreria //Creamos la instancia de la clase conexion clsConexion oConexion = new clsConexion(); //Debemos crear la instrucción SQL strSQL = "UPDATE Empleado " + "SET strNombre_EMPL ='" + strNombre + "', " + "strPrimerApellido_EMPL = '" + strPrimerApellido + "', " + "strSegundoApellido_EMPL = '" + strSegundoApellido + "', " + "strDireccion_EMPL = '" + strDireccion + "', " + "strTelefono_EMPL = '" + strTelefono + "' " + "WHERE strDocumento_EMPL = '" + strDocumento + "'"; //Se debe pasar la propiedad sql al objeto oConexion.SQL = strSQL; //Ejecutamos la sentencia SQL if (oConexion.EjecutarSentencia()) { //Ejecuto correctamente: Grabo los datos, debo liberar memoria //y retornar verdader oConexion = null; return(true); } else { //Hubo un error: Capturar el error, liberar y retornar strError = oConexion.Error; oConexion = null; return(false); } } else { return(false); } }
public frmAsignarRol(clsConexion cone, clsEntidadUsuario pEntidadUsuario, clsEntidadVista vistas) { materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.DeepOrange700, Primary.DeepOrange900, Primary.DeepOrange500, Accent.DeepOrange200, TextShade.WHITE); this.conexion = cone; this.pEntidadVista = vistas; this.usuario = pEntidadUsuario; this.pEntidadRol = new clsEntidadRol(); this.clUsuario = new clsUsuario(); this.clRol = new clsRol(); this.pEntidadRol = new clsEntidadRol(); this.pEntidadRolesUsurios = new clsEntidadRolesUsuarios(); this.clRolesUsuarios = new clsRolesUsuarios(); this.clVistas = new clsVistas(); InitializeComponent(); }
public bool ConsultarPrecio() { SQL = "Repuesto_ConsultarValorUnitario"; clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.StoredProcedure = true; oConexion.AgregarParametro("@prCodigo", System.Data.SqlDbType.Int, 4, codigo); //Ejecuta consultar if (oConexion.Consultar()) { //Guarda los datos en un objeto Reader, permite leer los datos hacia adelante (Cada fila) //En cada fila, el READER maneja los datos como un vector. //Lo primero que se revisa es si hay datos. if (oConexion.Reader.HasRows) { //Se debe leer el Reader oConexion.Reader.Read(); //Se leen los datos por posición y tipo de dato valor = oConexion.Reader.GetDouble(0); //Cerrar conexion, liberar y retornar oConexion.CerrarConexion(); oConexion = null; return(true); } else { error = "No existen Repuesto con el código: " + codigo; oConexion.CerrarConexion(); oConexion = null; return(false); } } else { error = oConexion.Error; oConexion.CerrarConexion(); oConexion = null; return(false); } }
public bool Consultar() { if (string.IsNullOrEmpty(strDocumento)) { strError = "No definió el documento del cliente"; return(false); } strSQL = "SELECT strNombre_CLIE, strPrimerApellido_CLIE, strSegundoApellido_CLIE " + "FROM Cliente " + "WHERE strDocumento_CLIE = '" + strDocumento + "'"; clsConexion oConexion = new clsConexion(); oConexion.SQL = strSQL; if (oConexion.Consultar()) { if (oConexion.Reader.HasRows) { oConexion.Reader.Read(); strNombre = oConexion.Reader.GetString(0); strPrimerApellido = oConexion.Reader.GetString(1); strSegundoApellido = oConexion.Reader.GetString(2); oConexion = null; return(true); } else { strError = "No hay datos de cliente para el documento seleccionado"; oConexion = null; return(false); } } else { strError = oConexion.Error; oConexion = null; return(false); } }
public bool Borrar() { SQL = "Repuesto_Delete"; clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.AgregarParametro("@prCodigo", System.Data.SqlDbType.BigInt, 8, codigo); oConexion.StoredProcedure = true; if (oConexion.EjecutarSentencia()) { oConexion = null; return(true); } else { error = oConexion.Error; oConexion = null; return(false); } }
private bool CalcularTotal() { SQL = "Factura_CalcularTotal"; clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.StoredProcedure = true; oConexion.AgregarParametro("@prFactura", System.Data.SqlDbType.Int, 20, NumeroFactura); //Ejecuta consultar if (oConexion.Consultar()) { //Guarda los datos en un objeto Reader, permite leer los datos hacia adelante (Cada fila) //En cada fila, el READER maneja los datos como un vector. //Lo primero que se revisa es si hay datos. if (oConexion.Reader.HasRows) { //Se debe leer el Reader oConexion.Reader.Read(); Total = oConexion.Reader.GetInt32(0); //Cerrar conexion, liberar y retornar oConexion.CerrarConexion(); oConexion = null; return(true); } else { Error = "No pudo consultar el total de la factura: " + NumeroFactura; oConexion.CerrarConexion(); oConexion = null; return(false); } } else { Error = oConexion.Error; oConexion.CerrarConexion(); oConexion = null; return(false); } }
public frmLista(clsConexion conexion, string tipo) { materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.DeepOrange700, Primary.DeepOrange900, Primary.DeepOrange500, Accent.DeepOrange200, TextShade.WHITE); this.conexion = conexion; pEntidadProducto = new clsEntidadProducto(); pEntidadUsuario = new clsEntidadUsuario(); clProducto = new clsProducto(); clUsuarios = new clsUsuario(); clRol = new clsRol(); clVistas = new clsVistas(); this.tipo = tipo; InitializeComponent(); }
public bool Grabar() { if (Validar()) { //Debe grabar en la base de datos //Se debe agregar una referencia a la librería: libComunes //y agregar el using en la libreria //Creamos la instancia de la clase conexion clsConexion oConexion = new clsConexion(); //Debemos crear la instrucción SQL strSQL = "INSERT INTO [DBHosteria_Tesoro].[dbo].[Reservas]([IdCliente],[IdCabaña],[IdEmpleado],[Descripcion],[FechaIngreso],[FechaSalida],[Hora] " + ") VALUES(" + iCliente + "," + iCabaña + "," + iEmpleado + ",'" + strDescripción + "','" + DtFechaIngreso.ToShortDateString() + "','" + DtFechaSalida.ToShortDateString() + "','" + DtHora + "')"; //Se debe pasar la propiedad sql al objeto oConexion.SQL = strSQL; //Ejecutamos la sentencia SQL if (oConexion.EjecutarSentencia()) { //Ejecuto correctamente: Grabo los datos, debo liberar memoria //y retornar verdader oConexion = null; return(true); } else { //Hubo un error: Capturar el error, liberar y retornar strError = oConexion.Error; oConexion = null; return(false); } } else { return(false); } }
public bool LlenarGridWeb() { if (grdGenerico == null) { strError = "No ha definido el grid que se va a llenar"; return(false); } if (strSQL == "") { strError = "Debe definir una instrucción SQL"; return(false); } clsConexion objConexionBd = new clsConexion(); if (string.IsNullOrEmpty(strNombreTabla)) { strNombreTabla = "Tabla"; } objConexionBd.NombreTabla = strNombreTabla; objConexionBd.StoredProcedure = StoredProcedure; objConexionBd.oCommand = oCommand; objConexionBd.SQL = strSQL; if (objConexionBd.LlenarDataSet()) { grdGenerico.DataSource = objConexionBd.DATASET.Tables[strNombreTabla]; grdGenerico.DataBind(); objConexionBd.CerrarConexion(); objConexionBd = null; return(true); } else { strError = objConexionBd.Error; objConexionBd.CerrarConexion(); objConexionBd = null; return(false); } }
/* * public bool Actualizar() * { * if (Validar()) * { * //Debe grabar en la base de datos * //Se debe agregar una referencia a la librería: libComunes * //y agregar el using en la libreria * //Creamos la instancia de la clase conexion * clsConexion oConexion = new clsConexion(); * * //Debemos crear la instrucción SQL * strSQL = "UPDATE tblEmpleado " + * "SET strNombre_EMPL ='" + strNombre + "', " + * "strPrimerApellido_EMPL = '" + strPrimerApellido + "', " + * "strSegundoApellido_EMPL = '" + strSegundoApellido + "', " + * "strDireccion_EMPL = '" + strDireccion + "', " + * "strTelefono_EMPL = '" + strTelefono + "' " + * "WHERE strDocumento_EMPL = '" + strDocumento + "'"; * * //Se debe pasar la propiedad sql al objeto * oConexion.SQL = strSQL; * * //Ejecutamos la sentencia SQL * if (oConexion.EjecutarSentencia()) * { * //Ejecuto correctamente: Grabo los datos, debo liberar memoria * //y retornar verdader * oConexion = null; * return true; * } * else * { * //Hubo un error: Capturar el error, liberar y retornar * strError = oConexion.Error; * oConexion = null; * return false; * } * } * else * { * return false; * } * } */ public bool Grabar() { if (Validar()) { //Debe grabar en la base de datos //Se debe agregar una referencia a la librería: libComunes //y agregar el using en la libreria //Creamos la instancia de la clase conexion clsConexion oConexion = new clsConexion(); //Debemos crear la instrucción SQL strSQL = "INSERT INTO [DBHosteria_Tesoro].[dbo].[Promocion]([IdServicio],[IdCabaña],[Descripcion],[Nombre])" + "VALUES(" + iServicio + "," + iCabaña + ",'" + strDescripción + "','" + strNombre + "')"; //Se debe pasar la propiedad sql al objeto oConexion.SQL = strSQL; //Ejecutamos la sentencia SQL if (oConexion.EjecutarSentencia()) { //Ejecuto correctamente: Grabo los datos, debo liberar memoria //y retornar verdader oConexion = null; return(true); } else { //Hubo un error: Capturar el error, liberar y retornar strError = oConexion.Error; oConexion = null; return(false); } } else { return(false); } }
public bool Ingresar() { SQL = "Servicio_Insert"; clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.AgregarParametro("@prCodigo", System.Data.SqlDbType.BigInt, 8, codigo); oConexion.AgregarParametro("@prNombre", System.Data.SqlDbType.VarChar, 30, nombre); oConexion.AgregarParametro("@prValor", System.Data.SqlDbType.Float, 8, valor); oConexion.StoredProcedure = true; if (oConexion.EjecutarSentencia()) { oConexion = null; return(true); } else { error = oConexion.Error; oConexion = null; return(false); } }
public bool LlenarComboWeb() { if (Validar()) { if (objcboGenericoWeb == null) { strError = "No definió el combo"; return(false); } clsConexion objConexionBD = new clsConexion(); objConexionBD.NombreTabla = strNombreTabla; objConexionBD.StoredProcedure = StoredProcedure; objConexionBD.SQL = strSQL; objConexionBD.oCommand = oCommand; if (objConexionBD.LlenarDataSet()) { objcboGenericoWeb.DataSource = objConexionBD.DATASET.Tables[strNombreTabla]; objcboGenericoWeb.DataTextField = strColumnaTexto; objcboGenericoWeb.DataValueField = strColumnaValor; objcboGenericoWeb.DataBind(); objConexionBD.CerrarConexion(); objConexionBD = null; return(true); } else { strError = objConexionBD.Error; objConexionBD.CerrarConexion(); objConexionBD = null; return(false); } } else { return(false); } }
public string[] validar(string[] _Campos) { string[] Datos = new string[12]; clsConexion objConexion = new clsConexion(); if (objConexion.abrirConexion()) { DataTable dtEmpresa = new DataTable(); string query = string.Format("select * from empresa where nombre = '{0}';", _Campos[0]); dtEmpresa = objConexion.consultar(query); if (dtEmpresa != null && dtEmpresa.Rows.Count == 1) { DataTable dtUsuario = new DataTable(); query = string.Format("select * from usuario where nombre = '{0}' and id_empresa = {1};", _Campos[1], Convert.ToInt32(dtEmpresa.Rows[0][0])); dtUsuario = objConexion.consultar(query); if (dtUsuario != null && dtUsuario.Rows.Count == 1) { if (_Campos[2].Equals(dtUsuario.Rows[0][3].ToString())) { Datos[0] = (dtEmpresa.Rows[0][0].ToString()); Datos[1] = (dtEmpresa.Rows[0][1].ToString()); Datos[2] = (dtEmpresa.Rows[0][2].ToString()); Datos[3] = (dtEmpresa.Rows[0][3].ToString()); Datos[4] = (dtEmpresa.Rows[0][4].ToString()); Datos[5] = (dtEmpresa.Rows[0][5].ToString()); Datos[6] = (dtUsuario.Rows[0][0].ToString()); Datos[7] = (dtUsuario.Rows[0][1].ToString()); Datos[8] = (dtUsuario.Rows[0][2].ToString()); Datos[9] = (dtUsuario.Rows[0][3].ToString()); Datos[10] = (dtUsuario.Rows[0][4].ToString()); Datos[11] = (Convert.ToInt32(dtUsuario.Rows[0][5])).ToString(); } } } objConexion.cerrarConexion(); } return(Datos); }
public bool Ingresar() { SQL = "SP_Devolver_Vehiculo"; clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.AgregarParametro("@ReservaId", System.Data.SqlDbType.BigInt, 8, reservaCodigo); oConexion.AgregarParametro("@KMDespues", System.Data.SqlDbType.Int, 8, kmFinal); oConexion.AgregarParametro("@Observaciones", System.Data.SqlDbType.VarChar, 300, descripcion); oConexion.AgregarParametro("@Multa", System.Data.SqlDbType.Int, 8, multa); oConexion.StoredProcedure = true; if (oConexion.EjecutarSentencia()) { oConexion = null; return(true); } else { error = oConexion.Error; oConexion = null; return(false); } }
public bool Actualizar() { SQL = "Propietario_Update"; clsConexion oConexion = new clsConexion(); oConexion.SQL = SQL; oConexion.AgregarParametro("@prCedula", System.Data.SqlDbType.BigInt, 8, Cedula); oConexion.AgregarParametro("@prNombre", System.Data.SqlDbType.VarChar, 30, Nombre); oConexion.AgregarParametro("@prEdad", System.Data.SqlDbType.Int, 8, Edad); oConexion.AgregarParametro("@prTelefono", System.Data.SqlDbType.VarChar, 10, Telefono); oConexion.StoredProcedure = true; if (oConexion.EjecutarSentencia()) { oConexion = null; return(true); } else { Error = oConexion.Error; oConexion = null; return(false); } }