示例#1
0
        public bool agregarIntegrante(Integrante inte)
        {
            bool retorno         = false;
            int  cantIntegrantes = this.Integrantes.Count;

            this.Integrantes.Add(inte);

            if (Integrantes.Count > cantIntegrantes)
            {
                retorno = true;
            }

            return(retorno);
        }
示例#2
0
        public bool altaIntegrante(int idEmp, string email, string contrasena, string nombre, string cedula, string rol)
        {
            SqlConnection con = CrearConexion();
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection = con;
            bool       ok = false;
            Integrante i  = new Integrante();


            i.Email      = email;
            i.Contrasena = contrasena;
            i.Nombre     = nombre;
            i.Cedula     = cedula;
            i.Rol        = rol;

            if (this.Email == "" || this.Contrasena.Length < 8 || this.Nombre == "" || this.Cedula == "" ||
                this.Rol == "" || Usuario.buscarPorEmail(this.Email) != null)
            {
                return(false);
            }

            try
            {
                AbrirConexion(con);


                cmd.CommandText = "Integrante_Insert";
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter par = new SqlParameter();
                par.ParameterName = "@Error";
                par.SqlDbType     = SqlDbType.Int;
                par.Direction     = ParameterDirection.Output;
                cmd.Parameters.Add(par);

                SqlParameter par2 = new SqlParameter();
                par2.ParameterName = "@IdIntegrante";
                par2.SqlDbType     = SqlDbType.Int;
                par2.Direction     = ParameterDirection.Output;
                cmd.Parameters.Add(par2);

                SqlParameter par3 = new SqlParameter();
                par3.ParameterName = "@IdUsuario";
                par3.SqlDbType     = SqlDbType.Int;
                par3.Direction     = ParameterDirection.Output;
                cmd.Parameters.Add(par3);

                cmd.Parameters.Add(new SqlParameter("@Email", Email));
                cmd.Parameters.Add(new SqlParameter("@Contrasena", Contrasena));
                cmd.Parameters.Add(new SqlParameter("@Rol", Rol));

                cmd.Parameters.Add(new SqlParameter("@Cedula", Cedula));
                cmd.Parameters.Add(new SqlParameter("@Nombre", Nombre));
                cmd.Parameters.Add(new SqlParameter("@Emprendimiento", idEmp));
                cmd.ExecuteNonQuery();

                IdIntengrante = (int)par2.Value;
                IdUsuario     = (int)par3.Value;

                ok = (int)par.Value == 0;
            }
            catch (SqlException ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);
            }
            finally
            {
                CerrarConexion(con);
            }
            return(ok);
        }