Beispiel #1
0
 /// <summary>
 /// Remove phone from database
 /// </summary>
 /// <param name="instance">Phone instance</param>
 /// <param name="saveAfterRemove">Save database after removing</param>
 /// <param name="waitUntilSaving">Wait until saving</param>
 public void PhoneRemove(Phone instance, bool saveAfterRemove = true, bool waitUntilSaving = true)
 {
     PhoneRemove(new Phone[] { instance }, saveAfterRemove, waitUntilSaving);
 }
Beispiel #2
0
 /// <summary>
 /// Create/Get new phone without any link to database
 /// </summary>
 /// <param name="phoneNumber">Phone number</param>
 /// <param name="account">Account to add account-phone-mark instance</param>
 /// <returns>Phone instance</returns>
 public Phone PhoneNew(string phoneNumber = null, Account account = null)
 {
     try
     {
         var res = new Phone() { };
         if (phoneNumber != null)
             res.PhoneNumber = phoneNumber;
         if (account != null)
             AccountPhoneMarkNew(res, account);
         return res;
     }
     catch (Exception ex)
     {
         Helpers.Log.Add(ex, string.Format("Repository.PhoneNew(phoneNumber='{0}')", phoneNumber ?? "NULL"));
         throw;
     }
 }
Beispiel #3
0
 /// <summary>
 /// Add phone to database
 /// </summary>
 /// <param name="instance">Phone instance</param>
 /// <param name="saveAfterInsert">Save database after insertion</param>
 /// <param name="waitUntilSaving">Wait until saving</param>
 public void PhoneAdd(Phone instance, bool saveAfterInsert = true, bool waitUntilSaving = true)
 {
     PhoneAdd(new Phone[] { instance }, saveAfterInsert, waitUntilSaving);
 }
Beispiel #4
0
        /// <summary>
        /// Create/Get new AccountPhoneMark without any link to database
        /// </summary>
        /// <param name="phone">Phone</param>
        /// <param name="account">Account</param>
        /// <param name="mark">Mark</param>
        /// <returns>AccountPhoneMark instance</returns>
        public AccountPhoneMark AccountPhoneMarkNew(Phone phone = null, Account account = null, Mark mark = null)
        {
            try
            {
                mark = mark ?? MarkGet(MarkTypes.Unknown);
                var res = new AccountPhoneMark() { Account = account, Phone = phone, Mark = mark };

                if (account != null)
                    account.PhoneMarks.Add(res);

                return res;
            }
            catch (Exception ex)
            {
                Helpers.Log.Add(ex, string.Format("Repository.AccountPhoneMarkNew(sourceId='{0}',actionType='{1}',sourceType='{2}')", phone.ToString() ?? "NULL", account.ToString() ?? "NULL", mark.ToString() ?? "NULL"));
                throw;
            }
        }