public bool SaveAndBroadcastChanges(out string content) { content = string.Empty; try { content = this.SaveCommon(CacheType.Transaciton); Broadcaster.Default.Add(_account.Id, content); _account.AcceptChanges(); return(true); } catch (Exception ex) { Logger.Error(ex); _account.RejectChanges(); return(false); } }
/// <summary> /// Handles the Command event of the DeleteButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.CommandEventArgs"/> instance containing the event data.</param> protected void DeleteButton_Command(object sender, CommandEventArgs e) { Guid principalId = new Guid(e.CommandArgument.ToString()); Account acc = ProfileContext.Current.GetAccount(principalId); if (acc != null) { acc.OrganizationId = 0; acc.AcceptChanges(); } BindForm(); }
private void DoSave() { ExecuteFaultHandledOperation(() => { event_aggregator.GetEvent <AccountUpdatedEvent>().Publish(ApplicationStrings.BeginningSave); ICleaningUtility cleaner = Unity.Container.Resolve <ICleaningUtility>(); using (TransactionScope scope = new TransactionScope()) // TransactionScopeAsyncFlowOption.Enabled { if (Account.AccountKey == 0 && Account.AccountCode == "") { GetNextAccountNumber(); } List <EntityAttributeWrapper> atts_with_values = Account.AccountAttributes.Where(i => i.AttributeValue != "" || i.AttributeKey > 0).ToList(); Account.AccountAttributes.Clear(); foreach (var good_att in atts_with_values) { Account.AccountAttributes.Add(good_att); } Account.Model.Addresses.Clear(); cleaner.CleanAddress(DefaultBillingAddress.Model); DefaultBillingAddress.AddressType = QIQOAddressType.Billing; Account.Model.Addresses.Add(DefaultBillingAddress.Model); cleaner.CleanAddress(DefaultShippingAddress.Model); DefaultShippingAddress.AddressType = QIQOAddressType.Shipping; Account.Model.Addresses.Add(DefaultShippingAddress.Model); cleaner.CleanAddress(DefaultMailingAddress.Model); DefaultMailingAddress.AddressType = QIQOAddressType.Mailing; Account.Model.Addresses.Add(DefaultMailingAddress.Model); IAccountService account_service = service_factory.CreateClient <IAccountService>(); using (account_service) { int _account_key = account_service.CreateAccount(Account.Model); event_aggregator.GetEvent <AccountUpdatedEvent>().Publish($"{Account.AccountCode} - {Account.AccountName} updated sucessfully"); Account.AcceptChanges(); } scope.Complete(); working_account_service.CloseAccount(Account); } }); }
/// <summary> /// Sets the acctive cart for a supplied customer /// </summary> /// <param name="Account"></param> /// <param name="Cart"></param> public static void AssignActiveCart(Account Account, Mediachase.Commerce.Orders.Cart Cart) { Account["ActiveCart"] = Cart.Name; Account.AcceptChanges(); }