/// <summary> /// Method, that retrieves TempZipTown based on the zip /// </summary> /// <param name="zip">string</param> public void RetrieveTempZipTown(string zip) { TempZipTown = new ZipTown(); bool zipFound = false; tempZip = zip; //Analyse zip if (zip.Length >= 3) { //Validate Zips ValidateZip(); //Search valid in ZipTown list if (validZip) { foreach (ZipTown zipTown in ZipTowns) { if (zipTown.Zip == zip) { TempZipTown = zipTown; zipFound = true; break; } } } } if (!zipFound) { TempZipTown = GetZipTown(1100); } }
/// <summary> /// Method, that retrieves a ZipTown /// </summary> /// <param name="zip"></param> /// <returns></returns> private ZipTown GetZipTown(string zip) { ZipTown result = new ZipTown(); foreach (ZipTown zipTown in CBZ.ZipTowns) { if (zipTown.Zip == zip) { result = zipTown; break; } } return(result); }
public bool AddZipTown(string zip, string town) { bool result = false; using (GrainBarrelContext gbc = new GrainBarrelContext()) { ZipTown zipTown = new ZipTown() { Zip = zip, Town = town }; gbc.ZipTownList.Add(zipTown); gbc.SaveChanges(); } result = true; return(result); }
public bool UpdateZipTown(string zip, string town) { bool result = false; using (GrainBarrelContext gbc = new GrainBarrelContext()) { var target = gbc.ZipTownList.SingleOrDefault(b => b.Zip == town); ZipTown zipTown = new ZipTown() { Zip = zip, Town = town }; if (target != null) { target = zipTown; gbc.SaveChanges(); result = true; } } return(result); }
/// <summary> /// Method, that adds data to an ITT-letter receiver /// </summary> /// <param name="entity">IndexableLegalEntity</param> /// <returns>IttLetterReceiver</returns> private IttLetterReceiver FillIttLetterReceiver(IndexedLegalEntity entity) { GetIttLetterShipping(); IttLetterShipping shipping = Shipping; Project project = Shipping.Project; string companyId = entity.Id; string companyName = entity.Name; Contact contact = GetContact(entity.Id); string attention = contact.Name; Address address = GetAddress(entity.Address.Id); string street = address.Street; string place = address.Place; ZipTown zipTown = address.ZipTown; string zip = zipTown.ToString(); string email = contact.ContactInfo.Email; IttLetterReceiver result = new IttLetterReceiver(shipping, project, companyId, companyName, attention, street, zip, email, place); return(result); }