예제 #1
0
        public int getUltimaPaginaRubros(List <Rubro> rubros)
        {
            string query = "SELECT [TheBigBangQuery].[getUltimaLineaFiltroRubro](@table, @fechaActual)";

            try
            {
                SqlCommand com = new SqlCommand(query);

                DataTable table = new DataTable();
                table.Columns.Add("rub_id", typeof(decimal));

                foreach (Rubro r in rubros)
                {
                    table.Rows.Add(r.id);
                }

                SqlParameter param = new SqlParameter("@table", SqlDbType.Structured);
                param.TypeName = "[TheBigBangQuery].[RubrosList]";
                param.Value    = table;

                com.Parameters.Add(param);
                com.Parameters.AddWithValue("@fechaActual", Generals.getFecha());

                return(DatabaseConection.executeParamFunction <int>(com));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
예제 #2
0
        public bool usuarioHabilitado(string usuario)
        {
            string     query   = "SELECT [TheBigBangQuery].[UsuarioHabilitado](@usuario)";
            SqlCommand command = new SqlCommand(query);

            command.Parameters.AddWithValue("@usuario", usuario);
            int habilitado = DatabaseConection.executeParamFunction <int>(command);

            return(habilitado == 1);
        }
예제 #3
0
        public bool usuarioValido(string usuario)
        {
            string     query   = "SELECT TheBigBangQuery.ExisteUsuario(@usuario)";
            SqlCommand command = new SqlCommand(query);

            command.Parameters.AddWithValue("@usuario", usuario);
            int existe = DatabaseConection.executeParamFunction <int>(command);

            return(existe == 1);
        }
예제 #4
0
        public int getUltimaPaginaFacturasPorEmpresa(int emprId)
        {
            string query = "SELECT [TheBigBangQuery].[getLastPaginaFacturasPorEmpresa](@idEmpresa)";

            try
            {
                SqlCommand command = new SqlCommand(query);
                command.Parameters.AddWithValue("@idEmpresa", emprId);
                return(DatabaseConection.executeParamFunction <int>(command));
            }
            catch (Exception ex) {
                throw new DataNotFoundException("No se ha podido cargar la ultima pagina de facturas");
            }
        }
예제 #5
0
        public int getUltimaPaginaDesc(string desc)
        {
            string query = "SELECT [TheBigBangQuery].[getUltimaLineaFiltroDesc](@desc, @fechaActual)";

            try
            {
                SqlCommand com = new SqlCommand(query);
                com.Parameters.AddWithValue("@desc", desc);
                com.Parameters.AddWithValue("@fechaActual", Generals.getFecha());
                return(DatabaseConection.executeParamFunction <int>(com));
            }
            catch (Exception e) {
                throw e;
            }
        }
        public decimal gerIdUbiPubi(int ubiId, int publiId)
        {
            string function = "SELECT [TheBigBangQuery].[getIdPubluUbi]('" + ubiId + "', '" + publiId + "')";

            try
            {
                SqlCommand command = new SqlCommand(function);
                command.CommandText = function;

                return(DatabaseConection.executeParamFunction <decimal>(command));
            }
            catch (Exception e) {
                throw new DataNotFoundException("No se ha encontrado una ubicacion para esta publicacion");
            }
        }
예제 #7
0
        public int getUltimaPaginaFecha(DateTime fechaI, DateTime fechaF)
        {
            string query = "SELECT [TheBigBangQuery].[getUltimaPagFiltroFecha](@fechaI, @fechaF)";

            try
            {
                SqlCommand com = new SqlCommand(query);

                com.Parameters.AddWithValue("@fechaI", fechaI);
                com.Parameters.AddWithValue("@fechaF", fechaF);

                return(DatabaseConection.executeParamFunction <int>(com));
            }
            catch (Exception e) {
                throw e;
            }
        }
예제 #8
0
        public int getLastPaginaComprasCliente(int clieId)
        {
            string function = "SELECT [TheBigBangQuery].[getLastPaginaCompras](@clieId)";

            try
            {
                SqlCommand command = new SqlCommand(function);
                command.CommandText = function;

                command.Parameters.AddWithValue("clieId", clieId);

                return(DatabaseConection.executeParamFunction <int>(command));
            }
            catch (Exception e) {
                throw new DataNotFoundException("No se ha podido encontrar la ultima pagina de compras");
            }
        }
예제 #9
0
        public int getUlitimaPaginaNoFiltro(Nullable <int> empresaId = null)
        {
            string function = "SELECT [TheBigBangQuery].[getLastPaginaPublicacionesSinFiltro](@empresa,@fechaActual)";

            try
            {
                SqlCommand command = new SqlCommand(function);
                if (empresaId == null)
                {
                    command.Parameters.AddWithValue("@empresa", DBNull.Value);
                }
                else
                {
                    command.Parameters.AddWithValue("@empresa", (int)empresaId);
                }
                command.Parameters.AddWithValue("@fechaActual", Generals.getFecha());
                return(DatabaseConection.executeParamFunction <int>(command));
            }
            catch (Exception e)
            {
                throw e;
            }
        }