Пример #1
0
 public static void PubMerchantTransferToEx(long orderId, int priority)
 {
     LogHelper.Info($"Send MerchantTransferToEx msmq: {FiiiPayIpAddress}MerchantTransferToEx: orderId={orderId}");
     RabbitMQSender.SendMessage("MerchantTransferToEx", orderId);
     //MSMQHelper msmq = new MSMQHelper(FiiiPosIpAddress + "MerchantTransferToEx", true);
     //msmq.SendMessage<long>(orderId, (MessagePriority)priority);
 }
Пример #2
0
 public static void PubRefundOrder(string orderno, int priority)
 {
     RabbitMQSender.SendMessage("RefundOrder", orderno);
     //MSMQHelper msmq = new MSMQHelper(FiiiPayIpAddress + "RefundOrder", true);
     //msmq.SendMessage<string>(orderno, (MessagePriority)priority);
     _log.Info($"Send order({orderno})'s refunded message success.");
 }
Пример #3
0
        /// <summary>
        /// 支付网关发起支付
        /// </summary>
        /// <param name="tradeId">支付网关订单号</param>
        public GatewayOrderInfoOM GatewayPay(string tradeId)
        {
            var orderDetail = GetGatewayOrderDetail(tradeId);

            if (orderDetail == null)
            {
                throw new CommonException(GATEWAY_ORDER_NOT_EXISTS, Resources.EMGatewayOrderNotExist);
            }

            if (!orderDetail.UserAccountId.HasValue)
            {
                throw new CommonException(GATEWAY_ORDER_NOT_EXISTS, Resources.EMGatewayOrderNotExist);
            }

            var id = Guid.NewGuid();

            ExcutePay(orderDetail, id);
            RabbitMQSender.SendMessage("FiiiPay_Gateway_PayCompleted", tradeId);

            return(new GatewayOrderInfoOM()
            {
                Timestamp = DateTime.UtcNow.ToUnixTime().ToString(),
                OrderId = orderDetail.Id,
                MerchantName = orderDetail.MerchantName,
                CryptoCode = orderDetail.Crypto,
                ActurlCryptoAmount = orderDetail.ActualCryptoAmount
            });
        }
Пример #4
0
      public IISConnector()
      {
          SettingsHandler settings = new SettingsHandler();

          LogPath = settings.IISLogPath;
          Rabbit  = new RabbitMQSender("IISConnector");
      }
Пример #5
0
        public ResultDto Refund(RefundVo model)
        {
            var result = new ResultDto();

            var mallDac = new MallPaymentOrderDAC();
            var order   = mallDac.GetByOrderId(model.OrderId);

            if (order.Status != OrderStatus.Completed)
            {
                result.Code    = OrderNoTrade;
                result.Message = Resource.OrderNoTrade;
                return(result);
            }

            if (order.Status == OrderStatus.Refunded)
            {
                result.Code    = RefundedError;
                result.Message = Resource.RefundedError;
                return(result);
            }

            if (order.CryptoAmount != model.CryptoAmount)
            {
                result.Code    = TradeAmountError;
                result.Message = Resource.TradeAmountError;
                return(result);
            }

            RabbitMQSender.SendMessage("PaymentGatewayRefund", order);

            result.Message = Resource.Success;
            return(result);
        }
Пример #6
0
        //public void MiningConfirmed(List<Tuple<byte, Guid, decimal>> accountList)
        //{
        //    if (accountList == null || accountList.Count <= 0)
        //        return;

        //    MiningInfo info;
        //    foreach (var item in accountList)
        //    {
        //        info = new MiningInfo { AccountType = item.Item1, AccountId = item.Item2, Amount = item.Item3 };
        //        RabbitMQSender.SendMessage("MiningConfirmed", JsonConvert.SerializeObject(info));
        //    }
        //}

        public void MiningConfirmed(byte accountType, Guid accountId, decimal amount)
        {
            var info = new MiningInfo {
                AccountType = accountType, AccountId = accountId, Amount = amount
            };

            RabbitMQSender.SendMessage("MiningConfirmed", JsonConvert.SerializeObject(info));
        }
Пример #7
0
 public Manager()
 {
     DB = new MongoDBServer();
     DB.initDB("Lucid");
     Sender   = new RabbitMQSender();
     Handler  = new DataHandler(Sender, DB, this);
     Receiver = new RabbitMQReciever(Handler);
 }
Пример #8
0
 public TrafficRestrictionManager(ILogger logger, ISerializer serializer,
                                  RabbitMQSender rabbitMQ,
                                  ITrafficRestrictionContext iTrafficRestrictionContext)
 {
     m_logger     = logger;
     m_serializer = serializer;
     m_rabbitMQ   = rabbitMQ;
     _iTrafficRestrictionContext = iTrafficRestrictionContext;
 }
        private MerchantWithdrawal WithdrawalToOutside(MerchantWallet fromWallet, MerchantWithdrawal fromWithdraw, Cryptocurrency cryptocurrency,
                                                       MerchantAccount account, decimal amount, decimal fee, string address, string tag, string clientIP)
        {
            var actualAmount = amount - fee;

            ILog _logger = LogManager.GetLogger("LogicError");

            using (var scope = new TransactionScope())
            {
                try
                {
                    fromWithdraw.Status = TransactionStatus.UnSubmit;
                    fromWithdraw        = new MerchantWithdrawalDAC().Create(fromWithdraw);
                    var fromWithdrawFee = new MerchantWithdrawalFee
                    {
                        Amount       = amount,
                        Fee          = fee,
                        Timestamp    = DateTime.UtcNow,
                        WithdrawalId = fromWithdraw.Id
                    };
                    new MerchantWithdrawalFeeDAC().Create(fromWithdrawFee);
                    new MerchantWalletDAC().Freeze(fromWallet.Id, amount);

                    //var requestInfo = new FiiiFinanceAgent().TryCreateWithdraw(requestModel);

                    //new MerchantWithdrawalDAC().UpdateTransactionId(fromWithdraw.Id, requestInfo.RequestID,
                    //    requestInfo.TransactionId);

                    scope.Complete();
                }
                catch (CommonException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    _logger.Info($"Withdraw ApplyWithdrawal faild.WithdrawID:{fromWithdraw.Id},OrderNo:{fromWithdraw.OrderNo}.request Parameter - . Error message:{ex.Message}");
                    throw;
                }
            }
            var requestModel = new CreateWithdrawModel
            {
                AccountID        = account.Id,
                AccountType      = AccountTypeEnum.Merchant,
                CryptoName       = cryptocurrency.Code,
                ReceivingAddress = address,
                DestinationTag   = tag,
                Amount           = actualAmount,
                IPAddress        = clientIP,
                TransactionFee   = fee,
                WithdrawalId     = fromWithdraw.Id
            };

            RabbitMQSender.SendMessage("WithdrawSubmit", requestModel);

            return(fromWithdraw);
        }
Пример #10
0
 public VoiceCommandManager(ILogger _logger, ISerializer _serializer,
                            RabbitMQSender _rabbitMQ,
                            IVoiceCommandContext iVoiceCommandContext)
 {
     m_logger              = _logger;
     m_serializer          = _serializer;
     m_rabbitMQ            = _rabbitMQ;
     _iVoiceCommandContext = iVoiceCommandContext;
 }
Пример #11
0
        public SaveResult SaveMerchantProfileVerifyL1(int AdminId, string AdminName, MerchantProfile profile)
        {
            var oldProfile      = GetMerchantProfile(profile.MerchantId);
            var merchantAccount = FiiiPayDB.MerchantAccountDb.GetById(profile.MerchantId);

            merchantAccount.L1VerifyStatus = profile.L1VerifyStatus;
            if (oldProfile == null)
            {
                return(new SaveResult(false, "Data error"));
            }

            var profileSDK   = new MerchantProfileAgent();
            var verifyStatus = profileSDK.UpdateL1VerifyStatus(oldProfile.MerchantId, profile.L1VerifyStatus, profile.L1Remark);

            if (verifyStatus)
            {
                FiiiPayDB.MerchantAccountDb.Update(merchantAccount);
                if ((profile.L1VerifyStatus == VerifyStatus.Certified || profile.L1VerifyStatus == VerifyStatus.Disapproval))
                {
                    var recordId = FiiiPayDB.VerifyRecordDb.InsertReturnIdentity(new VerifyRecords()
                    {
                        AccountId  = profile.MerchantId,
                        Username   = merchantAccount.Username,
                        Body       = profile.L1Remark,
                        Type       = profile.L1VerifyStatus == VerifyStatus.Certified ? VerifyRecordType.MerchantLv1Verified : VerifyRecordType.MerchantLv1Reject,
                        CreateTime = DateTime.UtcNow
                    });
                    try
                    {
                        if (profile.L1VerifyStatus == VerifyStatus.Certified)
                        {
                            RabbitMQSender.SendMessage("MerchantLv1Verified", recordId);
                        }
                        else if (profile.L1VerifyStatus == VerifyStatus.Disapproval)
                        {
                            RabbitMQSender.SendMessage("MerchantLv1VerifiedFailed", recordId);
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error(ex.Message);
                    }
                }
            }


            ActionLog actionLog = new ActionLog();

            actionLog.AccountId  = AdminId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(MerchantProfileBLL).FullName + ".SaveMerchantProfileVerifyL1";
            actionLog.Username   = AdminName;
            actionLog.LogContent = string.Format("verify merchant profile.MerchantId:{0},l1verifystatus:{1}", profile.MerchantId, profile.L1VerifyStatus.ToString());
            new ActionLogBLL().Create(actionLog);

            return(new SaveResult(verifyStatus));
        }
        public void Should_Send_Simple_Message()
        {
            RabbitMQConfigurator rabbitMQConfigurator = new Messaging.Sender.RabbitMQConfigurator();
            ISender <IMessage>   Sender = new RabbitMQSender <IMessage>(rabbitMQConfigurator.Channel);

            string message = "Hello World! From Ernst";
            var    s       = Sender.send(new QueueMessage(message));

            Assert.AreEqual(" [x] Sent " + message, s);
        }
Пример #13
0
        public static bool Execute(string parkingCode, string guid, string carNo, DateTime beginTime, DateTime lastTime)
        {
            if (string.IsNullOrEmpty(guid) || string.IsNullOrEmpty(carNo) || beginTime == null || lastTime == null)
            {
                return(false);
            }

            ILogger        m_ilogger    = new Logger.Logger();
            ISerializer    m_serializer = new JsonSerializer(m_ilogger);
            RabbitMQSender m_rabbitMQ   = new RabbitMQSender(m_ilogger, m_serializer);
            IDatabase      db;

            db = FollowRedisHelper.GetDatabase(0);
            RedisValue parklotredis = db.HashGet("ParkLotList", parkingCode);

            if (parklotredis != RedisValue.Null)
            {
                ParkLotModel parklotmodel = m_serializer.Deserialize <ParkLotModel>(parklotredis);
                if (parklotmodel != null)
                {
                    List <string> drivewaylist = parklotmodel.DrivewayList; //所有车道
                    if (drivewaylist != null)
                    {
                        //要广播的缴费数据
                        TempCardModel tempCarModel = new TempCardModel();
                        tempCarModel.Guid       = guid;
                        tempCarModel.CarNo      = carNo;
                        tempCarModel.BeginTime  = beginTime;
                        tempCarModel.LatestTime = lastTime;
                        tempCarModel.HavePaid   = true;

                        foreach (var drivewayguid in drivewaylist)
                        {
                            DrivewayModel drivewaymodel = m_serializer.Deserialize <DrivewayModel>(db.HashGet("DrivewayList", drivewayguid));
                            //广播到所有出口车道
                            if (drivewaymodel.Type == DrivewayType.Out)
                            {
                                CommandEntity <TempCardModel> sendCommand = new CommandEntity <TempCardModel>()
                                {
                                    command = BussineCommand.TempCar,
                                    idMsg   = Convert.ToBase64String(Guid.NewGuid().ToByteArray()),
                                    message = tempCarModel
                                };

                                if (m_rabbitMQ.SendMessageForRabbitMQ("发送缴费数据广播命令", m_serializer.Serialize(sendCommand), drivewaymodel.DeviceMacAddress, parkingCode))
                                {
                                    //广播成功
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
Пример #14
0
        static void Main(string[] args)
        {
            string memory1 = "JoerYang2018";
            string memory2 = "JoerYang2019";
            string missing = "JoerYang2020";

            RabbitMQSender.PublishToAdmin("Publish1", memory1);
            RabbitMQSender.PublishToAdmin("Publish1", memory1);
            RabbitMQSender.PublishToAdmin("Publish2", memory2);
            RabbitMQSender.PublishToAdmin("PublishNew1", missing);
        }
Пример #15
0
 private static void SendNotificationMessage(TradeType type, Guid mallId, string orderId, string tradeNo, string result)
 {
     RabbitMQSender.SendMessage("PaymentNotification", new NotificationModel
     {
         Type    = type,
         OrderId = orderId,
         MallId  = mallId,
         TradeNo = tradeNo,
         Status  = result
     });
 }
Пример #16
0
 public OpenGateReasonManager(ILogger logger, ISerializer serializer,
                              IOpenGateReasonContext iOpenGateReasonContext,
                              IVehicleInOutContext iVehicleInOutContext,
                              RabbitMQSender rabbitMQ, CardServiceManager cardServiceManager)
 {
     m_logger                = logger;
     m_serializer            = serializer;
     _iOpenGateReasonContext = iOpenGateReasonContext;
     m_rabbitMQ              = rabbitMQ;
     _cardServiceManager     = cardServiceManager;
     _iVehicleInOutContext   = iVehicleInOutContext;
 }
Пример #17
0
        /// <summary>
        /// 发送剩余车位数量给相机
        /// </summary>
        /// <param name="remainingNumber">剩余车位数</param>
        /// <param name="parkingCode">停车场编号</param>
        /// <param name="m_ilogger"></param>
        /// <param name="m_serializer"></param>
        /// <returns></returns>
        private static bool SpaceNumberToCamera(int remainingNumber, string parkingCode, ILogger m_ilogger, ISerializer m_serializer)
        {
            CommandEntity <int> entity = new CommandEntity <int>()
            {
                command = BussineCommand.RemainingSpace,
                idMsg   = Convert.ToBase64String(Guid.NewGuid().ToByteArray()),
                message = remainingNumber
            };
            RabbitMQSender rabbitMq = new RabbitMQSender(m_ilogger, m_serializer);

            return(rabbitMq.SendMessageForRabbitMQ("发送剩余车位数", m_serializer.Serialize(entity), entity.idMsg, parkingCode));
        }
Пример #18
0
        public void Execute(IJobExecutionContext context)
        {
            Task.Factory.StartNew(() => {
                //从redis获取进场待广播数据进行广播

                ILogger m_ilogger         = new Logger.Logger();
                ISerializer m_serializer  = new JsonSerializer(m_ilogger);
                RabbitMQSender m_rabbitMQ = new RabbitMQSender(m_ilogger, m_serializer);

                IDatabase db = FollowRedisHelper.GetDatabase(2);
                IServer srv  = FollowRedisHelper.GetCurrentServer();

                IEnumerable <RedisKey> allParkingCode = srv.Keys(2);
                foreach (var parkingcode in allParkingCode)
                {
                    HashEntry[] hashentryarray = db.HashGetAll(parkingcode);               //所有实体
                    string[] allCarNo          = db.HashKeys(parkingcode).ToStringArray(); //所有车牌

                    db = FollowRedisHelper.GetDatabase(0);
                    RedisValue parklotredis = db.HashGet("ParkLotList", parkingcode.ToString());
                    if (parklotredis != RedisValue.Null)
                    {
                        ParkLotModel parklotmodel  = m_serializer.Deserialize <ParkLotModel>(parklotredis);
                        List <string> drivewaylist = parklotmodel.DrivewayList; //所有车道
                        if (drivewaylist != null)
                        {
                            foreach (var carno in allCarNo)
                            {
                                HashEntry hashenrty = hashentryarray.SingleOrDefault(o => o.Name == carno);
                                string enterdata    = hashenrty.Value; //要广播的入场数据
                                foreach (var drivewayguid in drivewaylist)
                                {
                                    DrivewayModel drivewaymodel = m_serializer.Deserialize <DrivewayModel>(db.HashGet("DrivewayList", drivewayguid));
                                    if (drivewaymodel.Type == DrivewayType.Out)
                                    {
                                        //广播到出口车道
                                        string sendmsg = string.Format("{{\"command\":{0},\"idMsg\":\"{1}\",\"message\":{2}}}",
                                                                       13, Convert.ToBase64String(Guid.NewGuid().ToByteArray()), enterdata);
                                        if (m_rabbitMQ.SendMessageForRabbitMQ("发送入场数据广播命令", sendmsg, drivewaymodel.DeviceMacAddress, parkingcode))
                                        {
                                            //广播成功,移除缓存的数据
                                            db = FollowRedisHelper.GetDatabase(2);
                                            db.HashDelete(parkingcode, carno);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            });
        }
Пример #19
0
        public DataHandler(RabbitMQSender sender, MongoDBServer db, Manager mgr)
        {
            this.sender   = sender;
            this.db       = db;
            this.manager  = mgr;
            isKnownTarget = new bool[26];
            creationTime  = new TimeStampType[26];

            for (int i = 0; i < isKnownTarget.Length; i++)
            {
                isKnownTarget[i] = false;
            }
        }
Пример #20
0
        public IActionResult AddUser([FromBody] User user)
        {
            Console.WriteLine(user);
            string message = "";

            if (ModelState.IsValid)
            {
                message = this._userService.CreateUser(user) ? "Utilisateur " + user.login + " correctement créé" : "Erreur à la création de l'utilisateur " + user.login;
                RabbitMQSender.GetInstance().sendMessage(user.login);
            }
            ViewBag.Message = message;
            return(View(user));
        }
Пример #21
0
        public bool CarNumberRepushToCamera(CameraUpdateModel model, string parkingCode)
        {
            CommandEntity <CameraUpdateModel> entity = new CommandEntity <CameraUpdateModel>()
            {
                command = BussineCommand.CameraUpdate,
                idMsg   = Convert.ToBase64String(Guid.NewGuid().ToByteArray()),
                message = model
            };
            ILogger        logger     = new Logger();
            ISerializer    serializer = new JsonSerializer(logger);
            RabbitMQSender m_rabbitMQ = new RabbitMQSender(logger, serializer);

            return(m_rabbitMQ.SendMessageForRabbitMQ("发送相机升级命令", serializer.Serialize(entity), entity.idMsg, parkingCode));
        }
Пример #22
0
        public SaveResult SaveResidenceVerify(int AdminId, string AdminName, UserProfile profile)
        {
            var oldProfile  = GetUserProfile(profile.UserAccountId.Value);
            var userAccount = FiiiPayDB.UserAccountDb.GetById(profile.UserAccountId);

            userAccount.L2VerifyStatus = profile.L2VerifyStatus.Value;
            if (oldProfile == null)
            {
                return(new SaveResult(false, "Data error"));
            }

            var profileSDK = new UserProfileAgent();
            var status     = profileSDK.UpdateL2Status(profile.UserAccountId.Value, profile.L2VerifyStatus.Value, profile.L2Remark);

            if (status)
            {
                FiiiPayDB.UserAccountDb.Update(userAccount);
                if ((profile.L2VerifyStatus == VerifyStatus.Certified || profile.L2VerifyStatus == VerifyStatus.Disapproval))
                {
                    var recordId = FiiiPayDB.VerifyRecordDb.InsertReturnIdentity(new VerifyRecords()
                    {
                        AccountId  = profile.UserAccountId.Value,
                        Username   = userAccount.Cellphone,
                        Body       = profile.L2Remark,
                        Type       = profile.L2VerifyStatus == VerifyStatus.Certified ? VerifyRecordType.UserLv2Verified : VerifyRecordType.UserLv2Reject,
                        CreateTime = DateTime.UtcNow
                    });
                    if (profile.L2VerifyStatus == VerifyStatus.Certified)
                    {
                        RabbitMQSender.SendMessage("UserKYC_LV2_VERIFIED", recordId);
                    }
                    else if (profile.L2VerifyStatus == VerifyStatus.Disapproval)
                    {
                        RabbitMQSender.SendMessage("UserKYC_LV2_REJECT", recordId);
                    }
                }
            }
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = AdminId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(UserProfileBLL).FullName + ".SaveResidenceVerify";
            actionLog.Username   = AdminName;
            actionLog.LogContent = string.Format("verify user residence.accountId:{0},verifystatus:{1}", profile.UserAccountId, profile.L1VerifyStatus.ToString());
            new ActionLogBLL().Create(actionLog);

            return(new SaveResult(status));
        }
Пример #23
0
        public void Start()
        {
            Bus = RabbitMQBus.Load(ConfigDirectory + "Bus.config");
            Bus.Start();

            Sender = RabbitMQSender <RabbitMQMultiStringKeyValuePairsMessageModel> .Load(ConfigDirectory + "Sender.config");

            Sender.BindBus(Bus);
            Sender.Start();

            Receiver = RabbitMQReceiver <RabbitMQMultiStringKeyValuePairsMessageModel> .Load(ConfigDirectory + "Receiver.config");

            Receiver.BindBus(Bus);
            Receiver.Start();
        }
Пример #24
0
        public SaveResult SaveProfileVerify(MerchantInformations info, int AdminId, string AdminName)
        {
            var oldInfo = FiiiPayDB.MerchantInformationDb.GetById(info.Id);
            //oldInfo.VerifyStatus = info.VerifyStatus;
            //oldInfo.Remark = info.Remark;
            //oldInfo.VerifyDate = DateTime.Now;

            var result = FiiiPayDB.MerchantInformationDb.Update(c => new MerchantInformations
            {
                VerifyStatus = info.VerifyStatus,
                Remark       = info.Remark,
                VerifyDate   = DateTime.UtcNow
            }, w => w.Id == info.Id);

            if (result && (info.VerifyStatus == VerifyStatus.Certified || info.VerifyStatus == VerifyStatus.Disapproval))
            {
                var recordId = FiiiPayDB.VerifyRecordDb.InsertReturnIdentity(new VerifyRecords()
                {
                    AccountId  = info.MerchantAccountId,
                    Username   = "",
                    Body       = info.Remark,
                    Type       = info.VerifyStatus == VerifyStatus.Certified ? VerifyRecordType.StoreVerified : VerifyRecordType.StoreReject,
                    CreateTime = DateTime.UtcNow
                });
                if (info.VerifyStatus == VerifyStatus.Certified)
                {
                    RabbitMQSender.SendMessage("STORE_VERIFIED", oldInfo.Id);
                }
                else if (info.VerifyStatus == VerifyStatus.Disapproval)
                {
                    RabbitMQSender.SendMessage("STORE_REJECT", oldInfo.Id);
                }
            }

            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = AdminId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(StoreManageBLL).FullName + ".SaveProfileVerify";
            actionLog.Username   = AdminName;
            actionLog.LogContent = string.Format("verify store merchantId:{0},verifystatus:{1}", info.MerchantAccountId, info.VerifyStatus.ToString());
            new ActionLogBLL().Create(actionLog);

            return(new SaveResult(result));
        }
Пример #25
0
        private void timer1_Elapsed(object sender, EventArgs e)
        {
            UserBirthdateMail        userBirthdateMail  = new UserBirthdateMail();
            List <UserBirthdateMail> userBirthdateMails = userBirthdateMail.UserBirthdateMailList();

            if (userBirthdateMails != null && userBirthdateMails.Count > 0)
            {
                userBirthdateMails.ForEach(x =>
                {
                    string dateNow = DateTime.Now.Day.ToString() + "." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Year.ToString();
                    if (x.Birthdate == dateNow)
                    {
                        _sender = new RabbitMQSender(_queueName, x);
                    }
                });
            }
        }
        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);
        }
Пример #27
0
 public void HandleMessage(object ch, BasicDeliverEventArgs ea, string msg)
 {
     Console.WriteLine("ConsumerAdmin:" + msg);
     if (msg == ConstValues.ReloadRabbitMQInstanceWholeCommand)
     {
     }
     else
     {
         int iNotation = msg.IndexOf(ConstValues.PublishNameSepareter);
         if (iNotation < 0)
         {
             return;
         }
         var publishName = msg.Substring(0, iNotation);
         var content     = msg.Substring(iNotation + ConstValues.PublishNameSepareter.Length);
         RabbitMQSender.PublishToQueue(publishName, content);
     }
 }
Пример #28
0
        //测试RabbitMQ
        static void RabbitMQTest(string content)
        {
            //持久化的Exchange、持久化的消息、持久化的队列
            //RabbitMQClientContext context = new RabbitMQClientContext() { SendQueueName = "SendQueueName11", SendExchange = "TEST" ,RoutType = MQRouteType.DirectExchange};
            //持久化的Exchange、持久化的消息、非持久化的队列
            RabbitMQClientContext context2 = new RabbitMQClientContext()
            {
                SendQueueName = "DirectQueue",
                SendExchange  = "DirectQueue",
                RoutType      = MqRouteType.DirectExchange,
                RoutKey       = "DirectQueue",
                MqConfigDom   = new MqConfigDom()
                {
                    MqHost        = "127.0.0.1",
                    MqUserName    = "******",
                    MqPassword    = "******",
                    MqVirtualHost = "/"
                }
            };

            IEventMessage <MessageEntity> message = new EventMessage <MessageEntity>()
            {
                IsOperationOk = false,
                MessageEntity = new MessageEntity()
                {
                    MessageContent = JsonConvert.SerializeObject(content)
                },
                deliveryMode = 2
            };

            try
            {
                RabbitMQSender <MessageEntity> sender = new RabbitMQSender <MessageEntity>(context2, message);
                //for (int i = 0; i < 10000; i++)
                //{
                Console.WriteLine(string.Format("发送信息:{0}", message.MessageEntity.MessageContent));
                sender.TriggerEventMessage();
                //}
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("发送信息失败:{0}", e.Message));
            }
        }
Пример #29
0
        public SaveResult Update(Articles article, int userId, string userName)
        {
            Articles oldArticle = FiiiPayDB.ArticlesDb.GetById(article.Id);

            oldArticle.Title           = article.Title;
            oldArticle.ShouldPop       = article.ShouldPop;
            oldArticle.Body            = article.Body;
            oldArticle.Descdescription = article.Descdescription;
            oldArticle.AccountType     = article.AccountType;
            oldArticle.UpdateTime      = DateTime.UtcNow;

            bool saveSuccess = FiiiPayDB.ArticlesDb.Update(oldArticle);

            if (article.ShouldPop && article.ShouldPop && saveSuccess && (!article.HasPushed.HasValue || !article.HasPushed.Value))
            {
                if (article.AccountType == ArticleAccountType.FiiiPay)
                {
                    //Utils.MSMQ.UserArticle(article.Id,0);
                    RabbitMQSender.SendMessage("UserArticle", article.Id);
                }
                else
                {
                    RabbitMQSender.SendMessage("MerchantArticle", article.Id);
                }
            }

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(ArticleBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Article " + article.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(saveSuccess));
        }
Пример #30
0
        public SaveResult Refund(string orderNo)
        {
            var sdk = new RefundAgent();

            try
            {
                var result = sdk.Refund(orderNo);
                if (result)
                {
                    //MSMQ.BackOfficeUserRefundOrder(orderNo, 0);
                    //MSMQ.BackOfficeMerchantArticleRefundOrder(orderNo, 0);
                    RabbitMQSender.SendMessage("FiiiPay_BackOfficeRefundOrder", orderNo);
                    RabbitMQSender.SendMessage("FiiiPos_BackOfficeRefundOrder", orderNo);
                }
                return(new SaveResult(true));
            }
            catch (CommonException ex)
            {
                return(new SaveResult(false, ex.Message));
            }
        }