/// <summary> /// Copy the contents of another record into self if possible /// </summary> /// <param name="record"></param> /// <returns></returns> public bool MergeWith(SpecificDestinationActiveRecord record) { bool bResult = true; try { if (string.IsNullOrEmpty(Address1) && !string.IsNullOrEmpty(record.Address1)) { Address1 = record.Address1; } if (string.IsNullOrEmpty(Address2) && !string.IsNullOrEmpty(record.Address2)) { Address2 = record.Address2; } if (string.IsNullOrEmpty(City) && !string.IsNullOrEmpty(record.City)) { City = record.City; } if (string.IsNullOrEmpty(NameFirst) && !string.IsNullOrEmpty(record.NameFirst)) { NameFirst = record.NameFirst; } if (string.IsNullOrEmpty(NameLast) && !string.IsNullOrEmpty(record.NameLast)) { NameLast = record.NameLast; } if (string.IsNullOrEmpty(NameMi) && !string.IsNullOrEmpty(record.NameMi)) { NameMi = record.NameMi; } if (string.IsNullOrEmpty(Phone) && !string.IsNullOrEmpty(record.Phone)) { Phone = record.Phone; } if (string.IsNullOrEmpty(State) && !string.IsNullOrEmpty(record.State)) { State = record.State; } if (string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(record.Title)) { Title = record.Title; } if (string.IsNullOrEmpty(Zip) && !string.IsNullOrEmpty(record.Zip)) { Zip = record.Zip; } } catch (Exception) { bResult = false; } return(bResult); }
public bool Equals(SpecificDestinationActiveRecord other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(this == other); }
/// <summary> /// /// </summary> /// <param name="record"></param> public bool MergeLOB(SpecificDestinationActiveRecord record) { bool bUpdateNeeded = false; var dicLob = new SortedDictionary <string, string>(); string[] myList = Lob.Split(DecodeLobCharacter, StringSplitOptions.RemoveEmptyEntries); foreach (string strLob in myList) { dicLob[strLob.Trim()] = strLob.Trim(); } myList = record.Lob.Split(DecodeLobCharacter, StringSplitOptions.RemoveEmptyEntries); foreach (string strLob in myList) { dicLob[strLob.Trim()] = strLob.Trim(); } StringBuilder sbLob = new StringBuilder(255); foreach (KeyValuePair <string, string> valuePair in dicLob) { sbLob.AppendFormat("{0} ;", valuePair.Key); } // Now check if LOB has changed. if (Lob.CompareTo(sbLob.ToString()) != 0) { bUpdateNeeded = true; Lob = sbLob.ToString(); // Also update the Upload_key string[] strUpload_key = UploadKey.Split("/".ToCharArray(), StringSplitOptions.None); strUpload_key[5] = sbLob.ToString(); UploadKey = string.Join("/", strUpload_key); } return(bUpdateNeeded); }