public void UnbindingAccount(Guid merchantAccountId) { SecurityVerify.Verify <UnBindAccountVerify>(new CustomVerifier("UnBindAccount"), SystemPlatform.FiiiPOS, merchantAccountId.ToString(), (model) => { return(model.PinVerified && model.CombinedVerified); }); var accountDAC = new MerchantAccountDAC(); var account = accountDAC.GetById(merchantAccountId); var posDAC = new POSDAC(); var pos = posDAC.GetById(account.POSId.Value); var recordId = new POSMerchantBindRecordDAC().GetByMerchantId(merchantAccountId).Id; var invitorId = new InviteRecordDAC().GetInvitorIdBySn(pos.Sn); account.POSId = null; bool bindingGoogleAuth = !string.IsNullOrEmpty(account.AuthSecretKey); bool openedGoogleAuth = ValidationFlagComponent.CheckSecurityOpened(account.ValidationFlag, ValidationFlag.GooogleAuthenticator); if (bindingGoogleAuth && !openedGoogleAuth) { account.ValidationFlag = ValidationFlagComponent.AddValidationFlag(account.ValidationFlag, ValidationFlag.GooogleAuthenticator); } using (var scope = new TransactionScope()) { accountDAC.UnbindingAccount(account); new POSDAC().InactivePOS(pos); new POSMerchantBindRecordDAC().UnbindRecord(account.Id, pos.Id); if (!string.IsNullOrEmpty(account.InvitationCode)) { UnBindInviter(pos.Sn); } scope.Complete(); } //Task.Run(() => RemoveRegInfoByUserId(merchantAccountId)); if (!string.IsNullOrEmpty(account.InvitationCode)) { RabbitMQSender.SendMessage("UnBindingAccount", new Tuple <Guid, long>(invitorId, recordId)); } RemoveRegInfoByUserId(merchantAccountId); }