示例#1
0
 public AuthorForm(ClientController ctr, Author au)
 {
     InitializeComponent();
     ctrl   = ctr;
     author = au;
     setDataGrid();
     currentAuthorForm = this;
 }
示例#2
0
        private void login_button_Click(object sender, EventArgs e)
        {
            String username = username_textBox.Text;
            String password = password_textBox.Text;

            try
            {
                User user = ctrl.validateAccount(username, password);
                ctrl.login(username);
                if (user is Author)
                {
                    AuthorForm authorForm = new AuthorForm(ctrl, (Author)user);
                    authorForm.parentForm = this;
                    this.Owner            = authorForm;
                    this.Hide();

                    authorForm.Show();
                }

                if (user is Participant)
                {
                    ParticipantForm participantForm = new ParticipantForm(ctrl, (Participant)user);
                    participantForm.parentLoginForm = this;
                    this.Owner = participantForm;
                    this.Hide();

                    participantForm.Show();
                }

                if (user is PCMember)
                {
                    PCMemberForm pcMemberForm = new PCMemberForm(ctrl, (PCMember)user);
                    pcMemberForm.parentForm = this;
                    this.Owner = pcMemberForm;
                    this.Hide();

                    pcMemberForm.Show();
                }

                if (user is Reviewer)
                {
                    ReviewerForm reviewerForm = new ReviewerForm(ctrl, (Reviewer)user);
                    reviewerForm.parentForm = this;
                    this.Owner = reviewerForm;
                    this.Hide();

                    reviewerForm.Show();
                }

                if (user == null)
                {
                    MessageBox.Show("Username or password are invalid");
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }