Beispiel #1
0
        private static void HandleBankTransactionCreatedMsg(li_bank_transactions tr)
        {
            if (tr.status != (int)Agp2pEnums.BankTransactionStatusEnum.Acting)
            {
                throw new Exception("交易已经完成,不应该触发此事件");
            }

            switch ((Agp2pEnums.BankTransactionTypeEnum)tr.type)
            {
            case Agp2pEnums.BankTransactionTypeEnum.Charge:
                // 没有充值申请的通知类型
                break;

            case Agp2pEnums.BankTransactionTypeEnum.Withdraw:
                var notificationTypesForWithdrawer =
                    tr.li_bank_accounts.dt_users.li_notification_settings.AsEnumerable()
                    .Select(n => (Agp2pEnums.DisabledNotificationTypeEnum)n.type)
                    .ToList();
                var sendWithdrawApplySms     = !notificationTypesForWithdrawer.Contains(Agp2pEnums.DisabledNotificationTypeEnum.WithdrawApplyForSms);
                var sendWithdrawApplyUserMsg = !notificationTypesForWithdrawer.Contains(Agp2pEnums.DisabledNotificationTypeEnum.WithdrawApplyForUserMsg);

                if (sendWithdrawApplySms || sendWithdrawApplyUserMsg)
                {
                    sendWithdrawApplyNotification(tr, sendWithdrawApplySms, sendWithdrawApplyUserMsg);
                }
                break;

            default:
                throw new Exception("设置了不存在的银行交易类型");
            }
        }
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         li_bank_transactions wh = (li_bank_transactions)e.Item.DataItem;
         value = value + wh.value;
     }
 }
Beispiel #3
0
        private static void HandleBankTransactionFinishedMsg(li_bank_transactions tr)
        {
            if (tr.status == (int)Agp2pEnums.BankTransactionStatusEnum.Acting)
            {
                throw new Exception("交易尚未完成,不应该触发此事件");
            }

            switch ((Agp2pEnums.BankTransactionTypeEnum)tr.type)
            {
            case Agp2pEnums.BankTransactionTypeEnum.Charge:
                if (tr.status == (int)Agp2pEnums.BankTransactionStatusEnum.Confirm)
                {
                    var notificationTypesForCharger =
                        tr.dt_users.li_notification_settings.AsEnumerable()
                        .Select(n => (Agp2pEnums.DisabledNotificationTypeEnum)n.type)
                        .ToList();
                    var sendChargeSuccessSMS     = !notificationTypesForCharger.Contains(Agp2pEnums.DisabledNotificationTypeEnum.ChargeSuccessForSms);
                    var sendChargeSuccessUserMsg = !notificationTypesForCharger.Contains(Agp2pEnums.DisabledNotificationTypeEnum.ChargeSuccessForUserMsg);

                    if (sendChargeSuccessSMS || sendChargeSuccessUserMsg)
                    {
                        SendChargeSuccessNotification(tr, sendChargeSuccessUserMsg, sendChargeSuccessSMS);
                    }
                }
                else if (tr.status == (int)Agp2pEnums.BankTransactionStatusEnum.Cancel)
                {
                    // 没有充值失败的通知类型
                }
                else
                {
                    throw new Exception("设置了不存在的银行交易状态");
                }
                break;

            case Agp2pEnums.BankTransactionTypeEnum.Withdraw:
                /*var notificationTypesForWithdrawer =
                 *  tr.li_bank_accounts.dt_users.li_notification_settings.AsEnumerable()
                 *      .Select(n => (Agp2pEnums.NotificationTypeEnum)n.type)
                 *      .ToList();*/
                if (tr.status == (int)Agp2pEnums.BankTransactionStatusEnum.Confirm)
                {
                    // 没有提现成功的通知类型
                }
                else if (tr.status == (int)Agp2pEnums.BankTransactionStatusEnum.Cancel)
                {
                    // 没有提现失败的通知类型
                }
                else
                {
                    throw new Exception("设置了不存在的银行交易状态");
                }
                break;

            default:
                throw new Exception("设置了不存在的银行交易类型");
            }
        }
Beispiel #4
0
 protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         li_bank_transactions bt = (li_bank_transactions)e.Item.DataItem;
         value  = value + bt.value;
         value1 = value1 + ((bt.value) - GetHandlingFee(bt));
     }
 }
Beispiel #5
0
        private static void SendChargeSuccessNotification(li_bank_transactions tr, bool sendUserMsg, bool sendSms)
        {
            var context = new Agp2pDataContext();
            //短信通知
            var charger = tr.dt_users;

            //找出模板
            var dtSmsTemplate = context.dt_sms_template.FirstOrDefault(t => t.call_index == "user_recharge_info");

            if (dtSmsTemplate == null)
            {
                return;
            }

            var siteConfig = ConfigLoader.loadSiteConfig(false);

            //替换模板内容
            var msgContent = dtSmsTemplate.content.Replace("{amount}", tr.value.ToString())
                             .Replace("{webtel}", siteConfig.webtel);

            if (sendSms)
            {
                try
                {
                    string errorMsg;
                    if (!SMSHelper.SendTemplateSms(charger.mobile, msgContent, out errorMsg))
                    {
                        context.AppendAdminLogAndSave("ReChargeSms", "发送充值提醒失败:" + errorMsg + "(客户ID:" + charger.user_name + ",订单号:" + tr.no_order + ")");
                    }
                }
                catch (Exception ex)
                {
                    context.AppendAdminLogAndSave("ReChargeSms", "发送充值提醒失败:" + ex.GetSimpleCrashInfo() + "(客户ID:" + charger.user_name + ",订单号:" + tr.no_order + ")");
                }
            }
            if (sendUserMsg)
            {
                var message = new dt_user_message
                {
                    type             = 1,
                    accept_user_name = charger.user_name,
                    content          = msgContent,
                    receiver         = charger.id,
                    title            = dtSmsTemplate.title,
                    post_time        = tr.transact_time.GetValueOrDefault(tr.create_time)
                };
                context.dt_user_message.InsertOnSubmit(message);
                context.SubmitChanges();
            }
        }
Beispiel #6
0
        private static void sendWithdrawApplyNotification(li_bank_transactions tr, bool sendSms, bool sendUserMsg)
        {
            var context = new Agp2pDataContext();
            //短信通知
            var withdrawer = tr.li_bank_accounts.dt_users;

            //找出模板
            var dtSmsTemplate = context.dt_sms_template.FirstOrDefault(t => t.call_index == "user_withdraw_info");

            if (dtSmsTemplate == null)
            {
                return;
            }

            //替换模板内容
            var msgContent = dtSmsTemplate.content.Replace("{amount}", tr.value.ToString())
                             //.Replace("{user_name}", withdrawer.user_name)
                             .Replace("{date}", tr.create_time.ToString("yyyy-MM-dd HH:mm"));

            if (sendSms)
            {
                try
                {
                    string errorMsg;
                    if (!SMSHelper.SendTemplateSms(withdrawer.mobile, msgContent, out errorMsg))
                    {
                        context.AppendAdminLogAndSave("WithdrawSms", "发送提现通知失败:" + errorMsg + "(客户ID:" + withdrawer.user_name + ",订单号:" + tr.no_order + ")");
                    }
                }
                catch (Exception ex)
                {
                    context.AppendAdminLogAndSave("WithdrawSms", "发送提现通知失败:" + ex.GetSimpleCrashInfo() + "(客户ID:" + withdrawer.user_name + ",订单号:" + tr.no_order + ")");
                }
            }
            if (sendUserMsg)
            {
                var message = new dt_user_message
                {
                    type             = 1,
                    accept_user_name = withdrawer.user_name,
                    content          = msgContent,
                    receiver         = withdrawer.id,
                    title            = dtSmsTemplate.title,
                    post_time        = tr.transact_time.GetValueOrDefault(tr.create_time)
                };
                context.dt_user_message.InsertOnSubmit(message);
                context.SubmitChanges();
            }
        }
Beispiel #7
0
        private static void HandleBankTransactionCreatedMsg(li_bank_transactions tr)
        {
            if (tr.type != (int)Agp2pEnums.BankTransactionTypeEnum.Withdraw)
            {
                return;
            }

            var context = new Agp2pDataContext();

            var createTime = tr.create_time;
            var content    = $"用户 {tr.li_bank_accounts.dt_users.GetFriendlyUserName()} 于 {createTime} 申请了提现 {tr.value}";

            GetMessageSubscribers(context, Agp2pEnums.ManagerMessageSourceEnum.UserWithdrawApply).ForEach(m =>
            {
                context.AppendAdminMessage(m, Agp2pEnums.ManagerMessageSourceEnum.UserWithdrawApply, "用户申请提现", content, createTime);
            });
            context.SubmitChanges();
            ManagerMessageHubFacade.Instance.OnNewMsg();
        }
Beispiel #8
0
        private static void HandleBankTransactionFinishedMsg(li_bank_transactions tr)
        {
            if (tr.type != (int)Agp2pEnums.BankTransactionTypeEnum.Charge || tr.status != (int)Agp2pEnums.BankTransactionStatusEnum.Confirm)
            {
                return;
            }

            var context = new Agp2pDataContext();

            var createTime = tr.create_time;
            var content    = $"用户 {tr.dt_users.GetFriendlyUserName()} 于 {createTime} 成功充值了 {tr.value}";

            GetMessageSubscribers(context, Agp2pEnums.ManagerMessageSourceEnum.UserRechargeSuccess).ForEach(m =>
            {
                context.AppendAdminMessage(m, Agp2pEnums.ManagerMessageSourceEnum.UserRechargeSuccess, "用户充值成功", content, createTime);
            });
            context.SubmitChanges();
            ManagerMessageHubFacade.Instance.OnNewMsg();
        }
Beispiel #9
0
 protected decimal GetHandlingFee(li_bank_transactions tr)
 {
     return(tr.handling_fee_type == (int)Agp2pEnums.BankTransactionHandlingFeeTypeEnum.NoHandlingFee
         ? 0
         : Math.Max(TransactionFacade.DefaultHandlingFee, Convert.ToDecimal(Eval("handling_fee"))));
 }
Beispiel #10
0
 public BankTransactionCreatedMsg(li_bank_transactions bankTransaction)
 {
     Transaction = bankTransaction;
 }
 public BankTransactionFinishedMsg(li_bank_transactions bankTransaction)
 {
     Transaction = bankTransaction;
 }
Beispiel #12
0
 protected string QueryIdleMoney(li_bank_transactions liBankTransactions)
 {
     return(liBankTransactions.li_wallet_histories.Last().idle_money.ToString("c"));
 }