Ejemplo n.º 1
0
        public AgentTrade GetAgentTrade(AgentTrade model)
        {
            #region sql
            string wherestr = string.Empty;
            if (!string.IsNullOrWhiteSpace(model.TradeOrderId))
            {
                wherestr += " AND TradeOrderId = @0 ";
            }
            if (!string.IsNullOrWhiteSpace(model.OrderId))
            {
                wherestr += " AND OrderId = @1 ";
            }
            if (model.AgentId > 0)
            {
                wherestr += " AND AgentId = @2 ";
            }
            string sql = string.Format(@"
SELECT  *
FROM    [dbo].[AgentTrade]
WHERE   1 = 1
        {0} ", wherestr);
            #endregion
            var agentTrade = CollectionDB.GetInstance().FirstOrDefault <AgentTrade>(sql,
                                                                                    model.TradeOrderId, model.OrderId, model.AgentId);
            return(agentTrade);
        }
Ejemplo n.º 2
0
        protected override void ExecuteMethod()
        {
            if (decimal.Parse(this.Parameter.TradeRate) < decimal.Parse(JsonConfig.JsonRead("trade_rate", "Dingshuapay")))
            {
                throw new AggregateException("手续费费率小于协议费率");
            }
            if (decimal.Parse(this.Parameter.DrawFee) < decimal.Parse(JsonConfig.JsonRead("draw_fee", "Dingshuapay")))
            {
                throw new AggregateException("提现手续小于协议费用");
            }
            if (decimal.Parse(this.Parameter.TransAmt) < 300)
            {
                throw new AggregateException("交易金额不能小于300");
            }
            if (agentTradeRep.GetAgentTrade(new AgentTrade()
            {
                OrderId = this.Parameter.AgentId + this.Parameter.OrderId
            }) != null)
            {
                throw new AggregateException("订单号重复");
            }
            var agentTrade = new AgentTrade()
            {
                AcctCardNo   = this.Parameter.AcctCardno,
                AcctIdCard   = this.Parameter.AcctIdcard,
                AcctName     = this.Parameter.AcctName,
                AgentId      = int.Parse(this.Parameter.AgentId),
                Amount       = decimal.Parse(this.Parameter.TransAmt),
                BankNum      = this.Parameter.BankNum,
                BgRetUrl     = this.Parameter.BgRetUrl,
                CardId       = this.Parameter.CardId,
                CreateTime   = DateTime.Now,
                MobileNo     = this.Parameter.MobileNo,
                RetUrl       = this.Parameter.RetUrl,
                State        = 0,
                TradeOrderId = this.Parameter.OrderId,
                TradeRate    = decimal.Parse(this.Parameter.TradeRate),
                Subject      = this.Parameter.Subject,
                DrawFee      = decimal.Parse(this.Parameter.DrawFee),
                MerPriv      = this.Parameter.MerPriv,
                Extension    = this.Parameter.Extension,
                OrderId      = this.Parameter.AgentId + this.Parameter.OrderId,
                AgentRate    = agent.Rate,
                Poundage     = decimal.Parse(this.Parameter.TransAmt) * decimal.Parse(this.Parameter.TradeRate) / 1000,
                Profits      = decimal.Parse(this.Parameter.TransAmt) * (decimal.Parse(this.Parameter.TradeRate) - agent.Rate) / 1000
            };

            agentTradeRep.Insert(agentTrade);
            this.Result.Data = payProcessor.ExecuteForm(this.Parameter);
        }
Ejemplo n.º 3
0
 public object Insert(AgentTrade model)
 {
     return(CollectionDB.GetInstance().Insert(model));
 }