Esempio n. 1
0
        private void frmRental_Load(object sender, EventArgs e)
        {
            try
            {
                rentalList = Rentals.GetRentals();
                rentalDataGridView.DataSource = rentalList;

                List <Movie> movieList = Movies.GetMovies();
                cmbMovieNumber.DataSource    = movieList;
                cmbMovieNumber.DisplayMember = Movies.extra;
                cmbMovieNumber.ValueMember   = Movies.key;
                cmbMovieNumber.SelectedIndex = -1;

                List <Member> memberList = Members.GetMembers();
                cmbMemberNumber.DataSource    = memberList;
                cmbMemberNumber.DisplayMember = Members.extra3;
                cmbMemberNumber.ValueMember   = Members.key;
                cmbMemberNumber.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            ToolTip toolTip = new ToolTip();

            toolTip.SetToolTip(btnAdd, "Add Movie, Member, Checkout and Return");
            toolTip.SetToolTip(btnBrowse, "Browse by Movie, Member and Checkout");
            toolTip.SetToolTip(btnUpdate, "Update Movie, Member, Checkout and Return");
            toolTip.SetToolTip(btnDelete, "Delete Movie, Member and Checkout");
            toolTip.SetToolTip(btnClear, "Clear all Rental fields");

            toolTip.SetToolTip(cmbMovieNumber, Rental.movie_numberTip);
            toolTip.SetToolTip(lblMovieNumber, Rental.movie_numberTip);

            toolTip.SetToolTip(cmbMemberNumber, Rental.member_numberTip);
            toolTip.SetToolTip(lblMemberNumber, Rental.member_numberTip);

            toolTip.SetToolTip(dtpMediaCheckoutDate, Rental.media_checkout_dateTip);
            toolTip.SetToolTip(lblMediaCheckoutDate, Rental.media_checkout_dateTip);

            toolTip.SetToolTip(dtpMediaReturnDate, Rental.media_return_dateTip);
            toolTip.SetToolTip(lblMediaReturnDate, Rental.media_return_dateTip);

            rentalDataGridView.Width  = 43 + 3 * 100 + 17;
            rentalDataGridView.Height = 23 + 3 * 22 + 17;
        }
Esempio n. 2
0
        private void btnDelete_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 = new Member();
                    objMember.number = number;
                    try
                    {
                        bool status = Members.DeleteMember(objMember);
                        if (status)
                        {
                            MessageBox.Show(MsgBoxHelper.Deleted("Member"), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            memberList = Members.GetMembers();
                            memberDataGridView.DataSource = memberList;
                        }
                        else
                        {
                            MessageBox.Show(MsgBoxHelper.Deleted("Member not"), "Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Esempio n. 3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (CheckAll())
            {
                Member objMember = new Member();

                objMember.joindate      = dtpJoinDate.Value;
                objMember.firstname     = txtFirstName.Text.Trim();
                objMember.lastname      = txtLastName.Text.Trim();
                objMember.address       = txtAddress.Text.Trim();
                objMember.city          = txtCity.Text.Trim();
                objMember.state         = txtState.Text.Trim();
                objMember.zipcode       = txtZipCode.Text.Trim();
                objMember.phone         = txtPhone.Text.Trim();
                objMember.member_status = rdoActive.Checked ? "A" : "I";
                objMember.login_name    = txtLoginName.Text.Trim();
                objMember.password      = txtPassword.Text.Trim();
                objMember.email         = txtEmail.Text.Trim();
                if (rdoEmail.Checked)
                {
                    objMember.contact_method = 1;
                }
                else if (rdoFacebook.Checked)
                {
                    objMember.contact_method = 2;
                }
                else if (rdoPhoneText.Checked)
                {
                    objMember.contact_method = 3;
                }
                else if (rdoTwitter.Checked)
                {
                    objMember.contact_method = 4;
                }
                else
                {
                    objMember.contact_method = 0;
                }

                objMember.subscription_id = (int)cmbSubscriptionID.SelectedValue;
                objMember.photo           = imageLocation;
                try
                {
                    bool status = Members.AddMember(objMember);
                    if (status)
                    {
                        MessageBox.Show(MsgBoxHelper.Inserted("Member"), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        memberList = Members.GetMembers();
                        memberDataGridView.DataSource = memberList;
                        txtNumber.Text = objMember.number.ToString();
                    }
                    else
                    {
                        MessageBox.Show(MsgBoxHelper.Inserted("Member not"), "Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 4
0
        private void btnUpdate_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 if (CheckAll())
                {
                    Member objMember = new Member();

                    Int32.TryParse(txtNumber.Text.Trim(), out number);
                    objMember.number        = number;
                    objMember.joindate      = dtpJoinDate.Value;
                    objMember.firstname     = txtFirstName.Text.Trim();
                    objMember.lastname      = txtLastName.Text.Trim();
                    objMember.address       = txtAddress.Text.Trim();
                    objMember.city          = txtCity.Text.Trim();
                    objMember.state         = txtState.Text.Trim();
                    objMember.zipcode       = txtZipCode.Text.Trim();
                    objMember.phone         = txtPhone.Text.Trim();
                    objMember.member_status = rdoActive.Checked ? "A" : "I";
                    objMember.login_name    = txtLoginName.Text.Trim();
                    objMember.password      = txtPassword.Text.Trim();
                    objMember.email         = txtEmail.Text.Trim();

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

                    objMember.subscription_id = (int)cmbSubscriptionID.SelectedValue;
                    objMember.photo           = imageLocation;
                    try
                    {
                        bool status = Members.UpdateMember(objMember);
                        if (status)
                        {
                            MessageBox.Show(MsgBoxHelper.Updated("Member"), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            memberList = Members.GetMembers();
                            memberDataGridView.DataSource = memberList;
                        }
                        else
                        {
                            MessageBox.Show(MsgBoxHelper.Updated("Member not"), "Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Esempio n. 5
0
        private void frmMember_Load(object sender, EventArgs e)
        {
            try
            {
                memberList = Members.GetMembers();
                memberDataGridView.DataSource = memberList;

                List <Subscription> subscriptionList = Subscriptions.GetSubscriptions();
                cmbSubscriptionID.DataSource    = subscriptionList;
                cmbSubscriptionID.DisplayMember = Subscriptions.extra;
                cmbSubscriptionID.ValueMember   = Subscriptions.key;
                cmbSubscriptionID.SelectedIndex = -1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            ToolTip toolTip = new ToolTip();

            toolTip.SetToolTip(btnAdd, "Add all Member fields");
            toolTip.SetToolTip(btnBrowse, "Browse by Member Number");
            toolTip.SetToolTip(btnUpdate, "Update all Member fields");
            toolTip.SetToolTip(btnDelete, "Delete Member Number");
            toolTip.SetToolTip(btnClear, "Clear all Member fields");

            toolTip.SetToolTip(txtNumber, Member.numberTip);
            toolTip.SetToolTip(lblNumber, Member.numberTip);

            toolTip.SetToolTip(dtpJoinDate, Member.joindateTip);
            toolTip.SetToolTip(lblJoinDate, Member.joindateTip);

            toolTip.SetToolTip(txtFirstName, Member.firstnameTip);
            toolTip.SetToolTip(lblFirstName, Member.firstnameTip);

            toolTip.SetToolTip(txtLastName, Member.lastnameTip);
            toolTip.SetToolTip(lblLastName, Member.lastnameTip);

            toolTip.SetToolTip(txtAddress, Member.addressTip);
            toolTip.SetToolTip(lblAddress, Member.addressTip);

            toolTip.SetToolTip(txtCity, Member.cityTip);
            toolTip.SetToolTip(lblCity, Member.cityTip);

            toolTip.SetToolTip(txtState, Member.stateTip);
            toolTip.SetToolTip(lblState, Member.stateTip);

            toolTip.SetToolTip(txtZipCode, Member.zipcodeTip);
            toolTip.SetToolTip(lblZipCode, Member.zipcodeTip);

            toolTip.SetToolTip(txtPhone, Member.phoneTip);
            toolTip.SetToolTip(lblPhone, Member.phoneTip);


            toolTip.SetToolTip(txtLoginName, Member.login_nameTip);
            toolTip.SetToolTip(lblLoginName, Member.login_nameTip);

            toolTip.SetToolTip(txtPassword, Member.passwordTip);
            toolTip.SetToolTip(lblPassword, Member.passwordTip);

            toolTip.SetToolTip(txtEmail, Member.emailTip);
            toolTip.SetToolTip(lblEmail, Member.emailTip);

            toolTip.SetToolTip(grpContactMethod, Member.contact_methodTip);

            toolTip.SetToolTip(cmbSubscriptionID, Member.subscription_idTip);
            toolTip.SetToolTip(lblSubscriptionID, Member.subscription_idTip);

            memberDataGridView.Width  = 43 + 10 * 100 + 17;
            memberDataGridView.Height = 23 + 4 * 22 + 17;
        }