带输出參数的存储过程的定义,以及在aso.net中调用
ALTER proc [dbo].[mp_w_RechargePortalPayPal_All]
(
@PayPalOrderNo nvarchar(50), --订单号
@nAccountIDFrom int, --充值帐号
@nAccountIDTo int, --充入帐号
@cTotalMoney numeric(18,2), --总价 用户所在货币总价
@nMoneyType int, --货币类型 用户所在货币类型 -- 非system货币
@nToGameID int, --充入游戏
@nToGameAreaID int, --充入游戏区域
@nToGameServerID int, --冲入游戏server
@GameRoleName nvarchar(50) ,
--冲入游戏角色名
@nVMoney int, --平台币(总)
@nGamePoint int, --游戏币(总)
@AccountIP nvarchar(50), --充值IP
@AccountName nvarchar(150), --姓名
@AccountEmail nvarchar(150), --邮件
@AccountTel nvarchar(50), --电话
@PayType int, --支付方式
@BuyType int, --购买方式
@rv int out, -- >0成功 -1帐号不存在 -2帐号被封或冻结
@rOrderNo nvarchar(50) out,
@rBalanceMoney numeric(18,2) out
)
as
declare @rate decimal(18,6) --汇率
declare @LocalMoneyType int --系统的当地货币类型
declare @orderID int --订单ID
declare @LocalMoneyPrice numeric(18,2) --系统的当地货币
declare @sAccountFrom nvarchar(150) --充值帐户
declare @sAccountTo nvarchar(150) --充入帐户
declare @orderNO nvarchar(50) --订单号
declare @SKUID nvarchar(58) --SKUID
set @rOrderNo='';
set @rBalanceMoney=0;
--推断帐号是否存在
if not exists (select 1 from w_MainAccountInfo where nAccountID=@nAccountIDTo)
begin
set @rv=-1
return
end
--推断账号的状态是否正常
if not exists(select 1 from w_MainAccountInfo ma left join w_MainAccountDetailInfo da on ma.NAccountID=da.NAccountID where ma.naccountID =@nAccountIDTo and da.coldtime<getdate() and ma.status=1)
begin
set @rv=-2
end
--推断订单号是否存在,存在则又一次生成
if exists (select 1 from w_OnlinePayOrderInfo where OrderNo=@PayPalOrderNo)
begin
set @PayPalOrderNo=dbo.f_generateOrderNO(@BuyType,@nToGameID,newid())
end
--查询账户信息
select @sAccountFrom=sAccount from w_MainAccountInfo where nAccountID=@nAccountIDFrom
select @sAccountTo=sAccount from w_MainAccountInfo where nAccountID=@nAccountIDTo
--写入订单表
set @orderNO = @PayPalOrderNo -- 订单号为卡号 -- dbo.f_generateOrderNO(1,@cardCountry,newid())
--查询汇率。将金额兑换为美元
if @nMoneyType <> 99
begin
select top 1 @rate = moneyprice/balanceMoneyPrice,@LocalMoneyType=balanceMoneyType from w_OnlinePayExchangeRate where moneyType = @nMoneyType order by AddDate desc
set @LocalMoneyPrice = @cTotalMoney / @rate
end
else
begin
set @rate=1
set @LocalMoneyPrice =
@cTotalMoney
set @LocalMoneyType=
@nMoneyType
end
--查询赠送点数
declare @GiftPoints int
declare @RealnGamePoint int
if(@nToGameID>0)
begin
--exec mp_w_RechargeGiftPoints @orderNO,@nToGameID,@PayType,@nGamePoint,@NaccountIDTo,@GiftPoints output
--declare @INGameServerName nvarchar(10)
--if(@nToGameID=3 or @nToGameID=12 or @nToGameID=18 or @nToGameID=19)
--begin
-- set @INGameServerName = 'S'+CONVERT(nvarchar(10),@GiftServerID)
--end
--exec mp_w_RechargeServerGiftPoints @orderNO,@nToGameID,@PayType,@nGamePoint,@nAccountIDTo,@INGameServerName,@GiftPoints output
exec mp_w_RechargeServerGiftPoints @orderNO,@nToGameID,@PayType,@nGamePoint,@nAccountIDTo,@nToGameServerID,@GiftPoints output
end
else if(@nToGameID=0)
begin
set @GiftPoints=0
end
--手工兑换上线后。调用存储过程需删除
--exec mp_w_RechargeGiftPoints @orderNO,@nToGameID,@PayType,@nGamePoint,@NaccountIDTo,@GiftPoints output
set @RealnGamePoint=@nGamePoint+@GiftPoints
--插入订单表 OrderState为0
insert into w_OnlinePayOrderInfo(NaccountID,sAccount,OrderNo,MoneyPrice,MoneyType,OrderState
,BuyVMoneyNum,BuyGamePointNum,balanceMoneyPrice,balanceMoneyType,balanceRate,balancePoundage
,AddDate,PayDate,PayType,nAccountID_To,sAccount_To,UserHostIP
,SendVMoneyDate,GameID,MoneyOldPrice,RechargeArea,UserName,UserEmail
,UserTel,RechargeServerID)
values (@NaccountIDFrom,@sAccountFrom,@orderNO,@LocalMoneyPrice,@LocalMoneyType,0
,@nVMoney,@RealnGamePoint,@cTotalMoney,@nMoneyType,@rate,0
,getdate(),0,@PayType,@NaccountIDTo,@sAccountTo,@AccountIP
,0,@nToGameID,0,@nToGameAreaID,@AccountName,@AccountEmail
,@AccountTel,@nToGameServerID)
select @orderID=@@identity
if(LEN( @AccountName)>58)
SET @SKUID=substring( @AccountName,1,56)
else
SET @SKUID=@AccountName
insert into w_OnlinePayOrderDetailInfo(OrderID,ItemNum,cVmoneyNum,cMoneyPrice,cMoneyType,cGamePointNum) values (@orderID,1,@nVMoney,@cTotalMoney,@nMoneyType,@nGamePoint)
insert into w_OnlinePayBuyerInfo(OrderID,INGameRoleName,INGameServerName,SKUID) values (@orderID,@GameRoleName,@nToGameServerID,@SKUID)
set @rv=@orderID
set @rOrderNo=@orderNO
set @rBalanceMoney=@LocalMoneyPrice
--记录赠送日志
if(@GiftPoints > 0)
begin
update w_OnlinepayGiftPointsHistory set orderid=@orderID,naccountid=@nAccountIDTo,
naccountname=@sAccountTo,rechargedate=getdate() where orderno=@OrderNo
end
----订单日志
--insert into w_OnlinePayOrderLog(info) values ('PayPal_All订单:' + @orderNO + '生成成功')
/// <param name="storedProcName">存储过程名</param>
/// <param name="parameters">存储过程參数</param>
/// <param name="rowsAffected">影响的行数</param>
/// <returns></returns>
public static int RunProcedure(string storedProcName, int DataBaseType, IDataParameter[] parameters, out int rowsAffected)
{
using (SqlConnection connection = new SqlConnection(GetDBGameConnstring(DataBaseType)))
{
int result;
connection.Open();
SqlCommand command = BuildIntCommand(connection, storedProcName, parameters);
command.CommandTimeout = 60;
rowsAffected = command.ExecuteNonQuery();
result = (int)command.Parameters["ReturnValue"].Value;
//Connection.Close();
return result;
}
}
public static void OnlineRechargePayPalAll(string OrderNo, int AccountIDFrom, int AccountIDTo, string TotalMoney, int PriceType, int GameID, int GameArea, int AreaServerID, string sGameRoleName, int vMoney, int GamePoint, string IP, string Name, string
Email, string Tel, int PayType, int BuyType, out int ErrorCode, out string ReturnOrderNo, out string BalanceMoney)
{
int iRows = 0;
SqlParameter[] parsRechargePayPal = {
new SqlParameter("@PayPalOrderNo", SqlDbType.NVarChar,50),
new SqlParameter("@nAccountIDFrom", SqlDbType.Int),
new SqlParameter("@nAccountIDTo", SqlDbType.Int),
new SqlParameter("@cTotalMoney", SqlDbType.Decimal),
new SqlParameter("@nMoneyType",SqlDbType.Int),
new SqlParameter("@nToGameID",SqlDbType.Int),
new SqlParameter("@nToGameAreaID",SqlDbType.Int),
new SqlParameter("@nToGameServerID",SqlDbType.Int),
new SqlParameter("@GameRoleName",SqlDbType.NVarChar,50),
new SqlParameter("@nVMoney",SqlDbType.Int),
new SqlParameter("@nGamePoint",SqlDbType.Int),
new SqlParameter("@AccountIP",SqlDbType.NVarChar,50),
new SqlParameter("@AccountName",SqlDbType.NVarChar,150),
new SqlParameter("@AccountEmail",SqlDbType.NVarChar,150),
new SqlParameter("@AccountTel",SqlDbType.NVarChar,50),
new SqlParameter("@PayType",SqlDbType.Int),
new SqlParameter("@BuyType",SqlDbType.Int),
new SqlParameter("@rv",SqlDbType.Int),
new SqlParameter("@rOrderNo",SqlDbType.NVarChar,50),
new SqlParameter("@rBalanceMoney",SqlDbType.Decimal)};
parsRechargePayPal[0].Value = OrderNo;
parsRechargePayPal[1].Value = AccountIDFrom;
parsRechargePayPal[2].Value = AccountIDTo;
parsRechargePayPal[3].Value = TotalMoney;
parsRechargePayPal[4].Value = PriceType;
parsRechargePayPal[5].Value = GameID;
parsRechargePayPal[6].Value = GameArea;
parsRechargePayPal[7].Value = AreaServerID;
parsRechargePayPal[8].Value = sGameRoleName;
parsRechargePayPal[9].Value = vMoney;
parsRechargePayPal[10].Value = GamePoint;
parsRechargePayPal[11].Value = IP;
parsRechargePayPal[12].Value = Name;
parsRechargePayPal[13].Value = Email;
parsRechargePayPal[14].Value = Tel;
parsRechargePayPal[15].Value = PayType;
parsRechargePayPal[16].Value = BuyType;
parsRechargePayPal[17].Direction = ParameterDirection.Output;
parsRechargePayPal[17].Value = 0;
parsRechargePayPal[18].Direction = ParameterDirection.Output;
parsRechargePayPal[18].Value = "";
parsRechargePayPal[19].Direction = ParameterDirection.Output;
parsRechargePayPal[19].Value = "0.0";
parsRechargePayPal[19].Precision = 10;
parsRechargePayPal[19].Scale = 2;
DbHelperSQL.RunProcedure("mp_w_RechargePortalPayPal_All", parsRechargePayPal, out iRows);
ErrorCode = CmnProc.getInt(parsRechargePayPal[17].Value);
ReturnOrderNo = CmnProc.getString(parsRechargePayPal[18].Value);
BalanceMoney = CmnProc.getString(parsRechargePayPal[19].Value);
}
带输出參数的存储过程的定义,以及在aso.net中调用的更多相关文章
- C#调用Oracle带输出数据集的存储过程
1.创建一个带输出数据集的Oracle存储过程 create or replace procedure PRO_test(in_top in number,cur_out out sys_refcur ...
- 各种python 函数參数定义和解析
python 中的函数參数是赋值式的传递的,函数的使用中要注意两个方面:1.函数參数的定义过程,2.函数參数在调用过程中是怎样解析的. 首先说一下在python 中的函数调用过程是分四种方式的.这里且 ...
- MySQL 存储过程传參之in, out, inout 參数使用方法
存储过程传參:存储过程的括号中.能够声明參数. 语法是 create procedure p([in/out/inout] 參数名 參数类型 ..) in :给參数传入值,定义的參数就得到了值 ou ...
- 【VBA研究】VBA自己定义函数參数类型不符的错误
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/iamlaosong/article/details/36871769 作者:iamlaosong 1 ...
- php中的$_GET怎样获取带有井号“#”的參数
<?php echo $_GET['key']; ?> 当url为http://test.com/c.php?key=999时,正常输出:999 当url为http://test.com/ ...
- C中參数个数可变的函数
一.什么是可变參数 我们在C语言编程中有时会遇到一些參数个数可变的函数,比如printf()函数,其函数原型为: int printf( const char* format, ...); 它除了有一 ...
- 我的Spring之旅(二):为请求加入參数
1.前言 在上一篇我的Spring之旅(一)中,我们仅仅是利用不带參数的请求返回一个网页或一段json,在实际的B/S.C/S网络交互中,请求中须要自己定义的參数.本篇将简单地为之前的请求加入參数. ...
- NGINX模块开发 之 验证URL參数
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/RoyalApex/article/details/26404379 作者:邹祁峰 邮箱:Qifeng ...
- kettle參数、变量具体解说
kettle參数.变量具体解说 kettle 3.2 曾经的版本号里仅仅有 variable 和 argument,kettle 3.2 中.又引入了 parameter 概念.variable 即e ...
随机推荐
- java 微信server录音下载到自己server
/** * @author why * */ public class VoiceDownload { /** * * 依据文件id下载文件 * * * * @param mediaId * * 媒体 ...
- Deming管理系列(1)——开车仅仅看后视镜
问题: 当业务经理被要求为未来的业务做计划时,他会提出一个自觉得不错的数字,而董事会往往希望能获得更大的收益,多次与其谈判.而业务经理在这方面不是新手,他有非常多可用的报告. 为什么不能让业务规划流程 ...
- reactjs simple text editor
import React, { Component } from 'react' import PubSub from 'pubsub' import GlobalVars from 'globalV ...
- 创建逻辑dg
逻辑备用DG 今天是2014-04-29,近期一直忙的事情,也没来的急写点东西.今天继续整理dg的相关内容,要说的是逻辑dg的创建过程和注意事项. 什么是逻辑dg呢?物理dg类似于主库的完整副本. ...
- UVA 11728 - Alternate Task 数学
Little Hasan loves to play number games with his friends. One day they were playing a game whereone ...
- How to remove focus without setting focus to another control?
How to remove focus without setting focus to another control? Ask Question up vote 67 down vote favo ...
- ubuntu dig timeout解决方法,dnscat执行失败也是这个原因
dig 失败一般是什么原因?怎么排查? sudo vi /etc/resolvconf/resolv.conf.d/head 写入: nameserver 223.5.5.5nameserver 22 ...
- 7. Reverse Integer[E]整数反转
题目 Given a 32-bit signed integer, reverse digits of an integer. Example1: x = 123, return 321 Exampl ...
- Fine-tuning CaffeNet for Style Recognition on “Flickr Style” Data 数据下载遇到的问题
(下载的时候没有提示 不知道是正在下 还是出现错误 卡着了)..一直没有反应 下载前要以管理员身份运行 sudo su 再 python examples/finetune_flickr_style/ ...
- Python的四个内置数据类型list, tuple, dict, set
Python语言简洁明了,可以用较少的代码实现同样的功能.这其中Python的四个内置数据类型功不可没,他们即是list, tuple, dict, set.这里对他们进行一个简明的总结. List ...