コード例 #1
0
ファイル: StudentSurvey.cs プロジェクト: jsbell406/TrioForms
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool isContinue = true;

            if (isBusy)
            {
                return;
            }

            isBusy = true;

            // Student ID validation
            if (!StudentIdHandling())
            {
                isContinue = false;
            }

            // First Name Validation
            if (!FirstNameHandling())
            {
                isContinue = false;
            }

            // Last Name Validation
            if (!LastNameHandling())
            {
                isContinue = false;
            }

            // Email Validation
            if (!EmailHandling())
            {
                isContinue = false;
            }

            if (!isContinue)
            {
                isBusy = false;
                return;
            }

            Survey.Phone = txtPhone.Text.Trim();

            Survey.Tutoring = txtTutoring.Text.Trim();

            Survey.MentalHealth       = ckbMentalHealth.Checked;
            Survey.FinancialAid       = ckbFinancialAid.Checked;
            Survey.AcademicCoaching   = ckbAcademicCoaching.Checked;
            Survey.CareerPlanning     = ckbCareerExploration.Checked;
            Survey.DisabilityServices = ckbRegisterDisability.Checked;
            Survey.TrioClub           = ckbTrioClub.Checked;
            Survey.StudyAid           = ckbStudyAid.Checked;

            Survey.Other       = txbOther.Text.Trim();
            Survey.IsProcessed = false;

            Survey.SurveyId = 0;

            Survey = Controller.SaveSurvey(Survey);

            if (Survey.SurveyId > 0)
            {
                lblSaveSuccess.Visible = true;
                lblSaveSuccess.Text    = WarningMessages.CONFIRMATION_SAVE_SUCCESS;
            }
            else
            {
                lblSaveSuccess.Visible = true;
                lblSaveSuccess.Text    = WarningMessages.CONFIRMATION_SAVE_FAILURE;
            }

            ResetForm();

            isBusy = false;
        }