Example #1
0
        public void create(Alumno objAlumno)
        {
            string create = String.Format("INSERT INTO alumno(idAlumnos,nombre,apellido,telefono)VALUES({0},'{1}','{2}','{3}');", objAlumno.IdAlumno, objAlumno.Nombre, objAlumno.Apellido, objAlumno.Telefono);

            try
            {
                comando = new SqlCommand(create, objConexion.getCon());
                objConexion.getCon().Open();
                comando.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objConexion.getCon().Close();
                objConexion.cerrarConexion();
            }
        }
Example #2
0
        public void create(Alumno objAlumno)
        {
            string create = "insert into alumno(idAlumno,nombre,apellido,telefono)values('" + objAlumno.IdAlumno + "','" + objAlumno.Nombre + "','" + objAlumno.Apellido + "','" + objAlumno.Telefono + "')";

            try
            {
                comando = new SqlCommand(create, objConexion.getCon());
                objConexion.getCon().Open();
                comando.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objConexion.getCon().Close();
                objConexion.cerrarConexion();
            }
        }
Example #3
0
        public void create(Empleado objEmpleado)
        {
            string create = recursodao.insertdb + objEmpleado.IdEmpleado + "','" + objEmpleado.Nombre + "','" + objEmpleado.Apellido + ",'" + objEmpleado.Telefono + "')";

            try
            {
                comando = new SqlCommand(create, objConexion.getCon());
                objConexion.getCon().Open();
                comando.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objConexion.getCon().Close();
                objConexion.cerrarConexion();
            }
        }
Example #4
0
        public List <Factura> findAll(string tel, string estado)
        {
            List <Factura> listaFactura = new List <Factura>();

            try
            {
                comando = new SqlCommand("spObtenerFacturas", objConexion.getConexion())
                {
                    CommandType = CommandType.StoredProcedure
                };
                comando.Parameters.AddWithValue("@Tel", tel);
                comando.Parameters.AddWithValue("@Estado", estado);
                objConexion.getConexion().Open();
                SqlDataReader read = comando.ExecuteReader();
                while (read.Read())
                {
                    Factura objetoFactura = new Factura
                    {
                        ID    = Convert.ToInt32(read[0].ToString()),
                        Fecha = read[1].ToString()
                    };
                    listaFactura.Add(objetoFactura);
                }
            }

            catch (Exception)
            {
                throw;
            }
            finally
            {
                objConexion.getConexion().Close();
                objConexion.cerrarConexion();
            }
            return(listaFactura);
        }
Example #5
0
        public bool find(Bitacora objetoBitacora)
        {
            bool hayRegistros;

            try
            {
                comando             = new SqlCommand("spVerBitacora", objConexion.getConexion());
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.AddWithValue("@ID", objetoBitacora.IdBitacora);
                objConexion.getConexion().Open();
                SqlDataReader read = comando.ExecuteReader();
                hayRegistros = read.Read();
                if (hayRegistros)
                {
                    objetoBitacora.IdBitacora  = Convert.ToInt32(read[0].ToString());
                    objetoBitacora.Fecha       = Convert.ToString(read[1].ToString()).Split(' ')[0];
                    objetoBitacora.Hora        = Convert.ToString(read[1].ToString()).Split(' ')[1];
                    objetoBitacora.Usuario     = read[2].ToString();
                    objetoBitacora.Ip          = read[3].ToString();
                    objetoBitacora.IdTipo      = Convert.ToInt32(read[4].ToString());
                    objetoBitacora.IdEntidad   = Convert.ToInt32(read[5].ToString());
                    objetoBitacora.Jsonantes   = read[6].ToString();
                    objetoBitacora.Jsondespues = read[7].ToString();
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objConexion.getConexion().Close();
                objConexion.cerrarConexion();
            }
            return(hayRegistros);
        }
Example #6
0
        public List <CCobro_ConsumoAgua> findAll()
        {
            List <CCobro_ConsumoAgua> listaCobrosConsumoAgua = new List <CCobro_ConsumoAgua>();

            try
            {
                comando             = new SqlCommand("spObtenerCCobroConsumoAgua", objConexion.getConexion());
                comando.CommandType = CommandType.StoredProcedure;
                objConexion.getConexion().Open();
                SqlDataReader read = comando.ExecuteReader();
                while (read.Read())
                {
                    CCobro_ConsumoAgua objetoCobro = new CCobro_ConsumoAgua();
                    objetoCobro.Nombre = read[0].ToString();
                    objetoCobro.TasaInteresesMoratorios = Convert.ToDecimal(read[1].ToString());
                    objetoCobro.DiaEmisionRecibo        = Convert.ToByte(read[2].ToString());
                    objetoCobro.QDiasVencimiento        = Convert.ToByte(read[2].ToString());
                    objetoCobro.EsImpuesto   = Convert.ToBoolean(read[3]);
                    objetoCobro.EsRecurrente = Convert.ToBoolean(read[4]);
                    objetoCobro.EsFijo       = Convert.ToBoolean(read[5]);
                    objetoCobro.TipoCCobro   = read[6].ToString();
                    objetoCobro.Activo       = Convert.ToBoolean(read[7].ToString());
                    objetoCobro.Consumo3     = Convert.ToInt32(read[8].ToString());
                    listaCobrosConsumoAgua.Add(objetoCobro);
                }
            }

            catch (Exception)
            {
                throw;
            }
            finally
            {
                objConexion.getConexion().Close();
                objConexion.cerrarConexion();
            }
            return(listaCobrosConsumoAgua);
        }
 public void create(Usuario objetoUsuario)
 {
     try
     {
         comando             = new SqlCommand("spInsertarUsuario", objConexion.getConexion());
         comando.CommandType = CommandType.StoredProcedure;
         comando.Parameters.AddWithValue("@Nombre", objetoUsuario.NombreUsuario);
         comando.Parameters.AddWithValue("@Password", objetoUsuario.Password);
         comando.Parameters.AddWithValue("@TipoUsuario", objetoUsuario.TipoUsuario);
         comando.Parameters.AddWithValue("@UsuarioACargo", host);
         comando.Parameters.AddWithValue("@IPusuario", ip);
         objConexion.getConexion().Open();
         comando.ExecuteNonQuery();
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         objConexion.getConexion().Close();
         objConexion.cerrarConexion();
     }
 }
Example #8
0
        public List <Recibo> findAllRecibosPe(int id, int estado)
        {
            Console.Out.Write(id);
            List <Recibo> listaRecibos = new List <Recibo>();
            List <int>    listaid      = new List <int>();

            try
            {
                comando             = new SqlCommand("spObtenerRecibosPedePropiedad", objConexion.getConexion());
                comando.CommandType = CommandType.StoredProcedure;
                comando.Parameters.AddWithValue("@id", id);
                comando.Parameters.AddWithValue("@estado", estado);
                objConexion.getConexion().Open();
                SqlDataReader read = comando.ExecuteReader();
                while (read.Read())
                {
                    Recibo objetoRecibo = new Recibo
                    {
                        IdRecibo = Convert.ToInt32(read[0].ToString()),
                        FechaEm  = read[1].ToString(),
                        NombreCC = read[2].ToString(),
                        Monto    = Convert.ToDecimal(read[3].ToString())
                    };
                    listaRecibos.Add(objetoRecibo);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objConexion.getConexion().Close();
                objConexion.cerrarConexion();
            }
            return(listaRecibos);
        }
Example #9
0
 public void create(Propietario objetoPropietario)
 {
     try
     {
         comando             = new SqlCommand("spInsertarPropietario", objConexion.getConexion());
         comando.CommandType = CommandType.StoredProcedure;
         comando.Parameters.AddWithValue("@Nombre", objetoPropietario.Nombre);
         comando.Parameters.AddWithValue("@IdTipoDocumento", objetoPropietario.TipoDocumento);
         comando.Parameters.AddWithValue("@ValorDocumento", objetoPropietario.ValorDocumentoId);
         comando.Parameters.AddWithValue("@UsuarioACargo", host);
         comando.Parameters.AddWithValue("@IPusuario", ip);
         objConexion.getConexion().Open();
         comando.ExecuteNonQuery();
         SqlDataReader read = comando.ExecuteReader();
         if (read.Read())
         {
             IDPJ = Convert.ToInt32(read[0].ToString());
         }
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         objConexion.getConexion().Close();
         objConexion.cerrarConexion();
     }
 }
 public void create(Propiedad objetoPropiedad)
 {
     try
     {
         comando             = new SqlCommand("spInsertarPropiedad", objConexion.getConexion());
         comando.CommandType = CommandType.StoredProcedure;
         comando.Parameters.AddWithValue("@NumFinca", objetoPropiedad.NumeroPropiedad);
         comando.Parameters.AddWithValue("@Valor", objetoPropiedad.ValorPropiedad);
         comando.Parameters.AddWithValue("@Direccion", objetoPropiedad.DireccionPropiedad);
         objConexion.getConexion().Open();
         comando.ExecuteNonQuery();
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         objConexion.getConexion().Close();
         objConexion.cerrarConexion();
     }
 }