Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            int movie_number;

            if (!Int32.TryParse(txtMovieNumber.Text.Trim(), out movie_number))
            {
                MessageBox.Show(MsgBoxHelper.MustBe(lblMovieNumber.Text), "Invalid " + lblMovieNumber.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMovieNumber.Focus();
            }
            else
            {
                if (movie_number > short.MaxValue)     // 32767
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblMovieNumber.Text), "Invalid " + lblMovieNumber.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtMovieNumber.Focus();
                }
                else if (movie_number < short.MinValue)//-32768
                {
                    MessageBox.Show(MsgBoxHelper.GTETmin(lblMovieNumber.Text), "Invalid " + lblMovieNumber.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtMovieNumber.Focus();
                }
                else
                {
                    Movie objMovie;

                    try
                    {
                        objMovie = Movies.GetMovie(movie_number);
                        if (objMovie == null)
                        {
                            MessageBox.Show(MsgBoxHelper.Selected("Movie " + lblMovieNumber.Text + " " + movie_number), "Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            txtMovieTitle.Text       = objMovie.movie_title;
                            txtDescription.Text      = objMovie.Description;
                            txtMovieYearMade.Text    = objMovie.movie_year_made.ToString();
                            cmbGenreID.SelectedValue = objMovie.genre_id;
                            cmbMovieRating.Text      = objMovie.movie_rating.Trim();
                            cmbMediaType.Text        = objMovie.media_type;
                            txtMovieRetailCost.Text  = objMovie.movie_retail_cost.ToString();
                            txtCopiesOnHand.Text     = objMovie.copies_on_hand.ToString();
                            txtImage.Text            = objMovie.image;
                            picImage.ImageLocation   = objMovie.image;
                            txtTrailer.Text          = objMovie.trailer;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            int id;

            if (!Int32.TryParse(txtID.Text.Trim(), out id))
            {
                MessageBox.Show(MsgBoxHelper.MustBe(lblID.Text), "Invalid " + lblID.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtID.Focus();
            }
            else
            {
                if (id > short.MaxValue)     // 32767
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblID.Text), "Invalid " + lblID.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtID.Focus();
                }
                else if (id < short.MinValue)//-32768
                {
                    MessageBox.Show(MsgBoxHelper.GTETmin(lblID.Text), "Invalid " + lblID.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtID.Focus();
                }
                else
                {
                    Genre objGenre;

                    try
                    {
                        objGenre = Genres.GetGenre(id);
                        if (objGenre == null)
                        {
                            MessageBox.Show(MsgBoxHelper.Selected("Genre " + lblID.Text + " " + id), "Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            txtName.Text = objGenre.name;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private bool BadKey(Rental objRental, int first, int second)
 {
     if (objRental == null)
     {
         String tableName = "Rental ";
         if (first > -1)
         {
             tableName += lblMovieNumber.Text + " " + cmbMovieNumber.Text;
             if ((second > -1) || (dtpMediaCheckoutDate.Value > new DateTime(1753, 1, 1, 0, 0, 0)))
             {
                 tableName += ", ";
             }
         }
         if (second > -1)
         {
             tableName += lblMemberNumber.Text + " " + cmbMemberNumber.Text;
             if (dtpMediaCheckoutDate.Value > new DateTime(1753, 1, 1, 0, 0, 0))
             {
                 tableName += ", ";
             }
         }
         if (dtpMediaCheckoutDate.Value > new DateTime(1753, 1, 1, 0, 0, 0))
         {
             tableName += lblMediaCheckoutDate.Text + " " + dtpMediaCheckoutDate.Text;
         }
         MessageBox.Show(MsgBoxHelper.Selected(tableName), "Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);//TODO if not -1
         return(true);
     }
     else
     {
         cmbMovieNumber.SelectedValue  = objRental.movie_number;
         cmbMemberNumber.SelectedValue = objRental.member_number;
         dtpMediaCheckoutDate.Value    = objRental.media_checkout_date;
         return(false);
     }
 }
Ejemplo n.º 5
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            int number;

            if (!Int32.TryParse(txtNumber.Text.Trim(), out number))
            {
                MessageBox.Show(MsgBoxHelper.MustBe(lblNumber.Text), "Invalid " + lblNumber.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtNumber.Focus();
            }
            else
            {
                if (number > short.MaxValue)     // 32767
                {
                    MessageBox.Show(MsgBoxHelper.LTETmax(lblNumber.Text), "Invalid " + lblNumber.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtNumber.Focus();
                }
                else if (number < short.MinValue)//-32768
                {
                    MessageBox.Show(MsgBoxHelper.GTETmin(lblNumber.Text), "Invalid " + lblNumber.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtNumber.Focus();
                }
                else
                {
                    Member objMember;

                    try
                    {
                        objMember = Members.GetMember(number);
                        if (objMember == null)
                        {
                            MessageBox.Show(MsgBoxHelper.Selected("Member " + lblNumber.Text + " " + number), "Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            dtpJoinDate.Value = objMember.joindate;
                            txtFirstName.Text = objMember.firstname.Trim();
                            txtLastName.Text  = objMember.lastname.Trim();
                            txtAddress.Text   = objMember.address.Trim();
                            txtCity.Text      = objMember.city.Trim();
                            txtState.Text     = objMember.state;
                            txtZipCode.Text   = objMember.zipcode;
                            txtPhone.Text     = objMember.phone;
                            if (objMember.member_status == "A")
                            {
                                rdoActive.Checked = true;
                            }
                            else
                            {
                                rdoInactive.Checked = true;
                            }
                            txtLoginName.Text = objMember.login_name;
                            txtPassword.Text  = objMember.password;
                            txtEmail.Text     = objMember.email;

                            if (objMember.contact_method == 1)
                            {
                                rdoEmail.Checked = true;
                            }
                            else if (objMember.contact_method == 2)
                            {
                                rdoFacebook.Checked = true;
                            }
                            else if (objMember.contact_method == 3)
                            {
                                rdoPhoneText.Checked = true;
                            }
                            else if (objMember.contact_method == 4)
                            {
                                rdoTwitter.Checked = true;
                            }
                            else
                            {
                                objMember.contact_method = 0;
                            }

                            cmbSubscriptionID.SelectedValue = objMember.subscription_id;
                            imageLocation = objMember.photo;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }