Equals() public method

public Equals ( Object obj ) : bool
obj Object
return bool
Esempio n. 1
0
        /// <summary>
        /// Register messages
        /// </summary>
        private void RegisterMessages()
        {
            Messenger.Default.Register <ChangeLanguageMessage>(
                this,
                language => TabName = LocalizationProviderHelper.GetLocalizedValue <string>("GreatestMovieTitleTab"));

            Messenger.Default.Register <PropertyChangedMessage <GenreJson> >(this, async e =>
            {
                if (e.PropertyName != GetPropertyName(() => Genre) && Genre.Equals(e.NewValue))
                {
                    return;
                }
                StopLoadingMovies();
                Page = 0;
                Movies.Clear();
                await LoadMoviesAsync();
            });

            Messenger.Default.Register <PropertyChangedMessage <double> >(this, async e =>
            {
                if (e.PropertyName != GetPropertyName(() => Rating) && Rating.Equals(e.NewValue))
                {
                    return;
                }
                StopLoadingMovies();
                Page = 0;
                Movies.Clear();
                await LoadMoviesAsync();
            });
        }
        private void RowValidatedRatings(object sender, DataGridViewCellEventArgs e)
        {
            if (currentRatingAgency == null)
            {
                return;
            }
            TableUtility tableUtility = new TableUtility();
            Rating       newRating    = dataGridViewRatingCodes.Rows[e.RowIndex].DataBoundItem as Rating;

            if (newRating == null)
            {
                return;
            }
            newRating.Agency = currentRatingAgency;
            if (newRating.Index == 0)
            {
                tableUtility.InsertTableRow(newRating);
                return;
            }
            if (currentRow == null)
            {
                return;
            }

            if (!currentRow.Equals(newRating))
            {
                tableUtility.MergeTableRow(newRating);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Register messages
        /// </summary>
        private void RegisterMessages()
        {
            Messenger.Default.Register <ChangeLanguageMessage>(
                this,
                language => { TabName = LocalizationProviderHelper.GetLocalizedValue <string>("SeenTitleTab"); });

            Messenger.Default.Register <ChangeHasBeenSeenMovieMessage>(
                this,
                async message =>
            {
                StopLoadingMovies();
                await LoadMoviesAsync();
            });

            Messenger.Default.Register <PropertyChangedMessage <MovieGenre> >(this, async e =>
            {
                if (e.PropertyName != GetPropertyName(() => Genre) && Genre.Equals(e.NewValue))
                {
                    return;
                }
                StopLoadingMovies();
                await LoadMoviesAsync();
            });

            Messenger.Default.Register <PropertyChangedMessage <double> >(this, async e =>
            {
                if (e.PropertyName != GetPropertyName(() => Rating) && Rating.Equals(e.NewValue))
                {
                    return;
                }
                StopLoadingMovies();
                await LoadMoviesAsync();
            });
        }
Esempio n. 4
0
        public async Task UpdateRatingAsync(int postId, int userId, Rating value)
        {
            var postRating = await _repository.FindItem(postId, userId);

            if (postRating == null && !value.Equals(Rating.None))
            {
                await AddRatingAsync(postId, userId, value);
            }
            if (postRating != null && postRating.Value == (int)value)
            {
                await CancelRatingAsync(postId, userId, value);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Returns true if ProductReview instances are equal
        /// </summary>
        /// <param name="other">Instance of ProductReview to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ProductReview other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProductReviewID == other.ProductReviewID ||
                     ProductReviewID != null &&
                     ProductReviewID.Equals(other.ProductReviewID)
                     ) &&
                 (
                     ProductId == other.ProductId ||
                     ProductId != null &&
                     ProductId.Equals(other.ProductId)
                 ) &&
                 (
                     ReviewerName == other.ReviewerName ||
                     ReviewerName != null &&
                     ReviewerName.Equals(other.ReviewerName)
                 ) &&
                 (
                     ReviewDate == other.ReviewDate ||
                     ReviewDate != null &&
                     ReviewDate.Equals(other.ReviewDate)
                 ) &&
                 (
                     EmailAddress == other.EmailAddress ||
                     EmailAddress != null &&
                     EmailAddress.Equals(other.EmailAddress)
                 ) &&
                 (
                     Rating == other.Rating ||
                     Rating != null &&
                     Rating.Equals(other.Rating)
                 ) &&
                 (
                     Comments == other.Comments ||
                     Comments != null &&
                     Comments.Equals(other.Comments)
                 ));
        }
        public override bool Equals(object obj)
        {
            var model = obj as AddReviewRequestModel;

            if (model == null)
            {
                return(false);
            }
            else
            {
                return(Comment.Equals(model.Comment) &&
                       DateTimePosted.Equals(model.DateTimePosted) &&
                       Rating.Equals(model.Rating) &&
                       RestaurantId.Equals(model.RestaurantId));
            }
        }
Esempio n. 7
0
        public bool Equals(MatchmakingRanking other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Equals(LastModifiedDate, other.LastModifiedDate) &&
                   Rating.Equals(other.Rating) &&
                   Variance.Equals(other.Variance));
        }
Esempio n. 8
0
        public override bool Equals(object obj)
        {
            var model = obj as Review;

            if (model == null)
            {
                return(false);
            }
            else
            {
                return(Rating.Equals(model.Rating) &&
                       PostedDateTime.Equals(model.PostedDateTime) &&
                       Comment.Equals(model.Comment) &&
                       ReviewNumber.Equals(model.ReviewNumber) &&
                       ReviewUser.Equals(model.ReviewUser));
            }
        }
Esempio n. 9
0
        public override bool Equals(object obj)
        {
            if (obj is Strategy)
            {
                var peer = (Strategy)obj;

                bool returnValue = Name.Equals(peer.Name);
                returnValue = returnValue && Count.Equals(peer.Count);
                returnValue = returnValue && Rating.Equals(peer.Rating);
                returnValue = returnValue && Quantity.Equals(peer.Quantity);
                returnValue = returnValue && IsCalculated.Equals(peer.IsCalculated);

                return(returnValue);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
        public virtual Rating UpdateRating(Rating entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            Rating other = GetRating(entity.RatingId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update Rating set  [StoreID]=@StoreID
							, [ProductID]=@ProductID
							, [CustomerID]=@CustomerID
							, [Rating]=@Rating
							, [Comments]=@Comments
							, [HasComment]=@HasComment
							, [IsFilthy]=@IsFilthy
							, [IsROTD]=@IsROTD
							, [FoundHelpful]=@FoundHelpful
							, [FoundNotHelpful]=@FoundNotHelpful
							, [CreatedOn]=@CreatedOn 
							 where RatingID=@RatingID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@RatingID", entity.RatingId)
                , new SqlParameter("@StoreID", entity.StoreId)
                , new SqlParameter("@ProductID", entity.ProductId)
                , new SqlParameter("@CustomerID", entity.CustomerId)
                , new SqlParameter("@Rating", entity.Rating)
                , new SqlParameter("@Comments", entity.Comments ?? (object)DBNull.Value)
                , new SqlParameter("@HasComment", entity.HasComment)
                , new SqlParameter("@IsFilthy", entity.IsFilthy)
                , new SqlParameter("@IsROTD", entity.IsRotd)
                , new SqlParameter("@FoundHelpful", entity.FoundHelpful)
                , new SqlParameter("@FoundNotHelpful", entity.FoundNotHelpful)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetRating(entity.RatingId));
        }
Esempio n. 11
0
        /// <summary>
        /// Returns true if Vendor instances are equal
        /// </summary>
        /// <param name="other">Instance of Vendor to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Vendor other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ID == other.ID ||
                     ID != null &&
                     ID.Equals(other.ID)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     PhoneNumber == other.PhoneNumber ||
                     PhoneNumber != null &&
                     PhoneNumber.Equals(other.PhoneNumber)
                 ) &&
                 (
                     EmailID == other.EmailID ||
                     EmailID != null &&
                     EmailID.Equals(other.EmailID)
                 ) &&
                 (
                     Rating == other.Rating ||
                     Rating != null &&
                     Rating.Equals(other.Rating)
                 ));
        }
Esempio n. 12
0
        /// <summary>
        /// Returns true if Feedback instances are equal
        /// </summary>
        /// <param name="other">Instance of Feedback to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Feedback other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     EventId == other.EventId ||
                     EventId != null &&
                     EventId.Equals(other.EventId)
                     ) &&
                 (
                     Topic == other.Topic ||
                     Topic != null &&
                     Topic.Equals(other.Topic)
                 ) &&
                 (
                     Rating == other.Rating ||
                     Rating != null &&
                     Rating.Equals(other.Rating)
                 ) &&
                 (
                     Comment == other.Comment ||
                     Comment != null &&
                     Comment.Equals(other.Comment)
                 ) &&
                 (
                     Sentiment == other.Sentiment ||
                     Sentiment != null &&
                     Sentiment.Equals(other.Sentiment)
                 ));
        }
Esempio n. 13
0
 public bool HasEmptyAttribute()
 {
     return(Name.Equals("") || Company.Equals("") || Rating.Equals("") ||
            Genre.Equals("") || Year.Equals("") || Price.Equals(""));
 }
Esempio n. 14
0
        //Add New Movie here
        private void btnAddMOvie_Click_1(object sender, EventArgs e)
        {
            try
            {
                string Title, Rent, Year, Rating, Genre;
                Title  = txtTitle.Text.Trim();
                Rent   = txtRentedCost.Text.Trim();
                Rating = txtRating.Text.Trim();
                Year   = txtYear.Text.Trim();
                Genre  = txtGenre.Text.Trim();

                if (Title.Equals(""))
                {
                    MessageBox.Show("Movie title is required!");
                }
                else if (Year.Equals(""))
                {
                    MessageBox.Show("Movie released year is required!");
                }

                else if (Genre.Equals(""))
                {
                    MessageBox.Show("Movie genre is required!");
                }
                else if (Rent.Equals(""))
                {
                    MessageBox.Show("Movie rent cost is required!");
                }

                else if (Rating.Equals(""))
                {
                    MessageBox.Show("Movie rating is required!");
                }

                else
                {
                    SqlConnection con = new SqlConnection();
                    con.ConnectionString = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
                    con.Open();
                    SqlCommand cmd = new SqlCommand();

                    cmd.CommandText = "insert into movies values(@Title,@Year,@Rent,@Genre,@Rating)";
                    cmd.Connection  = con;

                    cmd.Parameters.Add(new SqlParameter("@Title", Title));
                    cmd.Parameters.Add(new SqlParameter("@Rent", Rent));
                    cmd.Parameters.Add(new SqlParameter("@Genre", Genre));
                    cmd.Parameters.Add(new SqlParameter("@Year", Year));
                    cmd.Parameters.Add(new SqlParameter("@Rating", Rating));
                    bool result = cmd.ExecuteNonQuery() > 0;
                    if (result)
                    {
                        BindGridMovies(); // method calling to Bind Grid Movies
                        MessageBox.Show("Movie Info Saved!", "Alert");

                        txtTitle.Text      = "";
                        txtYear.Text       = "";
                        txtRating.Text     = "";
                        txtGenre.Text      = "";
                        txtRentedCost.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("Movie Info NOT Saved!", "Alert");
                    }
                    cmd.Dispose();
                    con.Dispose();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Esempio n. 15
0
        //Update movie Info
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                string Title, Rent, Year, Rating, Genre;
                Title  = txtTitle.Text.Trim();
                Rent   = txtRentedCost.Text.Trim();
                Rating = txtRating.Text.Trim();
                Year   = txtYear.Text.Trim();
                Genre  = txtGenre.Text.Trim();
                string movieId = tbxMovieID.Text.Trim();
                if (Title.Equals(""))
                {
                    MessageBox.Show("Movie title is required!");
                }
                else if (Year.Equals(""))
                {
                    MessageBox.Show("Movie released year is required!");
                }

                else if (Genre.Equals(""))
                {
                    MessageBox.Show("Movie genre is required!");
                }
                else if (Rent.Equals(""))
                {
                    MessageBox.Show("Movie rent cost is required!");
                }

                else if (Rating.Equals(""))
                {
                    MessageBox.Show("Movie rating is required!");
                }

                else
                {
                    SqlConnection con = new SqlConnection();
                    con.ConnectionString = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
                    con.Open();
                    SqlCommand cmd = new SqlCommand();

                    cmd.CommandText = "UpdateMovieInfo";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = con;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@movieid", movieId));
                    cmd.Parameters.Add(new SqlParameter("@title", Title));
                    cmd.Parameters.Add(new SqlParameter("@rent", Rent));
                    cmd.Parameters.Add(new SqlParameter("@genre", Genre));
                    cmd.Parameters.Add(new SqlParameter("@year", Year));
                    cmd.Parameters.Add(new SqlParameter("@rating", Rating));
                    bool result = cmd.ExecuteNonQuery() > 0;
                    if (result)
                    {
                        BindGridMovies(); // method calling to Bind Grid Movies
                        MessageBox.Show("Movie Info updated!", "Alert");
                        tbxCustomerID.Text = "";
                        txtTitle.Text      = "";
                        txtYear.Text       = "";
                        txtRating.Text     = "";
                        txtGenre.Text      = "";
                        txtRentedCost.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("Movie Info NOT Updated!", "Alert");
                    }
                    cmd.Dispose();
                    con.Dispose();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Esempio n. 16
0
 public bool AllCriteriaAreEmpty()
 {
     return(Genre.Equals("") && Year.Equals("") &&
            Company.Equals("") && Rating.Equals("") && Price.Equals(""));
 }