Example #1
0
        public bool CheckAll()
        {
            if (cmbMovieNumber.SelectedIndex == -1)
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblMovieNumber.Text), "Invalid " + lblMovieNumber.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                cmbMovieNumber.Focus();
                return(false);
            }

            if (cmbMemberNumber.SelectedIndex == -1)
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblMemberNumber.Text), "Invalid " + lblMemberNumber.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                cmbMemberNumber.Focus();
                return(false);
            }

            if (dtpMediaCheckoutDate.Value > DateTime.MaxValue)     //
            {
                MessageBox.Show(lblMediaCheckoutDate.Text + " must be less than or equal to " + DateTime.MaxValue + ".", "Invalid " + lblMediaCheckoutDate.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpMediaCheckoutDate.Focus();
                return(false);
            }
            else if (dtpMediaCheckoutDate.Value <= new DateTime(1753, 1, 1, 0, 0, 0))//
            {
                MessageBox.Show(lblMediaCheckoutDate.Text + " must be greater than " + new DateTime(1753, 1, 1, 0, 0, 0) + ".", "Invalid " + lblMediaCheckoutDate.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpMediaCheckoutDate.Focus();
                return(false);
            }
            return(true);
        }
Example #2
0
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            if (txtLoginName.Text.Trim() != string.Empty)
            {
                if (txtLoginName.Text.Trim().Length > Member.login_nameLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblLoginName.Text, Member.login_nameLength), "Invalid " + lblLoginName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtLoginName.Focus();
                    return;
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblLoginName.Text), "Invalid " + lblLoginName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLoginName.Focus();
                return;
            }

            if (txtPassword.Text.Trim() != string.Empty)
            {
                if (txtPassword.Text.Trim().Length > Member.passwordLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblPassword.Text, Member.passwordLength), "Invalid " + lblPassword.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtPassword.Focus();
                    return;
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblPassword.Text), "Invalid " + lblPassword.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPassword.Focus();
                return;
            }

            Login objMember = new Login();

            try
            {
                objMember.Credentials = txtLoginName.Text;
                objMember.Password    = txtPassword.Text;
                bool status = objMember.IsValid();
                if (status)
                {
                    MessageBox.Show("Welcome " + txtLoginName.Text, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show(MsgBoxHelper.Selected("Member " + lblLoginName.Text + " " + txtLoginName.Text), "Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
 public bool CheckAll()
 {
     if (txtName.Text.Trim() != string.Empty)
     {
         if (txtName.Text.Trim().Length > Genre.nameLength)
         {
             MessageBox.Show(MsgBoxHelper.LTETmax(lblName.Text, Genre.nameLength), "Invalid " + lblName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtName.Focus();
             return(false);
         }
     }
     else
     {
         MessageBox.Show(MsgBoxHelper.NotBlank(lblName.Text), "Invalid " + lblName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtName.Focus();
         return(false);
     }
     return(true);
 }
Example #4
0
        public bool CheckAll()
        {
            if (dtpJoinDate.Value > DateTime.MaxValue)     //
            {
                MessageBox.Show(lblJoinDate.Text + " must be less than or equal to " + DateTime.MaxValue + ".", "Invalid " + lblJoinDate.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpJoinDate.Focus();
                return(false);
            }
            else if (dtpJoinDate.Value <= new DateTime(1753, 1, 1, 0, 0, 0))//
            {
                MessageBox.Show(lblJoinDate.Text + " must be greater than " + new DateTime(1753, 1, 1, 0, 0, 0) + ".", "Invalid " + lblJoinDate.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpJoinDate.Focus();
                return(false);
            }

            if (txtFirstName.Text.Trim() != string.Empty)
            {
                if (txtFirstName.Text.Trim().Length > Member.firstnameLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblFirstName.Text, Member.firstnameLength), "Invalid " + lblFirstName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtFirstName.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblFirstName.Text), "Invalid " + lblFirstName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtFirstName.Focus();
                return(false);
            }

            if (txtLastName.Text.Trim() != string.Empty)
            {
                if (txtLastName.Text.Trim().Length > Member.lastnameLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblLastName.Text, Member.lastnameLength), "Invalid " + lblLastName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtLastName.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblLastName.Text), "Invalid " + lblLastName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLastName.Focus();
                return(false);
            }

            if (txtAddress.Text.Trim() != string.Empty)
            {
                if (txtAddress.Text.Trim().Length > Member.addressLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblAddress.Text, Member.addressLength), "Invalid " + lblAddress.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtAddress.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblAddress.Text), "Invalid " + lblAddress.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAddress.Focus();
                return(false);
            }

            if (txtCity.Text.Trim() != string.Empty)
            {
                if (txtCity.Text.Trim().Length > Member.cityLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblCity.Text, Member.cityLength), "Invalid " + lblCity.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCity.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblCity.Text), "Invalid " + lblCity.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCity.Focus();
                return(false);
            }

            if (txtState.Text.Trim() != string.Empty)
            {
                if (txtState.Text.Trim().Length > Member.stateLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblState.Text, Member.stateLength), "Invalid " + lblState.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtState.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblState.Text), "Invalid " + lblState.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtState.Focus();
                return(false);
            }

            if (txtZipCode.Text.Trim() != string.Empty)
            {
                if (txtZipCode.Text.Trim().Length > Member.zipcodeLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblZipCode.Text, Member.zipcodeLength), "Invalid " + lblZipCode.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtZipCode.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblZipCode.Text), "Invalid " + lblZipCode.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtZipCode.Focus();
                return(false);
            }

            if (txtPhone.Text.Trim() != string.Empty)
            {
                if (txtPhone.Text.Trim().Length > Member.phoneLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblPhone.Text, Member.phoneLength), "Invalid " + lblPhone.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtPhone.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblPhone.Text), "Invalid " + lblPhone.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPhone.Focus();
                return(false);
            }

            if (!rdoActive.Checked && !rdoInactive.Checked)
            {
                MessageBox.Show(grpMemberStatus.Text + " must be " + rdoActive.Text + " or " + rdoInactive.Text + ".",
                                "Invalid " + grpMemberStatus.Text,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error
                                );
                return(false);
            }

            if (txtLoginName.Text.Trim() != string.Empty)
            {
                if (txtLoginName.Text.Trim().Length > Member.login_nameLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblLoginName.Text, Member.login_nameLength), "Invalid " + lblLoginName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtLoginName.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblLoginName.Text), "Invalid " + lblLoginName.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLoginName.Focus();
                return(false);
            }

            if (txtPassword.Text.Trim() != string.Empty)
            {
                if (txtPassword.Text.Trim().Length > Member.passwordLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblPassword.Text, Member.passwordLength), "Invalid " + lblPassword.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtPassword.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblPassword.Text), "Invalid " + lblPassword.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPassword.Focus();
                return(false);
            }

            if (txtEmail.Text.Trim() != string.Empty)
            {
                if (txtEmail.Text.Trim().Length > Member.emailLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblEmail.Text, Member.emailLength), "Invalid " + lblEmail.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtEmail.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblEmail.Text), "Invalid " + lblEmail.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmail.Focus();
                return(false);
            }

            if (cmbSubscriptionID.SelectedIndex == -1)
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblSubscriptionID.Text), "Invalid " + lblSubscriptionID.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                cmbSubscriptionID.Focus();
                return(false);
            }

            if (!rdoEmail.Checked && !rdoFacebook.Checked && !rdoPhoneText.Checked && !rdoTwitter.Checked)
            {
                MessageBox.Show(grpContactMethod.Text + " must be " + rdoEmail.Text + " or " + rdoFacebook.Text + " or " + rdoPhoneText.Text + " or " + rdoTwitter.Text + ".",
                                "Invalid " + grpContactMethod.Text,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error
                                );
                return(false);
            }

            return(true);
        }
Example #5
0
        public bool CheckAll()
        {
            if (txtMovieTitle.Text.Trim() != string.Empty)
            {
                if (txtMovieTitle.Text.Trim().Length > Movie.movie_titleLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblMovieTitle.Text, Movie.movie_titleLength), "Invalid " + lblMovieTitle.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtMovieTitle.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblMovieTitle.Text), "Invalid " + lblMovieTitle.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMovieTitle.Focus();
                return(false);
            }

            if (txtDescription.Text.Trim() != string.Empty)
            {
                if (txtDescription.Text.Trim().Length > Movie.DescriptionLength)
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblDescription.Text, Movie.DescriptionLength), "Invalid " + lblDescription.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtDescription.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblDescription.Text), "Invalid " + lblDescription.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtDescription.Focus();
                return(false);
            }

            int movie_year_made;

            if (Int32.TryParse(txtMovieYearMade.Text.Trim(), out movie_year_made))
            {
                if (movie_year_made > short.MaxValue)     // 32767
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblMovieYearMade.Text), "Invalid " + lblMovieYearMade.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtMovieYearMade.Focus();
                    return(false);
                }
                else if (movie_year_made < short.MinValue)//-32768
                {
                    MessageBox.Show(MsgBoxHelper.GTETmin(lblMovieYearMade.Text), "Invalid " + lblMovieYearMade.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtMovieYearMade.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(MsgBoxHelper.MustBe(lblMovieYearMade.Text), "Invalid " + lblMovieYearMade.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMovieYearMade.Focus();
                return(false);
            }

            if (cmbGenreID.SelectedIndex == -1)
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblGenreID.Text), "Invalid " + lblGenreID.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                cmbGenreID.Focus();
                return(false);
            }

            if (cmbMovieRating.SelectedIndex == -1)
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblMovieRating.Text), "Invalid " + lblMovieRating.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                cmbMovieRating.Focus();
                return(false);
            }

            if (cmbMediaType.SelectedIndex == -1)
            {
                MessageBox.Show(MsgBoxHelper.NotBlank(lblMediaType.Text), "Invalid " + lblMediaType.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                cmbMediaType.Focus();
                return(false);
            }

            float movie_retail_cost;

            if (float.TryParse(txtMovieRetailCost.Text.Trim(), out movie_retail_cost))
            {
                if (movie_retail_cost > float.MaxValue)     //3.40282347E+38
                {
                    MessageBox.Show(lblMovieRetailCost.Text + " must be less than or equal to " + float.MaxValue + ".", "Invalid " + lblMovieRetailCost.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtMovieRetailCost.Focus();
                    return(false);
                }
                else if (movie_retail_cost < 0)
                {
                    MessageBox.Show(lblMovieRetailCost.Text + " must be greater than or equal to 0.00.", "Invalid " + lblMovieRetailCost.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtMovieRetailCost.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(lblMovieRetailCost.Text + " must be a monetary value (0.00 - " + float.MaxValue + ").", "Invalid " + lblMovieRetailCost.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMovieRetailCost.Focus();
                return(false);
            }

            int copies_on_hand;

            if (Int32.TryParse(txtCopiesOnHand.Text.Trim(), out copies_on_hand))
            {
                if (copies_on_hand > short.MaxValue)     // 32767
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblCopiesOnHand.Text), "Invalid " + lblCopiesOnHand.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCopiesOnHand.Focus();
                    return(false);
                }
                else if (copies_on_hand < short.MinValue)//-32768
                {
                    MessageBox.Show(MsgBoxHelper.GTETmin(lblCopiesOnHand.Text), "Invalid " + lblCopiesOnHand.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCopiesOnHand.Focus();
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(lblCopiesOnHand.Text + " must be an integer (0 - " + short.MaxValue + ").", "Invalid " + lblCopiesOnHand.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCopiesOnHand.Focus();
                return(false);
            }

            if (txtImage.Text.Trim().Length > Movie.imageLength)
            {
                MessageBox.Show(MsgBoxHelper.LTETmax(lblImage.Text, Movie.imageLength), "Invalid " + lblImage.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtImage.Focus();
                return(false);
            }

            if (txtTrailer.Text.Trim().Length > Movie.trailerLength)
            {
                MessageBox.Show(MsgBoxHelper.LTETmax(lblTrailer.Text, Movie.trailerLength), "Invalid " + lblTrailer.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtTrailer.Focus();
                return(false);
            }

            return(true);
        }