/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + IdCar.GetHashCode(); if (CarMake != null) { hashCode = hashCode * 59 + CarMake.GetHashCode(); } if (CarName != null) { hashCode = hashCode * 59 + CarName.GetHashCode(); } if (CarNr != null) { hashCode = hashCode * 59 + CarNr.GetHashCode(); } if (CarType != null) { hashCode = hashCode * 59 + CarType.GetHashCode(); } if (CarClass != null) { hashCode = hashCode * 59 + CarClass.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Car instances are equal /// </summary> /// <param name="other">Instance of Car to be compared</param> /// <returns>Boolean</returns> public bool Equals(Car other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( IdCar == other.IdCar || IdCar.Equals(other.IdCar) ) && ( CarMake == other.CarMake || CarMake != null && CarMake.Equals(other.CarMake) ) && ( CarName == other.CarName || CarName != null && CarName.Equals(other.CarName) ) && ( CarNr == other.CarNr || CarNr != null && CarNr.Equals(other.CarNr) ) && ( CarType == other.CarType || CarType != null && CarType.Equals(other.CarType) ) && ( CarClass == other.CarClass || CarClass != null && CarClass.Equals(other.CarClass) )); }
//Click save data and sent api private async void BtnSaveOnClick(object sender, EventArgs e) { try { if (Methods.CheckConnectivity()) { //Show a progress AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading)); var dictionary = new Dictionary <string, string> { { "live_with", IdLiveWith.ToString() }, { "car", IdCar.ToString() }, { "religion", IdReligion.ToString() }, { "smoke", IdSmoke.ToString() }, { "drink", IdDrink.ToString() }, { "travel", IdTravel.ToString() }, }; (int apiStatus, var respond) = await RequestsAsync.Users.UpdateProfileAsync(dictionary); if (apiStatus == 200) { if (respond is UpdateProfileObject result) { var local = ListUtils.MyUserInfo.FirstOrDefault(); if (local != null) { local.LiveWith = IdLiveWith.ToString(); local.Car = IdCar.ToString(); local.Religion = IdReligion.ToString(); local.Smoke = IdSmoke.ToString(); local.Drink = IdDrink.ToString(); local.Travel = IdTravel.ToString(); SqLiteDatabase database = new SqLiteDatabase(); database.InsertOrUpdate_DataMyInfo(local); database.Dispose(); } Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Short).Show(); AndHUD.Shared.Dismiss(this); Intent resultIntent = new Intent(); SetResult(Result.Ok, resultIntent); Finish(); } } else { Methods.DisplayReportResult(this, respond); //Show a Error image with a message if (respond is ErrorObject error) { var errorText = error.ErrorData.ErrorText; AndHUD.Shared.ShowError(this, errorText, MaskType.Clear, TimeSpan.FromSeconds(2)); } } AndHUD.Shared.Dismiss(this); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); AndHUD.Shared.Dismiss(this); } }