Exemplo n.º 1
0
        public static String InsertSoci(Boolean activo, Boolean administrador, String Correu, String Nom, String Cognoms, String Telefon, String DNI, Comunitat comunidad)
        {
            String mensaje     = "";
            String contrasenya = "1234";

            //Hash hash = new Hash();
            //SHA512.Create(contrasenya);
            //hash.Sha512(contrasenya);


            Socis soci = new Socis();

            soci.actiu               = activo;
            soci.administrador       = administrador;
            soci.mail                = Correu;
            soci.nom                 = Nom;
            soci.cognoms             = Cognoms;
            soci.contrasenya         = null;
            soci.telefon             = Telefon;
            soci.DNI                 = DNI;
            soci.id_comunidad_socio  = comunidad.id;
            soci.contrasena_cambiada = false;
            soci.contrasenya         = "chrisallys";


            if (administrador != true)
            {
                soci.id_comunitat_admin = null;
            }
            else
            {
                soci.id_comunitat_admin = comunidad.id;
                soci.contrasenya        = "1234";
            }



            ORM.bd.Socis.Add(soci);



            try
            {
                ORM.bd.SaveChanges();
            }
            catch (DbUpdateException ex)
            {
                ORM.RejectChanges();
                SqlException sqlEx = (SqlException)ex.InnerException.InnerException;
                mensaje = ORM.mensaje(sqlEx);
            }

            return(mensaje);
        }
Exemplo n.º 2
0
        public static String UpdateSocio(Socis socioM)
        {
            String mensaje = "";

            try
            {
                ORM.bd.SaveChanges();
            }
            catch (DbUpdateException ex)
            {
                ORM.RejectChanges();
                SqlException sqlEx = (SqlException)ex.InnerException.InnerException;
                mensaje = ORM.mensaje(sqlEx);
            }
            return(mensaje);
        }
Exemplo n.º 3
0
        public static String DeleteEvento(Esdeveniment esdevenimentEliminar)
        {
            String mensaje = "";

            ORM.bd.Esdeveniment.Remove(esdevenimentEliminar);
            try
            {
                ORM.bd.SaveChanges();
            }
            catch (DbUpdateException ex)
            {
                ORM.RejectChanges();
                SqlException sqlEx = (SqlException)ex.InnerException.InnerException;
                mensaje = ORM.mensaje(sqlEx);
            }
            return(mensaje);
        }
Exemplo n.º 4
0
        public static String InsertEvento(DateTime dataInici, DateTime horaInici, int idComunitat, DateTime fechaFin, DateTime horaFinal, String Direccion, String NombreEvento, byte[] imagen, String descripcio)
        {
            String mensaje = "";

            Esdeveniment esdeveniment = new Esdeveniment();

            esdeveniment.fechaInicio  = dataInici;
            esdeveniment.horaInicio   = horaInici.TimeOfDay;
            esdeveniment.id_Comunitat = idComunitat;
            esdeveniment.fechaFin     = fechaFin;
            esdeveniment.horaFin      = horaFinal.TimeOfDay;
            esdeveniment.NombreEvento = NombreEvento;
            esdeveniment.Direccio     = Direccion;
            esdeveniment.imagen       = imagen;
            esdeveniment.descripcion  = descripcio;
            esdeveniment.cuants       = 0;
            esdeveniment.Assistir     = null;


            ORM.bd.Esdeveniment.Add(esdeveniment);

            try
            {
                ORM.bd.SaveChanges();
            }
            catch (DbUpdateException ex)
            {
                ORM.RejectChanges();
                SqlException sqlEx = (SqlException)ex.InnerException.InnerException;
                mensaje = ORM.mensaje(sqlEx);
            }



            return(mensaje);
        }