Ejemplo n.º 1
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            string        name         = txtTeamName.Text;
            string        description  = txtDescription.Text;
            int           maxUsers     = (int)nudMaxUsers.Value;
            User          user         = instance.Session.user;
            Administrator adminCreator = (Administrator)user;
            DateTime      birthdate    = DateTime.Now;

            try
            {
                Team teamToAdd = new Team();
                teamToAdd.name         = name;
                teamToAdd.description  = description;
                teamToAdd.maxUsers     = maxUsers;
                teamToAdd.creator      = adminCreator;
                teamToAdd.creationDate = birthdate;
                teamToAdd.usersInTeam  = usersForTeam;
                instance.TeamHandler.AddTeam(teamToAdd);
                AdministratorUI administratorUI = new AdministratorUI();
                administratorUI.Show();
                Hide();
            }
            catch (TeamException ex)
            {
                String msgError = ex.Message;
                MessageBox.Show(msgError, "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 2
0
        private void BtnBack_Click(object sender, EventArgs e)
        {
            AdministratorUI administratorUI = new AdministratorUI();

            administratorUI.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            AdministratorUI administratorUI = new AdministratorUI();

            administratorUI.Show();
            Hide();
        }
Ejemplo n.º 4
0
        private void BtnLogIn_Click(object sender, EventArgs e)
        {
            string email    = this.TxtEmail.Text;
            string password = this.TxtPassword.Text;

            try
            {
                if (RdoColaborator.Checked)
                {
                    instance.Session = instance.SessionHandler.LogInColaborator(email, password);
                    ColaboratorUI colaboratorUI = new ColaboratorUI();
                    colaboratorUI.Show();
                    this.Hide();
                }
                else if (RdoAdmin.Checked)
                {
                    instance.Session = instance.SessionHandler.LogInAdministrator(email, password);
                    AdministratorUI administratorUI = new AdministratorUI();
                    administratorUI.Show();
                    this.Hide();
                }
            }
            catch (UserException ex)
            {
                String msgError = ex.Message;
                MessageBox.Show(msgError, "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 5
0
        private void BtnCancel_Click(object sender, EventArgs e)
        {
            Type typeOfUser = instance.Session.user.GetType();

            if (typeOfUser.Equals(typeof(Administrator)))
            {
                AdministratorUI administratorUI = new AdministratorUI();
                administratorUI.Show();
                this.Hide();
            }
            else
            {
                ColaboratorUI colaboratorUI = new ColaboratorUI();
                colaboratorUI.Show();
                this.Hide();
            }
        }
Ejemplo n.º 6
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            string newDescription = TxtDescription.Text;
            int    newMaxUsers    = (int)NudMaxUsers.Value;

            try
            {
                instance.TeamHandler.ModifyTeamDescription(teamToModify.name, newDescription);
                instance.TeamHandler.ModifyTeamMaxUsers(teamToModify.name, newMaxUsers);
                instance.TeamHandler.ModifyTeamUsers(teamToModify, usersInTeam);
                AdministratorUI administratorUI = new AdministratorUI();
                MessageBox.Show("Equipo modificado correctamente.", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                administratorUI.Show();
                Hide();
            }
            catch (Exception ex)
            {
                String msgError = ex.Message;
                MessageBox.Show(msgError, "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 7
0
        private void BtnRegister_Click(object sender, EventArgs e)
        {
            string   name      = TxtName.Text;
            string   surname   = TxtSurname.Text;
            string   mail      = TxtEmail.Text;
            string   password  = TxtPassword.Text;
            DateTime birthdate = DTBirthdate.Value;

            try
            {
                if (RdoAdmin.Checked)
                {
                    Administrator adminToAdd = new Administrator();
                    adminToAdd.name     = name;
                    adminToAdd.surname  = surname;
                    adminToAdd.mail     = mail;
                    adminToAdd.password = password;
                    adminToAdd.birthday = birthdate;
                    instance.AdministratorHandler.AddAdministrator(adminToAdd);
                }
                else if (RdoColaborator.Checked)
                {
                    Colaborator colabToAdd = new Colaborator();
                    colabToAdd.name     = name;
                    colabToAdd.surname  = surname;
                    colabToAdd.mail     = mail;
                    colabToAdd.password = password;
                    colabToAdd.birthday = birthdate;
                    instance.ColaboratorHandler.AddColaborator(colabToAdd);
                }
                AdministratorUI administratorUI = new AdministratorUI();
                this.Hide();
                administratorUI.Show();
            }
            catch (UserException ex)
            {
                String msgError = ex.Message;
                MessageBox.Show(msgError, "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }