public static bool InsertUserGeneralPhoneBook(Guid userGuid, string generalPhoneBookGuid, string newGeneralPhoneBook, decimal sumPrice, bool decreaseFromPanelCharge) { Business.User userController = new Business.User(); userController.BeginTransaction(); try { if (!userController.DeleteAllUserGeneralPhoneBook(userGuid)) { throw new Exception("ErrorRecord"); } if (!userController.InsertUserGeneralPhoneBook(userGuid, generalPhoneBookGuid)) { throw new Exception("ErrorRecord"); } if (decreaseFromPanelCharge && sumPrice != 0) { int countNewGeneralPhoneBook = Helper.ImportIntData(newGeneralPhoneBook, "Count"); for (int counterNewGeneralPhoneBook = 0; counterNewGeneralPhoneBook < countNewGeneralPhoneBook; counterNewGeneralPhoneBook++) { Facade.Transaction.Decrease(userGuid, Helper.ImportDecimalData(newGeneralPhoneBook, "Price" + counterNewGeneralPhoneBook), TypeCreditChanges.ActivationGeneralPhoneBook, Language.GetString("DecreaseFromPanelChargeForActivationGeneralPhoneBook") + " \"" + Helper.ImportData(newGeneralPhoneBook, "Name" + counterNewGeneralPhoneBook) + "\"", Guid.Empty, userController.DataAccessProvider); } } userController.CommitTransaction(); } catch (Exception ex) { userController.RollbackTransaction(); throw ex; } return(true); }