/// <summary> /// Returns true if ProjectSearchResultViewModel instances are equal /// </summary> /// <param name="other">Instance of ProjectSearchResultViewModel to be compared</param> /// <returns>Boolean</returns> public bool Equals(ProjectSearchResultViewModel other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( District == other.District || District != null && District.Equals(other.District) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( PrimaryContact == other.PrimaryContact || PrimaryContact != null && PrimaryContact.Equals(other.PrimaryContact) ) && ( Hires == other.Hires || Hires != null && Hires.Equals(other.Hires) ) && ( Requests == other.Requests || Requests != null && Requests.Equals(other.Requests) ) && ( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( RentalRequests == other.RentalRequests || RentalRequests != null && RentalRequests.SequenceEqual(other.RentalRequests) ) && ( RentalAgreements == other.RentalAgreements || RentalAgreements != null && RentalAgreements.SequenceEqual(other.RentalAgreements) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks hash = hash * 59 + Id.GetHashCode(); if (District != null) { hash = hash * 59 + District.GetHashCode(); } if (Name != null) { hash = hash * 59 + Name.GetHashCode(); } if (PrimaryContact != null) { hash = hash * 59 + PrimaryContact.GetHashCode(); } if (Hires != null) { hash = hash * 59 + Hires.GetHashCode(); } if (Requests != null) { hash = hash * 59 + Requests.GetHashCode(); } if (Status != null) { hash = hash * 59 + Status.GetHashCode(); } if (RentalRequests != null) { hash = hash * 59 + RentalRequests.GetHashCode(); } if (RentalAgreements != null) { hash = hash * 59 + RentalAgreements.GetHashCode(); } return(hash); } }
public bool Update(RentalRequests entity) { try { bool isSuccess; using (var rentalRequestRepository = new RentalRequestRepository()) { isSuccess = rentalRequestRepository.Update(entity); } return(isSuccess); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("CarRental.BusinessLogic.Concretes: " + entity.GetType().ToString() + "::Update:Error occured.", ex); } }
public bool ApproveOrDenyTheRequest(RentalRequests rentalRequests, bool isApprove, decimal rentalprice, int pickupkm, int dropoffkm) { try { bool isDeleteSuccess = false, isInsertSuccess = false; if (isApprove) { using (var rentedvehiclebusiness = new RentedVehicleBusiness()) { var rentedvehicle = new RentedVehicles(); rentedvehicle.DriverCustomerId = rentalRequests.RentalRequestCustomerId; rentedvehicle.DropOffDate = rentalRequests.RequestedDropOffDate; rentedvehicle.PickUpDate = rentalRequests.RequestedPickUpDate; rentedvehicle.RentalPrice = rentalprice; rentedvehicle.RentedVehicleId = rentalRequests.RequestedVehicleId; rentedvehicle.SupplierCompanyId = rentalRequests.RequestedSupplierCompanyId; rentedvehicle.VehiclesPickUpKm = pickupkm; rentedvehicle.VehiclesDropOffKm = dropoffkm; isInsertSuccess = rentedvehiclebusiness.Insert(rentedvehicle); if (isInsertSuccess) { isDeleteSuccess = DeleteById(rentalRequests.RentalRequestId); } } } else { isDeleteSuccess = DeleteById(rentalRequests.RentalRequestId); } return(isDeleteSuccess); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("CarRental.BusinessLogic.Concretes:RentalRequestBusiness::ApproveOrDenyTheRequest:Error occured.", ex); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks hash = hash * 59 + Id.GetHashCode(); if (District != null) { hash = hash * 59 + District.GetHashCode(); } if (Name != null) { hash = hash * 59 + Name.GetHashCode(); } if (Status != null) { hash = hash * 59 + Status.GetHashCode(); } if (ProvincialProjectNumber != null) { hash = hash * 59 + ProvincialProjectNumber.GetHashCode(); } if (Information != null) { hash = hash * 59 + Information.GetHashCode(); } if (RentalRequests != null) { hash = hash * 59 + RentalRequests.GetHashCode(); } if (RentalAgreements != null) { hash = hash * 59 + RentalAgreements.GetHashCode(); } if (PrimaryContact != null) { hash = hash * 59 + PrimaryContact.GetHashCode(); } if (Contacts != null) { hash = hash * 59 + Contacts.GetHashCode(); } if (Notes != null) { hash = hash * 59 + Notes.GetHashCode(); } if (Attachments != null) { hash = hash * 59 + Attachments.GetHashCode(); } if (History != null) { hash = hash * 59 + History.GetHashCode(); } return(hash); } }
/// <summary> /// Returns true if Project instances are equal /// </summary> /// <param name="other">Instance of Project to be compared</param> /// <returns>Boolean</returns> public bool Equals(Project other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( District == other.District || District != null && District.Equals(other.District) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( ProvincialProjectNumber == other.ProvincialProjectNumber || ProvincialProjectNumber != null && ProvincialProjectNumber.Equals(other.ProvincialProjectNumber) ) && ( Information == other.Information || Information != null && Information.Equals(other.Information) ) && ( RentalRequests == other.RentalRequests || RentalRequests != null && RentalRequests.SequenceEqual(other.RentalRequests) ) && ( RentalAgreements == other.RentalAgreements || RentalAgreements != null && RentalAgreements.SequenceEqual(other.RentalAgreements) ) && ( PrimaryContact == other.PrimaryContact || PrimaryContact != null && PrimaryContact.Equals(other.PrimaryContact) ) && ( Contacts == other.Contacts || Contacts != null && Contacts.SequenceEqual(other.Contacts) ) && ( Notes == other.Notes || Notes != null && Notes.SequenceEqual(other.Notes) ) && ( Attachments == other.Attachments || Attachments != null && Attachments.SequenceEqual(other.Attachments) ) && ( History == other.History || History != null && History.SequenceEqual(other.History) )); }