public static bool InsertUserService(Guid userGuid, string servicesGuids, string newServices, decimal sumPrice, bool decreaseFromPanelCharge) { Business.User userController = new Business.User(); userController.BeginTransaction(); try { if (!userController.DeleteAllUserService(userGuid)) { throw new Exception("ErrorRecord"); } if (!userController.InsertUserService(userGuid, servicesGuids)) { throw new Exception("ErrorRecord"); } if (!userController.InserUserAccessByService(userGuid, servicesGuids)) { throw new Exception("ErrorRecord"); } if (decreaseFromPanelCharge && sumPrice != 0) { int count = Helper.ImportIntData(newServices, "Count"); for (int i = 0; i < count; i++) { Facade.Transaction.Decrease(userGuid, Helper.ImportDecimalData(newServices, "Price" + i), TypeCreditChanges.ActivationService, Language.GetString("DecreaseFromPanelChargeForActivationService") + " \"" + Helper.ImportData(newServices, "Title" + i) + "\"", Guid.Empty, userController.DataAccessProvider); } } userController.CommitTransaction(); } catch (Exception ex) { userController.RollbackTransaction(); throw ex; } return(true); }
public static bool DeleteAllUserService(Guid userGuid) { Business.User userController = new Business.User(); return(userController.DeleteAllUserService(userGuid)); }