private static void UpdatePhoneAPITest1(int phoneID, string area, ref int rowcount) { using (CEF.NewOrCurrentServiceScope()) { var phones = new EntitySet <Phone>().DBRetrieveByKey(phoneID); var phone = phones.FirstOrDefault(); rowcount += 1; if (phone != null) { string oldPhone = phone.Number; if (!string.IsNullOrEmpty(phone.Number) && (phone.Number.Length != 12 || !phone.Number.StartsWith(area))) { if (phone.Number.Length == 8) { phone.Number = area + "-" + phone.Number; } else { if (phone.Number.Length == 12) { phone.Number = area + "-" + phone.Number.Substring(4, 8); } } if (oldPhone != phone.Number) { phones.DBSave(); rowcount += 1; } } } } }
private static bool TestValidPhoneAPITest2(int phoneID, int personID, ref int rowcount) { using (CEF.NewOrCurrentServiceScope()) { var phones = new EntitySet <Phone>().DBRetrieveByKey(phoneID); var phone = phones.FirstOrDefault(); rowcount += 1; if (phone != null) { if (phone.AsDynamic().PersonID == personID) { return(true); } } } return(false); }