示例#1
0
        private void cmdARName_Click(object sender, EventArgs e) // Add review by name.
                                                                 //User ID can be of maximum 7 digits and
                                                                 //cannot be a string/mix of characters and numbers. - done
        {
            listBox1.Items.Clear();
            BusinessTier.Business businesstier;
            businesstier = new BusinessTier.Business("Data Source=" + textBox12.Text);
            string usrid = (string)textBox3.Text;
            string mname = (string)textBox5.Text;
            int    rate  = (int)numericUpDown1.Value;

            if (businesstier.AddReview(mname, Convert.ToInt32(usrid), rate))
            {
                listBox1.Items.Add("S U C C E S S");
                listBox1.Items.Add("");
                listBox1.Items.Add("Review for " + mname + " is added to the database");
            }
            else
            {
                listBox1.Items.Add("F A I L U R E");
                listBox1.Items.Add("");
                listBox1.Items.Add("Review for " + mname + " cannot be added to the database");
            }
            textBox3.Text = "";
            textBox5.Text = "";
        }
示例#2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            // string username = this.namebox.Text;
            string rate       = this.comboBox1.Text;
            string dbfilename = this.txtDatabase.Text;

            BusinessTier.Business biztier = new BusinessTier.Business(dbfilename);
            BusinessTier.Movie    movie   = biztier.GetMovie(this.movieBox.Text);
            BusinessTier.User     user    = biztier.GetNamedUser(this.namebox.Text);


            if (movie != null && user != null && (Convert.ToInt32(rate)) <= 5 && (Convert.ToInt32(rate)) > 0)
            {
                biztier.AddReview(Convert.ToInt32(movie.MovieID), Convert.ToInt32(user.UserID), Convert.ToInt32(rate));
            }

            else
            {
                MessageBox.Show("invalid input");
            }
        }