Esempio n. 1
0
        public int Grabar(SistemaWebEntidades.Entidad EntUsuario)
        {
            SqlCommand cmd = new SqlCommand("SP_USUARIO_GRABA", cnx);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Nombre", EntUsuario.Nombre);
            cmd.Parameters.AddWithValue("@ApePat", EntUsuario.Apepat);
            cmd.Parameters.AddWithValue("@ApeMat", EntUsuario.Apemmat);
            cmd.Parameters.AddWithValue("@Login", EntUsuario.Login);
            cmd.Parameters.AddWithValue("@Password", EntUsuario.Password);
            cmd.Parameters.AddWithValue("@Email", EntUsuario.Email);
            cmd.Parameters.AddWithValue("@Celular", EntUsuario.Celular);
            cmd.Parameters.AddWithValue("@Telefono", EntUsuario.Telefono);
            cmd.Parameters.AddWithValue("@Direccion", EntUsuario.Direccion);
            cmd.Parameters.AddWithValue("@Idperfil", EntUsuario.Idperfil);
            try
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cnx.Open();
                int Retorno = cmd.ExecuteNonQuery();
                return(Retorno);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public int GrabarItem(SistemaWebEntidades.Entidad Ent)
        {
            SqlCommand cmd = new SqlCommand("SP_ITEM_GRABA", cnx);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@IdItem", Ent.Iditem);
            cmd.Parameters.AddWithValue("@Nombre", Ent.Nombre);
            cmd.Parameters.AddWithValue("@Precio", Ent.Precio);
            cmd.Parameters.AddWithValue("@TipoDeItem", Ent.Tipodeitem);
            cmd.Parameters.AddWithValue("@IdCategoria", Ent.Idcategoria);
            try
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cnx.Open();
                int Retorno = cmd.ExecuteNonQuery();
                return(Retorno);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public int GrabarPedido(SistemaWebEntidades.Entidad Ent)
        {
            SqlCommand cmd = new SqlCommand("SP_PEDIDOS_GRABA", cnx);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@IdPedido", Ent.Idpedido);
            cmd.Parameters.AddWithValue("@IdUsuario", Ent.Idusuario);
            cmd.Parameters.AddWithValue("@FechaReg", Ent.FechaReg);
            cmd.Parameters.AddWithValue("@FormaPago", Ent.Formapago);
            cmd.Parameters.AddWithValue("@FormaEnvio", Ent.Formaenvio);
            cmd.Parameters.AddWithValue("@Direccion", Ent.Direccion);
            cmd.Parameters.AddWithValue("@Telefono", Ent.Telefono);
            try
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cnx.Open();
                int Retorno = int.Parse(cmd.ExecuteScalar().ToString());
                return(Retorno);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public int GrabarPedidoDetalle(SistemaWebEntidades.Entidad Ent)
        {
            SqlCommand cmd = new SqlCommand("SP_PEDIDO_DETALLE_GRABA", cnx);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@IdPedido", Ent.Idpedido);
            cmd.Parameters.AddWithValue("@IdItem", Ent.Iditem);
            cmd.Parameters.AddWithValue("@Cantidad", Ent.Cantidad);
            cmd.Parameters.AddWithValue("@Precio", Ent.Precio);
            cmd.Parameters.AddWithValue("@Importe", Ent.Importe);
            try
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cnx.Open();
                int Retorno = cmd.ExecuteNonQuery();
                return(Retorno);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        public DataTable UsuarioListado(SistemaWebEntidades.Entidad EntUsuario)
        {
            DataTable      Tabla = new DataTable();
            SqlDataAdapter sda   = new SqlDataAdapter("SP_USUARIO_LISTADO", cnx);

            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.AddWithValue("@IdUsuario", EntUsuario.Idusuario);
            sda.Fill(Tabla);
            sda = null;
            return(Tabla);
        }
Esempio n. 6
0
        public DataTable ListaItemXId(SistemaWebEntidades.Entidad Ent)
        {
            DataTable      Tabla = new DataTable();
            SqlDataAdapter sda   = new SqlDataAdapter("SP_ITEM_X_ID", cnx);

            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.AddWithValue("@IdItem", Ent.Iditem);
            sda.Fill(Tabla);
            sda = null;
            return(Tabla);
        }
Esempio n. 7
0
        public DataTable ListaPedidoDetalle(SistemaWebEntidades.Entidad Ent)
        {
            DataTable      Tabla = new DataTable();
            SqlDataAdapter sda   = new SqlDataAdapter("SP_PEDIDO_DETALLE_LISTA", cnx);

            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.AddWithValue("@IdPedido", Ent.Idpedido);
            sda.Fill(Tabla);
            sda = null;
            return(Tabla);
        }
Esempio n. 8
0
        public DataTable Sesion(SistemaWebEntidades.Entidad EntUsuario)
        {
            DataTable      Tabla = new DataTable();
            SqlDataAdapter sda   = new SqlDataAdapter("SP_USUARIO_SESION", cnx);

            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.AddWithValue("@Login", EntUsuario.Login);
            sda.SelectCommand.Parameters.AddWithValue("@Password", EntUsuario.Password);
            sda.Fill(Tabla);
            sda = null;
            return(Tabla);
        }
Esempio n. 9
0
        public int Existe(SistemaWebEntidades.Entidad EntUsuario)
        {
            int            Retorno = 0;
            DataTable      Tabla   = new DataTable();
            SqlDataAdapter sda     = new SqlDataAdapter("SP_USUARIO_BUSCA_X_LOGIN", cnx);

            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.SelectCommand.Parameters.AddWithValue("@Login", EntUsuario.Login);
            sda.Fill(Tabla);
            Retorno = Tabla.Rows.Count;
            sda     = null;
            return(Retorno);
        }
Esempio n. 10
0
        public int EliminarItem(SistemaWebEntidades.Entidad Ent)
        {
            SqlCommand cmd = new SqlCommand("SP_ITEM_ELIMINA", cnx);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@IdItem", Ent.Iditem);
            try
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cnx.Open();
                int Retorno = cmd.ExecuteNonQuery();
                return(Retorno);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
Esempio n. 11
0
        public int ComprarPedido(SistemaWebEntidades.Entidad Ent)
        {
            SqlCommand cmd = new SqlCommand("SP_PEDIDOS_COMPRAR", cnx);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@IdPedido", Ent.Idpedido);
            try
            {
                if (cnx.State == ConnectionState.Open)
                {
                    cnx.Close();
                }
                cnx.Open();
                int Retorno = cmd.ExecuteNonQuery();
                return(Retorno);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }