예제 #1
0
        public static Cliente UpdateClient(Cliente client)
        {
            var param = new List <SPParameter>
            {
                new SPParameter("ID_Usuario", client.IdUsuario),
                new SPParameter("Nombre", client.Nombre),
                new SPParameter("Apellido", client.Apellido),
                new SPParameter("ID_Tipo_Documento", client.TipoDocumento),
                new SPParameter("Nro_Documento", client.NroDocumento),
                new SPParameter("Mail", client.Mail),
                new SPParameter("Telefono", client.Telefono),
                new SPParameter("Direccion", client.Direccion),
                new SPParameter("Codigo_Postal", client.CodigoPostal),
                new SPParameter("Fecha_Nacimiento", client.FechaNacimiento),
                new SPParameter("CUIL", client.CUIL)
            };

            var sp = new StoreProcedure(DataBaseConst.Cliente.SPUpdateClient, param);

            client.ID = (int)sp.ExecuteNonQuery(null);

            return(client);
        }
예제 #2
0
        public static Dictionary <int, int> GetAllByUser(Usuario usuario, SqlTransaction transaction)
        {
            var dictionary = new Dictionary <int, int>();
            var param      = new List <SPParameter>
            {
                new SPParameter("ID_Usuario", usuario.ID)
            };

            var sp     = new StoreProcedure(DataBaseConst.Visibilidad.SPGetVisibilidadPurchasesByUser, param, transaction);
            var reader = sp.ExecuteReader(transaction);

            while (reader.Read())
            {
                dictionary.Add(Convert.ToInt32(reader[0]), Convert.ToInt32(reader[1]));
            }

            if (!reader.IsClosed)
            {
                reader.Close();
            }

            return(dictionary);
        }
예제 #3
0
        private static bool ExisteVisibilidadRendidaPorUsuario(KeyValuePair <int, int> visibilidadUsuario, int idUsuario, SqlTransaction transaction)
        {
            var existe = false;
            var param  = new List <SPParameter>
            {
                new SPParameter("ID_Usuario", idUsuario),
                new SPParameter("ID_Visibilidad", visibilidadUsuario.Key)
            };

            var sp     = new StoreProcedure(DataBaseConst.Visibilidad.SPGetVisibilidadPurchasesByUserAndID, param, transaction);
            var reader = sp.ExecuteReader(transaction);

            while (reader.Read())
            {
                existe = true;
            }

            if (!reader.IsClosed)
            {
                reader.Close();
            }

            return(existe);
        }
        public static object GetByUserId(Usuario usuario)
        {
            var param = new List <SPParameter>
            {
                new SPParameter("ID_Usuario", usuario.ID)
            };

            var sp = new StoreProcedure(DataBaseConst.Calificacion.SPGetCalificationByUserId, param);

            Double calification = 0.0;
            var    reader       = sp.ExecuteReader(null);

            while (reader.Read())
            {
                calification = Convert.ToDouble(reader[0]);
            }

            if (!reader.IsClosed)
            {
                reader.Close();
            }

            return(calification);
        }
예제 #5
0
        public static List <Publicacion> GetAllActive()
        {
            //Obtengo la publicacion que se encuentren activas
            var param = new List <SPParameter>
            {
                new SPParameter("Fecha_hoy", Configuration.ConfigurationVariables.FechaSistema)
            };

            var sp = new StoreProcedure(DataBaseConst.Publicacion.SPGetAllActive, param);

            var publications = sp.ExecuteReader <Publicacion>();

            if (publications == null || publications.Count == 0)
            {
                return(null);
            }

            foreach (var pub in publications)
            {
                pub.GetObjectsById();
            }

            return(publications);
        }
예제 #6
0
        public static List <Publicacion> GetFinishedAuctions()
        {
            //Obtengo la lista de publicaciones que ya hayan vencido para pasarlas a compras
            var param = new List <SPParameter>
            {
                new SPParameter("Fecha_Hoy", ConfigurationVariables.FechaSistema)
            };

            var sp = new StoreProcedure(DataBaseConst.Publicacion.SPGetFinishedAuctions, param);

            var publications = sp.ExecuteReader <Publicacion>();

            if (publications == null || publications.Count == 0)
            {
                return(new List <Publicacion>());
            }

            foreach (var pub in publications)
            {
                pub.GetObjectsById();
            }

            return(publications);
        }
예제 #7
0
        public static int GetAllActiveAndFreeByUser(int userId)
        {
            var param = new List <SPParameter>
            {
                new SPParameter("ID_Usuario", userId)
            };

            var quantity = 0;
            var sp       = new StoreProcedure(DataBaseConst.Publicacion.SPGetAllActiveAndFreeByUserId, param);

            var reader = sp.ExecuteReader(null);

            while (reader.Read())
            {
                quantity = Convert.ToInt32(reader[0]);
            }

            if (!reader.IsClosed)
            {
                reader.Close();
            }

            return(quantity);
        }
예제 #8
0
        public static List <TipoDocumento> GetAll()
        {
            var sp = new StoreProcedure(DataBaseConst.TipoDocumento.SPGetAllTipoDocumento);

            return(sp.ExecuteReader <TipoDocumento>());
        }
예제 #9
0
        public static List <Cliente> GetAllClients()
        {
            var sp = new StoreProcedure(DataBaseConst.Cliente.SPGetAllClients);

            return(sp.ExecuteReader <Cliente>());
        }
예제 #10
0
        public static List <Rubro> GetAll()
        {
            var sp = new StoreProcedure(DataBaseConst.Rubro.SPGetAllRubro);

            return(sp.ExecuteReader <Rubro>());
        }
        public List <Especialidad> GetAll()
        {
            StoreProcedure sp = new StoreProcedure(DataBaseConst.Especialidad.SP_GetAllEspecialidad);

            return(sp.ExecuteReader <Especialidad>());
        }
예제 #12
0
        public static List <Empresa> GetAllBusiness()
        {
            var sp = new StoreProcedure(DataBaseConst.Empresa.SPGetAllBusiness);

            return(sp.ExecuteReader <Empresa>());
        }
예제 #13
0
        public List <PlanMedico> GetAll()
        {
            StoreProcedure sp = new StoreProcedure(DataBaseConst.PlanMedico.SP_GetAllPlanMedico);

            return(sp.ExecuteReader <PlanMedico>());
        }
        public List <EstadoCivil> GetAll()
        {
            StoreProcedure sp = new StoreProcedure(DataBaseConst.EstadoCivil.SP_GetAllEstadoCivil);

            return(sp.ExecuteReader <EstadoCivil>());
        }
예제 #15
0
        public static List <TipoDocumento> GetAll(SqlTransaction transaction)
        {
            var sp = new StoreProcedure(DataBaseConst.TipoDocumento.SPGetAllTipoDocumento, null, transaction);

            return(sp.ExecuteReaderTransactioned <TipoDocumento>(transaction));
        }
예제 #16
0
        public List <Rol> GetAll()
        {
            StoreProcedure sp = new StoreProcedure(DataBaseConst.Rol.SP_GetAllRol);

            return(sp.ExecuteReader <Rol>());
        }
예제 #17
0
        public static List <FormaPago> GetAll()
        {
            var sp = new StoreProcedure(DataBaseConst.FormaPago.SPGetAllFormaPago);

            return(sp.ExecuteReader <FormaPago>());
        }
예제 #18
0
        public List <Funcionalidad> GetAll()
        {
            StoreProcedure sp = new StoreProcedure(DataBaseConst.Funcionalidad.SP_GetAllFuncionalidad);

            return(sp.ExecuteReader <Funcionalidad>());
        }