public bool Equals(BulkMoveMovie other) { if (other == null) { return(false); } return(MovieId.Equals(other.MovieId)); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj.GetType() != GetType()) { return(false); } return(MovieId.Equals(((BulkMoveMovie)obj).MovieId)); }
public bool Equals(MovieStat other) { //Check whether the compared object is null. if (MovieStat.ReferenceEquals(other, null)) { return(false); } //Check whether the compared object references the same data. if (MovieStat.ReferenceEquals(this, other)) { return(true); } //Check whether the MovieStat' properties are equal. return(MovieId.Equals(other.MovieId)); }
protected bool Equals(MovieRatedByAudience other) { return(MovieId.Equals(other.MovieId) && Rating == other.Rating); }
protected bool Equals(DirectorAddedToMovie other) { return(MovieId.Equals(other.MovieId) && string.Equals(Director, other.Director)); }
//Issue movie to selected customer private void btnIssueMovie_Click(object sender, EventArgs e) { try { string CustId, MovieId, IssueDate, ReturnDate; int totalDays = 0; int temp = 0; int TotalRent = 0; CustId = DropDownSelectCustomer.SelectedValue.ToString(); MovieId = DropDownMovie.SelectedValue.ToString(); IssueDate = dtIsuue.Value.ToShortDateString(); ReturnDate = dtReturn.Value.ToShortDateString(); if (CustId == "" || CustId == "0" || CustId == null) { MessageBox.Show("Please select customer"); } else if (MovieId.Equals("") || MovieId == "0" || MovieId == null) { MessageBox.Show("Please select movie"); } else if (DateTime.Parse(IssueDate) > DateTime.Parse(ReturnDate)) { MessageBox.Show("Issue date can not be greater than retun date", "Alert"); } else if (IssueDate == ReturnDate) { totalDays = 1; temp = new Movies().CalculateMovieCost(int.Parse(MovieId)); // Getting rent amount for that movie TotalRent = totalDays * temp; // Calculate the Total Rent of issue movie } else { totalDays = new CalculateDays().GetTotalDays(IssueDate, ReturnDate); temp = new Movies().CalculateMovieCost(int.Parse(MovieId)); // Getting rent amount for that movie TotalRent = totalDays * temp; // Calculate the Total Rent of issue movie } RentedMoviesDataTbl rmdata = new RentedMoviesDataTbl(); rmdata.MovieId = int.Parse(MovieId); rmdata.CustId = int.Parse(CustId); rmdata.RentDate = IssueDate; rmdata.ReturnDate = ReturnDate; rmdata.TotalRentAmount = TotalRent; if (new RentedMOvies().InsertRentedMovie(rmdata)) { TabControlSystem.SelectedTab = TabControlSystem.TabPages["RentedMovies"]; RentedMovieGridData(); MessageBox.Show("Movie rented successfully!"); } else { MessageBox.Show("Failed to rent this movie!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected bool Equals(MovieTitled other) { return(MovieId.Equals(other.MovieId) && string.Equals(Title, other.Title)); }
//Rent movie implementation here private void buttonRentMovie_Click(object sender, EventArgs e) { try { string CustId, MovieId, IssueDate, ReturnDate; int totalDays = 0; int temp = 0; int TotalRent = 0; CustId = cbCust.SelectedValue.ToString(); MovieId = cbMovi.SelectedValue.ToString(); IssueDate = dtissue.Value.ToShortDateString(); ReturnDate = dtReturn.Value.ToShortDateString(); if (CustId.Equals("") || CustId == null) { MessageBox.Show("Please select a customer", "Alert"); } else if (MovieId.Equals("") || MovieId == null) { MessageBox.Show("Please select a movie", "Alert"); } else if (DateTime.Parse(IssueDate) > DateTime.Parse(ReturnDate)) { MessageBox.Show("Issue date can not be greater than retun date", "Alert"); } else if (IssueDate == ReturnDate) { totalDays = 1; temp = CalculateMovieRentCost(int.Parse(MovieId)); // Getting rent amount for that movie TotalRent = totalDays * temp; // Calculate the Total Rent of issue movie } else { totalDays = Convert.ToInt32((DateTime.Parse(ReturnDate) - DateTime.Parse(IssueDate)).TotalDays); temp = CalculateMovieRentCost(int.Parse(MovieId)); // Getting rent amount for that movie TotalRent = totalDays * temp; // Calculate the Total Rent of issue movie } SqlConnection con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["conn"].ConnectionString; con.Open(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "RentMovie"; cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@MovieID", MovieId); cmd.Parameters.AddWithValue("@CustID", CustId); cmd.Parameters.AddWithValue("@RentDate", IssueDate); cmd.Parameters.AddWithValue("@ReturnDate", ReturnDate); cmd.Parameters.AddWithValue("@TotalRent", TotalRent); bool result = cmd.ExecuteNonQuery() > 0; if (result) { BindRentMovieGrid(); //method calling to Bind Grid for all rental movies MessageBox.Show("Movie rented successfully!"); } else { MessageBox.Show("Failed to rent this movie"); } cmd.Dispose(); con.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }