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中调用的更多相关文章

  1. C#调用Oracle带输出数据集的存储过程

    1.创建一个带输出数据集的Oracle存储过程 create or replace procedure PRO_test(in_top in number,cur_out out sys_refcur ...

  2. 各种python 函数參数定义和解析

    python 中的函数參数是赋值式的传递的,函数的使用中要注意两个方面:1.函数參数的定义过程,2.函数參数在调用过程中是怎样解析的. 首先说一下在python 中的函数调用过程是分四种方式的.这里且 ...

  3. MySQL 存储过程传參之in, out, inout 參数使用方法

    存储过程传參:存储过程的括号中.能够声明參数. 语法是 create procedure p([in/out/inout] 參数名  參数类型 ..) in :给參数传入值,定义的參数就得到了值 ou ...

  4. 【VBA研究】VBA自己定义函数參数类型不符的错误

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/iamlaosong/article/details/36871769 作者:iamlaosong 1 ...

  5. php中的$_GET怎样获取带有井号“#”的參数

    <?php echo $_GET['key']; ?> 当url为http://test.com/c.php?key=999时,正常输出:999 当url为http://test.com/ ...

  6. C中參数个数可变的函数

    一.什么是可变參数 我们在C语言编程中有时会遇到一些參数个数可变的函数,比如printf()函数,其函数原型为: int printf( const char* format, ...); 它除了有一 ...

  7. 我的Spring之旅(二):为请求加入參数

    1.前言 在上一篇我的Spring之旅(一)中,我们仅仅是利用不带參数的请求返回一个网页或一段json,在实际的B/S.C/S网络交互中,请求中须要自己定义的參数.本篇将简单地为之前的请求加入參数. ...

  8. NGINX模块开发 之 验证URL參数

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/RoyalApex/article/details/26404379 作者:邹祁峰 邮箱:Qifeng ...

  9. kettle參数、变量具体解说

    kettle參数.变量具体解说 kettle 3.2 曾经的版本号里仅仅有 variable 和 argument,kettle 3.2 中.又引入了 parameter 概念.variable 即e ...

随机推荐

  1. 验证DG最大性能模式下使用ARCH/LGWR及STANDBY LOG的不同情况

    总结:  --两台单实例数据库做DG,数据库版本号10.2.0.1.0 1.主库配置为:arch async,备库无STANDBY LOG. 日志中会有:RFS[4]: No standby redo ...

  2. hdu 2151

    就是一个dp,数组内存的步数, 数组没清空,wa了一次 #include<cstdio> #include<algorithm> #include<cstring> ...

  3. cocos2d 3.3 lua 代码加密 luac

    1.0 cocos luacompile 使用方法 我用的普通的cocos2d lua,没用quick,quick好像能够对整个资源包含图像和音频都加密,打包成zip.我看了下luacompile 的 ...

  4. pyspark MLlib踩坑之model predict+rdd map zip,zip使用尤其注意啊啊啊!

    Updated:use model broadcast, mappartition+flatmap,see: from pyspark import SparkContext import numpy ...

  5. nyoj--114--某种序列(滚动数组)

    某种序列 时间限制:3000 ms  |  内存限制:65535 KB 难度:4 描述 数列A满足An = An-1 + An-2 + An-3, n >= 3  编写程序,给定A0, A1 和 ...

  6. 在阿里云的iis上安装php扩展

    具体参照http://jingyan.baidu.com/article/11c17a2c5ce349f447e39d6d.html

  7. Hessian Servlet实例

    Servlet实例 业务场景 在下面的例子中我会发布一个简单的输出字符串的方法,然后在客户端调用并输出结果. 服务器端 环境搭建 在服务端,我们需要引入hessian和servlet的包.编写服务.配 ...

  8. 关于ubuntu中文输入调用不出来的解决办法,具体如正文。

    卸载了 fcitx sudo apt-get remove fcitx 重启 sudo reboot 重新安装 fcitxsudo apt-get install fcitx 安装拼音输入法sudo ...

  9. eclipse 配置 tomcat 时候的一些注意事项(随机更新)

    1,一些常用的设置,如下图,不特别说明了,看标记应该就知道注意事项了 2,配置文件的问题.eclipse里面如下图的配置文件里如果有所改动,那么在eclipse里启动Tomcat的时候,Tomcat的 ...

  10. c# ExecuteScalar()

    ExecuteScalar这个方法是从数据库中检索单个值返回值是object类型,必须用与它在数据库里存放的类型相同类型或者可以转换成的类型,比如数据是nchar类型值为 "123" ...