void Add()
        {
            //create an instance of the Payment Collenction
            clsReviewCollection AllReviews = new clsReviewCollection();
            //validate the data on the web t
            string Error = AllReviews.ThisReview.Valid(txtEmail.Text, txtDescription.Text, txtDateReviewed.Text, Convert.ToString(DDListRating.SelectedValue), txtProductId.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //get the data entered by the user
                AllReviews.ThisReview.Email        = Convert.ToString(txtEmail.Text);
                AllReviews.ThisReview.Description  = txtDescription.Text;
                AllReviews.ThisReview.DateReviewed = Convert.ToDateTime(txtDateReviewed.Text);
                AllReviews.ThisReview.Rating       = Convert.ToInt32(DDListRating.SelectedValue);
                AllReviews.ThisReview.ProductId    = Convert.ToInt32(txtProductId.Text);

                //add the record
                AllReviews.Add();
            }
            else
            {
                //report an error
                lblError.Text = "There were problems with the data entered : " + Error;
            }
        }
Ejemplo n.º 2
0
        public void UpdateMethodOK()
        {
            clsReviewCollection AllReviews = new clsReviewCollection();;
            clsReview           TestItem   = new clsReview();
            Int32 PrimaryKey = 0;

            TestItem.VerifiedCustomer = true;
            TestItem.ReviewID         = 7;
            TestItem.CustomerID       = 6;
            TestItem.ProductID        = 1;
            TestItem.ReviewDate       = DateTime.Now.Date;
            TestItem.ProductRating    = 4;
            TestItem.Review           = "Amazing product, would recommend to all students!";

            AllReviews.ThisReview = TestItem;
            PrimaryKey            = AllReviews.Add();
            TestItem.ReviewID     = PrimaryKey;

            TestItem.VerifiedCustomer = false;
            TestItem.ReviewID         = 9;
            TestItem.CustomerID       = 5;
            TestItem.ProductID        = 3;
            TestItem.ReviewDate       = DateTime.Now.Date;
            TestItem.ProductRating    = 5;
            TestItem.Review           = "PHENOMENAL product!!!!";
            AllReviews.ThisReview     = TestItem;
            AllReviews.Update();

            AllReviews.ThisReview.Find(PrimaryKey);
            Assert.AreEqual(AllReviews.ThisReview, TestItem);
        }
        public void Update()
        {
            //create an instance of the Inventory Collection
            clsReviewCollection AllReviews = new clsReviewCollection();
            //validate the data on the Windows Form
            string Error = AllReviews.ThisReview.Valid(txtEmail.Text, txtDescription.Text, txtDateReviewed.Text, Convert.ToString(comboBoxRating.SelectedItem), txtProductId.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //find the record to UPDATE
                AllReviews.ThisReview.Find(mReviewId);
                //get the data entered by the user

                AllReviews.ThisReview.Email        = Convert.ToString(txtEmail.Text);
                AllReviews.ThisReview.Description  = Convert.ToString(txtDescription.Text);
                AllReviews.ThisReview.DateReviewed = Convert.ToDateTime(txtDateReviewed.Text);
                AllReviews.ThisReview.Rating       = Convert.ToInt32(comboBoxRating.SelectedItem);
                AllReviews.ThisReview.ProductId    = Convert.ToInt32(txtProductId.Text);


                //UPDATE the record
                AllReviews.Update();
                //All Done so Redirect to the previous Form
                ReviewManageForm RM = new ReviewManageForm();
                this.Hide();
                RM.ShowDialog();
                this.Close();
            }
            else
            {
                lblError.Text = "There were problems with the data entered: " + Error;
            }
        }
Ejemplo n.º 4
0
        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            string Username            = Session["user"].ToString();
            clsReviewCollection Record = new clsReviewCollection(Username);

            Response.Redirect("Reviews.aspx");
        }
Ejemplo n.º 5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string Username            = Session["user"].ToString();
            clsReviewCollection Review = new clsReviewCollection(Username);
            //validation here
            Boolean OK = Review.ThisReview.Valid(txtReview.Text);

            string review = txtReview.Text;
            string system = ddlReviewSystem.Text;
            int    rating = Int32.Parse(ddlRating.Text);

            if (OK == true)
            {
                Review.ThisReview.Description = review;
                Review.ThisReview.SystemName  = system;
                Review.ThisReview.Rating      = rating;
                Review.Add(Username);
                //success
                lblMessage.Text = "Thank For Your Feedback";
                //refresh the page
                Response.Redirect("Reviews.aspx");
            }
            else
            {
                //report an error
                lblMessage.Text = "Please Comment";
            }
        }
        void Add()
        {
            //create an instance of the Inventory Collenction
            clsReviewCollection AllReviews = new clsReviewCollection();
            //validate the data on the web form
            string Error = AllReviews.ThisReview.Valid(txtEmail.Text, txtDescription.Text, txtDateReviewed.Text, Convert.ToString(comboBoxRating.SelectedItem), txtProductId.Text);

            //if the data is OK then add it to the object
            if (Error == "")
            {
                //get the data entered by the user
                AllReviews.ThisReview.Email        = Convert.ToString(txtEmail.Text);
                AllReviews.ThisReview.Description  = Convert.ToString(txtDescription.Text);
                AllReviews.ThisReview.DateReviewed = Convert.ToDateTime(txtDateReviewed.Text);
                AllReviews.ThisReview.Rating       = Convert.ToInt32(comboBoxRating.SelectedItem);
                AllReviews.ThisReview.ProductId    = Convert.ToInt32(txtProductId.Text);

                //add the record
                AllReviews.Add();
                //all done so redirect back to the main page
                ReviewManageForm RM = new ReviewManageForm();
                this.Hide();
                RM.ShowDialog();
                this.Close();
            }
            else
            {
                //report an error
                lblError.Text = "There were problems with the data entered : " + Error;
            }
        }
Ejemplo n.º 7
0
        private void DisplayRecords()
        {
            clsReviewCollection Record = new clsReviewCollection();

            GVReviews.DataSource = Record.ReviewList;
            GVReviews.DataBind();
        }
Ejemplo n.º 8
0
    protected void btnyes_Click(object sender, EventArgs e)
    {
        clsReviewCollection Reviews = new clsReviewCollection();

        Reviews.ThisReview.Find(ReviewID);
        Reviews.Delete();
        Response.Redirect("ReviewList.aspx");
    }
Ejemplo n.º 9
0
        private void DisplayRecords()
        {
            string Username            = Session["user"].ToString();
            clsReviewCollection Record = new clsReviewCollection(Username);

            GVReview.DataSource = Record.ReviewList;
            GVReview.DataBind();
        }
Ejemplo n.º 10
0
        public void ReportByReviewDateOK()
        {
            clsReviewCollection AllReviews = new clsReviewCollection();

            clsReviewCollection FilteredReviews = new clsReviewCollection();

            FilteredReviews.ReportByReview("");

            Assert.AreEqual(AllReviews.Count, FilteredReviews.Count);
        }
Ejemplo n.º 11
0
        void DeleteInventory()
        {
            //function to delete the selected record

            //create an instance of the Inventory List
            clsReviewCollection AllReviews = new clsReviewCollection();

            //find the record to delete
            AllReviews.ThisReview.Find(mReviewId);
            //delete the record
            AllReviews.Delete();
        }
Ejemplo n.º 12
0
    void DisplayReview()
    {
        clsReviewCollection Reviews = new clsReviewCollection();

        Reviews.ThisReview.Find(ReviewID);

        txtReviewID.Text      = Reviews.ThisReview.ReviewID.ToString();
        txtProductID.Text     = Reviews.ThisReview.ProductID.ToString();
        txtCustomerID.Text    = Reviews.ThisReview.CustomerID.ToString();
        txtReviewDate.Text    = Reviews.ThisReview.ReviewDate.ToString();
        txtProductRating.Text = Reviews.ThisReview.ProductRating.ToString();
        txtReview.Text        = Reviews.ThisReview.Review;
        Yes.Checked           = Reviews.ThisReview.VerifiedCustomer;
    }
        Int32 DisplayReviews(string EmailFilter)
        {
            clsReviewCollection AllReviews = new clsReviewCollection();

            AllReviews.ReportByEmail(EmailFilter);
            //set the data source to the list of Inventories in the collection
            lstReviews.DataSource = AllReviews.ReviewList;
            //set the name of the primary Key
            lstReviews.ValueMember = "ReviewId";
            //set the data field to display
            lstReviews.DisplayMember = "AllDetails";


            return(AllReviews.Count);
        }
        public void DisplayReview()
        {
            //create an instance of the Inventory Collection
            clsReviewCollection AllReviews = new clsReviewCollection();

            //find the record from the database to UPDATE
            AllReviews.ThisReview.Find(mReviewId);
            //Display the data for this record
            txtReviewId.Text     = AllReviews.ThisReview.ReviewId.ToString();
            txtDescription.Text  = AllReviews.ThisReview.Description;
            txtEmail.Text        = AllReviews.ThisReview.Email.ToString();
            comboBoxRating.Text  = AllReviews.ThisReview.Rating.ToString();
            txtDateReviewed.Text = AllReviews.ThisReview.DateReviewed.ToString();
            txtProductId.Text    = AllReviews.ThisReview.ProductId.ToString();
        }
Ejemplo n.º 15
0
        public void ThisReviewPropertyOK()
        {
            clsReviewCollection AllReviews = new clsReviewCollection();
            clsReview           TestReview = new clsReview();

            TestReview.VerifiedCustomer = false;
            TestReview.ReviewID         = 1;
            TestReview.CustomerID       = 1;
            TestReview.ProductID        = 1;
            TestReview.ReviewDate       = DateTime.Now.Date;
            TestReview.ProductRating    = 1;
            TestReview.Review           = "Terrible Product";

            AllReviews.ThisReview = TestReview;
            Assert.AreEqual(AllReviews.ThisReview, TestReview);
        }
Ejemplo n.º 16
0
        public void ListAndCountOK()
        {
            clsReviewCollection AllReviews = new clsReviewCollection();
            List <clsReview>    TestList   = new List <clsReview>();
            clsReview           TestItem   = new clsReview();

            TestItem.VerifiedCustomer = true;
            TestItem.ReviewID         = 7;
            TestItem.CustomerID       = 6;
            TestItem.ProductID        = 20;
            TestItem.ReviewDate       = DateTime.Now.Date;
            TestItem.ProductRating    = 4;
            TestItem.Review           = "Amazing product, would recommend to all students!";

            TestList.Add(TestItem);
            AllReviews.ReviewList = TestList;
            Assert.AreEqual(AllReviews.Count, TestList.Count);
        }
Ejemplo n.º 17
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        clsReview AReview       = new clsReview();
        string    ProductID     = txtProductID.Text;
        string    CustomerID    = txtCustomerID.Text;
        string    Review        = txtReview.Text;
        string    ReviewDate    = txtReviewDate.Text;
        string    ProductRating = txtProductRating.Text;;
        string    Error         = "";

        Error = AReview.Valid(ReviewDate, ProductID, CustomerID, Review, ProductRating);
        if (Error == "")
        {
            AReview.Review           = Review;
            AReview.ReviewDate       = Convert.ToDateTime(ReviewDate);
            AReview.ProductID        = Convert.ToInt32(ProductID);
            AReview.CustomerID       = Convert.ToInt32(CustomerID);
            AReview.ProductRating    = Convert.ToInt32(ProductRating);
            AReview.VerifiedCustomer = Yes.Checked;

            clsReviewCollection ReviewList = new clsReviewCollection();

            if (Convert.ToInt32(ReviewID) == -1)
            {
                ReviewList.ThisReview = AReview;
                ReviewList.Add();
            }

            else
            {
                ReviewList.ThisReview.Find(Convert.ToInt32(ReviewID));
                ReviewList.ThisReview = AReview;
                ReviewList.Update();
            }

            Response.Redirect("ReviewList.aspx");
        }

        else
        {
            lblError.Text = Error;
        }
    }
        private void btnOK_Click(object sender, EventArgs e)
        {
            clsReviewCollection AllReviews = new clsReviewCollection();
            string            Error        = AllReviews.ThisReview.Valid(txtEmail.Text, txtDescription.Text, txtDateReviewed.Text, Convert.ToString(comboBoxRating.SelectedItem), txtProductId.Text);
            string            message      = "Are you sure to Add the new Review to the Database?";
            string            caption      = "User Confirmation!";
            MessageBoxButtons buttons      = MessageBoxButtons.YesNo;
            DialogResult      result;

            //Displays the MessageBox

            //if there are no Errors returned
            if (Error == "")
            {
                //show the Message box
                result = MessageBox.Show(message, caption, buttons);

                //if "Yes" is pressed
                if (result == DialogResult.Yes)
                {
                    //execute the Update method
                    Add();

                    //create an instance of ManageInventoryForm
                    ReviewManageForm RM = new ReviewManageForm();
                    //hide the current form
                    this.Hide();
                    //show the Manaage Inventory Form
                    RM.ShowDialog();
                    //close the current form
                    this.Close();
                }
            }

            else
            {
                //report an error
                lblError.Text = "There were problems with the data entered : " + Error;
            }
        }
Ejemplo n.º 19
0
        public void DeleteMethodOK()
        {
            clsReviewCollection AllReviews = new clsReviewCollection();;
            clsReview           TestItem   = new clsReview();
            Int32 PrimaryKey = 0;

            TestItem.VerifiedCustomer = true;
            TestItem.ReviewID         = 7;
            TestItem.CustomerID       = 6;
            TestItem.ProductID        = 1;
            TestItem.ReviewDate       = DateTime.Now.Date;
            TestItem.ProductRating    = 4;
            TestItem.Review           = "Amazing product, would recommend to all students!";
            AllReviews.ThisReview     = TestItem;
            PrimaryKey        = AllReviews.Add();
            TestItem.ReviewID = PrimaryKey;
            AllReviews.ThisReview.Find(PrimaryKey);
            AllReviews.Delete();
            Boolean Found = AllReviews.ThisReview.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Ejemplo n.º 20
0
        public void InstanceOK()
        {
            clsReviewCollection AllReviews = new clsReviewCollection();

            Assert.IsNotNull(AllReviews);
        }