public async Task <IActionResult> ChangeCurrentAddress(Guid customerId, [FromBody] AddressRequest request) { var addressResult = Address4.Create(request.HouseNoOrName, request.Street, request.City, request.County, request.PostCode ); if (addressResult.Status == OperationStatus.ValidationFailure) { return(BadRequest(addressResult.ErrorMessages)); } var addressIdResult = await _mediator.Send(new ChangeCustomerAddressCommand4(customerId, addressResult.Value)); if (addressIdResult == OperationResult <Unit> .NotFound()) { return(NotFound($"The {nameof(customerId)}: {customerId} doesn't exist.")); } return(Created( new Uri($"api/v1/customers/{customerId}/addresses/{addressIdResult.Value}", UriKind.Relative), new { })); }
private void SystemTimer_Tick(object sender, EventArgs e) { byte chr; int value; Address4.Value(Computer.Address[3]); Address3.Value(Computer.Address[2]); Address2.Value(Computer.Address[1]); Address1.Value(Computer.Address[0]); Data2.Value(Computer.Data[1]); Data1.Value(Computer.Data[0]); TapeCounter.Text = Computer.TapeDeck.TapeCounter().ToString(); chr = Computer.TeleType.NextPrintByte(); while (chr != 0) { TeleType.AppendText(((char)chr).ToString()); if (tapePunch.Running) { tapePunch.Punch(chr); } chr = Computer.TeleType.NextPrintByte(); } if (tapeReader.Running) { value = tapeReader.Next(); if (value >= 0) { Computer.TeleType.Send((byte)value); } } if (Computer.cpu.Debug && !Computer.cpu.NextStep && !singleStepRead) { DebugA.Text = Computer.cpu.ac.ToString("X2"); DebugX.Text = Computer.cpu.x.ToString("X2"); DebugY.Text = Computer.cpu.y.ToString("X2"); DebugPC.Text = Computer.cpu.pc.ToString("X2"); DebugS.Text = Computer.cpu.sp.ToString("X2"); FlagN.Visible = ((Computer.cpu.flags & 0x80) == 0x80); FlagV.Visible = ((Computer.cpu.flags & 0x40) == 0x40); FlagB.Visible = ((Computer.cpu.flags & 0x10) == 0x10); FlagD.Visible = ((Computer.cpu.flags & 0x08) == 0x08); FlagI.Visible = ((Computer.cpu.flags & 0x04) == 0x04); FlagZ.Visible = ((Computer.cpu.flags & 0x02) == 0x02); FlagC.Visible = ((Computer.cpu.flags & 0x01) == 0x01); DebugOutput.AppendText(Computer.cpu.DebugOutput + "\r\n"); singleStepRead = true; } }
public override int GetHashCode() { unchecked { var result = NamedTupleCommon.DefaultHashCode; result = (result << 5) + result ^ (Id.GetHashCode()); result = (result << 5) + result ^ (CareOf != null ? CareOf.GetHashCode() : NamedTupleCommon.DefaultHashCode); result = (result << 5) + result ^ (Address1 != null ? Address1.GetHashCode() : NamedTupleCommon.DefaultHashCode); result = (result << 5) + result ^ (Address2 != null ? Address2.GetHashCode() : NamedTupleCommon.DefaultHashCode); result = (result << 5) + result ^ (Address3 != null ? Address3.GetHashCode() : NamedTupleCommon.DefaultHashCode); result = (result << 5) + result ^ (Address4 != null ? Address4.GetHashCode() : NamedTupleCommon.DefaultHashCode); result = (result << 5) + result ^ (City != null ? City.GetHashCode() : NamedTupleCommon.DefaultHashCode); result = (result << 5) + result ^ (Zip != null ? Zip.GetHashCode() : NamedTupleCommon.DefaultHashCode); result = (result << 5) + result ^ (County != null ? County.GetHashCode() : NamedTupleCommon.DefaultHashCode); result = (result << 5) + result ^ (Country != null ? Country.GetHashCode() : NamedTupleCommon.DefaultHashCode); return(result); } }
public override int GetHashCode() { unchecked { var hashCode = Company != null?Company.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (Address1 != null ? Address1.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Address2 != null ? Address2.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Address3 != null ? Address3.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Address4 != null ? Address4.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Address5 != null ? Address5.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Town != null ? Town.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (County != null ? County.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Postcode != null ? Postcode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0); return(hashCode); } }
public Person4(string[] names, Address4 address) { this.names = names ?? throw new ArgumentNullException(paramName: nameof(names)); this.address = address ?? throw new ArgumentNullException(paramName: nameof(address)); }
/// <summary> /// Simplify address /// </summary> /// <remarks> /// This basically is intended to remove empty lines from the address fields and push the remainder up. /// It can mess up the consistency for named fields but that is always a risk with user input /// Postcode is ignored - previously it may have been added to the last line /// </remarks> public void Simplify() { var dummyLine = "##DUMMY ADDRESS LINE##"; // first tidy up Address1 = Address1 == null ? "" : Address1.Trim(); Address2 = Address2 == null ? "" : Address2.Trim(); Address3 = Address3 == null ? "" : Address3.Trim(); Address4 = Address4 == null ? "" : Address4.Trim(); Address5 = Address5 == null ? "" : Address5.Trim(); Address6 = Address6 == null ? "" : Address6.Trim(); // check for house number // we only check the first two addresses and deal if needed // house number is intended to be in address 2 but it could be swapped so we check here var houseNameIsNumeric = Address1.Trim().IsLong(); var houseNameIsPartialNumeric = Address1.Trim().FirstWord().IsLong(); var houseNumberIsNumeric = Address2.Trim().IsLong(); var houseNumberIsPartialNumeric = Address2.Trim().FirstWord().IsLong(); if (houseNameIsNumeric) { long.TryParse(Address1, out var houseNumber); // address1 is fully numeric so we swap Address1 = Address2 == null || Address2.Trim() == "" ? dummyLine : Address2; Address2 = houseNumber.ToString(); } else { if (houseNameIsPartialNumeric) { // address1 is partial numeric, if address2 is empty we move the number if (Address2 == null || Address2.Trim() == "") { long.TryParse(Address1.Trim().FirstWord(), out var houseNumber); Address1 = Address1.Substring(houseNumber.ToString().Length); Address2 = houseNumber.ToString(); } } else { if (houseNumberIsNumeric && (Address1 == null || Address1.Trim() == "")) { // housenumber is numeric and house nameis empty so we add dummy line to prevent losing empty line which will throw out the order Address1 = dummyLine; } else { if (houseNumberIsPartialNumeric && (Address1 == null || Address1.Trim() == "")) { // housenumber contains a partial numeric e.g. 32 High street so we split it out long.TryParse(Address2.Trim().FirstWord(), out var house2Number); Address1 = Address2.Substring(house2Number.ToString().Length); Address2 = house2Number.ToString(); } } } } var tempFullAddress = FullAddress(Address1, Address2, Address3, Address4, Address5, Address6, false); // remove any redundancy so that we have a comma separated string tempFullAddress.ReplaceAllMid(",,", "", 0, tempFullAddress.Length); // now split on comma var tempAddress = tempFullAddress.Split(','); var tempAddressLen = tempAddress.Length; switch (tempAddressLen) { case 1: Address1 = tempAddress[0].Trim(); Address2 = ""; Address3 = ""; Address4 = ""; Address5 = ""; Address6 = ""; break; case 2: Address1 = tempAddress[0].Trim(); Address2 = tempAddress[1].Trim(); Address3 = ""; Address4 = ""; Address5 = ""; Address6 = ""; break; case 3: Address1 = tempAddress[0].Trim(); Address2 = tempAddress[1].Trim(); Address3 = tempAddress[2].Trim(); Address4 = ""; Address5 = ""; Address6 = ""; break; case 4: Address1 = tempAddress[0].Trim(); Address2 = tempAddress[1].Trim(); Address3 = tempAddress[2].Trim(); Address4 = tempAddress[3].Trim(); Address5 = ""; Address6 = ""; break; case 5: Address1 = tempAddress[0].Trim(); Address2 = tempAddress[1].Trim(); Address3 = tempAddress[2].Trim(); Address4 = tempAddress[3].Trim(); Address5 = tempAddress[4].Trim(); Address6 = ""; break; case 6: Address1 = tempAddress[0].Trim(); Address2 = tempAddress[1].Trim(); Address3 = tempAddress[2].Trim(); Address4 = tempAddress[3].Trim(); Address5 = tempAddress[4].Trim(); Address6 = tempAddress[5].Trim(); break; default: Address1 = tempAddress[0].Trim(); Address2 = tempAddress[1].Trim(); Address3 = tempAddress[2].Trim(); Address4 = tempAddress[3].Trim(); Address5 = tempAddress[4].Trim(); Address6 = tempAddress[5].Trim(); break; } // now remove dummy if it exists if (Address1 == dummyLine) { Address1 = ""; } }
public ChangeCustomerAddressCommand4(Guid customerId, Address4 address) { CustomerId = customerId; Address = address; }