private void btnDelete_Click(object sender, EventArgs e)
        {
            //Validate the UI
            if (string.IsNullOrEmpty(txtJoinDate.Text.Trim()))
            {
                MessageBox.Show("Please enter a member name.");
                txtJoinDate.Focus();
                return;
            }

            Member objMember = MemberDB.GetMember(txtNumber.Text);

            try
            {
                bool status = MemberDB.DeleteMember(objMember);
                if (status) //You can use this syntax as well..if (status ==true)
                {
                    MessageBox.Show("Member was deleted from the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Member was not deleted from the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        public RentalSearchForm(int memberID)
        {
            InitializeComponent();
            Global.memberID = memberID;
            Member currentMember = MemberDB.GetMember(memberID);

            lblName.Text = "Hello " + currentMember.firstname;
            List <Movie>      myMovieList = MovieDB.GetMovies();
            List <PictureBox> pixBoxes    = new List <PictureBox>();

            pixBoxes.Add(pictureBox7);
            pixBoxes.Add(pictureBox8);
            pixBoxes.Add(pictureBox9);
            pixBoxes.Add(pictureBox10);
            imageList1.ImageSize = new Size(32, 32);
            for (int i = 0; i < pixBoxes.Count; i++)
            {
                pixBoxes[i].Load(myMovieList[i].image);
            }
            //foreach (Movie movie in myMovieList)
            //{
            //    pictureBox1.Load(movie.image);
            //    var newImage = Image.FromFile(@"C:\Users\pezhe\OneDrive\Documents\College Classes\C# II\In-Class Demos\Week 10\Project2Template_v2Fall2016\Project2Template\MeramecNetFlixProject\Resources\stlcc-icon-dark-blue.png");
            //    pictureBox1.Image = newImage;
            //    imageList1.Images.Add(newImage);
            //}
        }
Exemple #3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!(validateUI(btnSubmit)))
            {
                return;
            }

            try
            {
                Member newMember = new Member();
                newMember.member_status = "A";
                int  newMemberNumber = 1;
                bool isValidKey      = true;
                while (isValidKey == true)
                {
                    Member testMember = MemberDB.GetMember(newMemberNumber);
                    if (testMember == null)
                    {
                        isValidKey = false;
                    }
                    else
                    {
                        newMemberNumber++;
                    }
                }
                newMember.member_number = newMemberNumber;
                newMember.firstname     = SignUpForm.newMemberFirstName;
                newMember.lastname      = SignUpForm.newMemberLastName;
                newMember.email         = SignUpForm.newMemberEmail;
                newMember.cell_phone    = SignUpForm.newMemberCellPhone;
                newMember.zipcode       = SignUpForm.newMemberZipCode;
                newMember.joindate      = DateTime.Now;
                newMember.username      = txtUsername.Text.Trim();
                newMember.password      = txtPassword.Text.Trim();
                bool status = MemberDB.AddMember(newMember);
                if (status) //returns true
                {
                    MessageBox.Show("Sign Up Successful, Welcome " + newMember.firstname + "!", "MeramecNetFlix", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    new RentalSearchForm(newMember.member_number).Show();
                }
                else //returns false
                {
                    MessageBox.Show("Member was not added to the database.", "MeramecNetFlix", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MeramecNetFlix", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public RentalDetailsForm(int memberID, int movieID)
        {
            InitializeComponent();
            Member currentMember = MemberDB.GetMember(memberID);
            Movie  currentMovie  = MovieDB.GetMovie(movieID);

            label1.Text       = "Hello " + currentMember.firstname;
            lblTitle.Text     = currentMovie.movie_title;
            lblRating.Text    = currentMovie.movie_rating;
            lblYear.Text      = currentMovie.movie_year_made.ToString();
            richTextBox1.Text = currentMovie.description;
            //axWindowsMediaPlayer1.URL = currentMovie.trailer;
            //this.BackgroundImage = ;
            string html = "<html><head>";

            html += "<meta content='IE=Edge' http-equiv='X-UA-Compatible'/>";
            html += "<iframe id='video' src= " + currentMovie.trailer + " width='400' height='200' frameborder='0' allowfullscreen></iframe>";
            html += "</body></html>";
            webBrowser1.DocumentText = string.Format(html);
            //webBrowser1.Url = new Uri(currentMovie.trailer);
        }
Exemple #5
0
        private void btnSignIn_Click(object sender, EventArgs e)
        {
            try
            {
                lblError.Text         = "";
                lblUsernameError.Text = "";

                Member member = MemberDB.GetMember(txtLogin.Text);
                if (txtPassword.Text == member.password)
                {
                    new Thread(() => new RentalForm(member).ShowDialog()).Start();
                    this.Close();
                }
                else
                {
                    lblError.Text = "* incorrect password";
                }
            }
            catch (Exception ex)
            {
                lblUsernameError.Text = "* invalid username";
                //MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnFind_Click(object sender, EventArgs e)
        {
            try
            {
                //Validate the UI
                if (string.IsNullOrEmpty(txtLoginName.Text.Trim()))
                {
                    MessageBox.Show("Search by Login Name", "Uh oh", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtLoginName.Focus();
                    return;
                }

                //Member objMember = MemberDB.GetMember(Convert.ToInt32(txtNumberber.Text.Trim()));
                Member objMember = MemberDB.GetMember(txtLoginName.Text);
                //Step 2: Validate to make sure the Customer object is not null.
                if (objMember != null)
                {
                    //Populate the UI with the object values
                    txtNumber.Text    = objMember.number;
                    txtJoinDate.Text  = objMember.joindate;
                    txtJoinDate.Text  = objMember.joindate;
                    txtFirstname.Text = objMember.firstname;
                    txtLastname.Text  = objMember.lastname;
                    txtAddress.Text   = objMember.address;
                    txtCity.Text      = objMember.city;
                    txtState.Text     = objMember.state;
                    txtZipcode.Text   = objMember.zipcode;
                    txtPhone.Text     = objMember.phone;
                    if (objMember.member_status == "A")
                    {
                        rbActive.Select();
                    }
                    else if (objMember.member_status == "I")
                    {
                        rbInactive.Select();
                    }
                    txtLoginName.Text    = objMember.login_name;
                    txtPassword.Text     = objMember.password;
                    txtEmailAddress.Text = objMember.email;

                    int counter = 4;
                    foreach (var control in gbContactMethod.Controls)
                    {
                        RadioButton rb = control as RadioButton;
                        if (counter == Convert.ToInt32(objMember.contact_method))
                        {
                            rb.Select();
                        }
                        counter--;
                    }


                    cbSubscription.SelectedIndex = Convert.ToInt32(objMember.subscription_id) - 1;

                    if (objMember.photo != "")
                    {
                        pictureBoxPhoto.ImageLocation = photoDir + "\\MemberPhotos\\" + objMember.photo;
                        pictureBoxPhoto.Load();
                    }
                }
                else
                {
                    MessageBox.Show("Member " + txtLoginName.Text.Trim() + " not found in database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }