Esempio n. 1
0
        public DataTransferObject.Organization.WithholdingView GetWithholding(WithholdingAccountType accountType, Guid company)
        {
            DataTransferObject.Organization.WithholdingView withholding = null;
            //[AccountNo] = @AccountNo AND
            string sql = "SELECT [AccountNo],[AccountType],[Time],[Status],[Amount],[Company] FROM [T_Withholding] WHERE [AccountType]=@AccountType AND [Company] = @Company ";

            using (DbOperator dbOperator = new DbOperator(Provider, ConnectionString)) {
                //dbOperator.AddParameter("AccountNo", withholdingView.AccountNo);
                dbOperator.AddParameter("AccountType", accountType);
                dbOperator.AddParameter("Company", company);
                using (System.Data.Common.DbDataReader reader = dbOperator.ExecuteReader(sql))
                {
                    if (reader.Read())
                    {
                        withholding             = new DataTransferObject.Organization.WithholdingView();
                        withholding.AccountNo   = reader.GetString(0);
                        withholding.AccountType = (WithholdingAccountType)reader.GetByte(1);
                        withholding.Time        = reader.GetDateTime(2);
                        withholding.Status      = (WithholdingProtocolStatus)reader.GetByte(3);
                        withholding.Amount      = reader.GetDecimal(4);
                        withholding.Company     = reader.GetGuid(5);
                    }
                }
            }
            return(withholding);
        }
Esempio n. 2
0
        private static string getPayAccountNo(WithholdingAccountType type, decimal amount, Guid purchaser)
        {
            var auto = AccountService.GetWithholding(type, purchaser);

            if (auto == null || auto.Status == WithholdingProtocolStatus.Submitted)
            {
                throw new CustomException("缺少代扣账号,不能支付!");
            }
            else if (auto.Amount < amount)
            {
                throw new CustomException("代扣金额超过上限,代扣失败!");
            }
            return(auto.AccountNo);
        }
Esempio n. 3
0
        /// <summary>
        /// 代扣
        /// </summary>
        /// <param name="tradeView"></param>
        public static global::PoolPay.DomainModel.Trade.PayTrade AutoPay(AccountTradeDTO tradeView, WithholdingAccountType type)
        {
            global::PoolPay.DomainModel.Trade.PayTrade pay = null;
            string success = "";

            if (type == WithholdingAccountType.Poolpay)
            {
                pay = AccountTradeService.AccountPay(tradeView, "");
                if (pay != null && pay.Status == global::PoolPay.DataTransferObject.PayStatus.PaySuccess)
                {
                    success = "SUCCESS";
                }
                else
                {
                    throw new Exception("支付失败!");
                }
            }
            else if (type == WithholdingAccountType.Alipay)
            {
                success = AccountTradeService.InterfacePay(tradeView);
            }
            if (success != "")
            {
                if (success.ToUpper() == "SUCCESS")
                {
                    using (var command = Factory.CreateCommand())
                    {
                        var autoPayRepository = Factory.CreateAutoPayRepository(command);
                        autoPayRepository.UpdateSuccess(decimal.Parse(tradeView.OutOrderId));
                    }
                }
                else
                {
                    throw new Exception("支付失败!");
                }
                var tradementLog = new Log.Domain.TradementLog
                {
                    OrderId  = decimal.Parse(tradeView.OutOrderId),
                    Request  = "订单号:" + tradeView.OutOrderId,
                    Response = success,
                    Time     = DateTime.Now,
                    Remark   = "修改代扣处理状态",
                };
                LogService.SaveTradementLog(tradementLog);
            }
            return(pay);
        }
Esempio n. 4
0
        public static WithholdingView GetWithholding(WithholdingAccountType accountType, Guid company)
        {
            var repository = Factory.CreateAccountRepository();

            return(repository.GetWithholding(accountType, company));
        }