带输出參数的存储过程的定义,以及在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 ...
随机推荐
- Android nomedia 避免图片等资源泄露在系统图库其中
总结 Android nomedia 避免文件泄露在系统图库和系统铃声中 在应用开发中 项目的图片总是被系统的图库收录了 避免图片被系统图库收录的发现有2个方法 第一种针对图片 将 .png为后缀的图 ...
- c13--数组
// // main.c // 进制查表法 // // Created by xiaomage on 15/6/10. // Copyright (c) 2015年 xiaomage. All rig ...
- 2017-3-7 leetcode 66 119 121
今天纠结了一整天============================================================== leetcode66 https://leetcode.c ...
- No changes detected or App 'blog' could not be found. Is it in INSTALLED_APPS?
出现该问题的原因: django没有在setting.py的配置文件中找到app内容,需要增加app的名称 E:\PycharmProjects\Mysite>python manage.py ...
- centos 出现的问题
1.DNS问题,导致yum没得源 echo "nameserver 8.8.8.8">>/etc/resolv.conf 2.CentOS 7最小化安装后找不到‘ifc ...
- Android local socket学习总结
转载请注明出处: http://blog.csdn.net/xiexh0921/article/details/7513628 ################################## ...
- Spark SQL 编程API入门系列之SparkSQL的入口
不多说,直接上干货! SparkSQL的入口:SQLContext SQLContext是SparkSQL的入口 val sc: SparkContext val sqlContext = new o ...
- Java 多线程(二)synchronized和volatile
脏读: 脏读指当一个事务正在访问数据,并且对数据进行了修改,而这种修改还没有提交到数据库中,这时,另外一个事务也访问这个数据,然后使用了这个数据.总的来说取到的数据是其实是被更改过的,但还没有保存到数 ...
- 用过的jQuery记录
var list= $('input:radio[name="name"]:checked').val(); //选择input中单选name为“name”的并且是选中状态的 in ...
- Node.js获取本机IP
function getIPAdress() { var interfaces = require('os').networkInterfaces(); for (var devName in int ...