月耳思进

人生在世如身处荆棘之中,心不动,人不妄动,不动则不伤;如心动则人妄动,伤其身痛其骨,于是体会到世间诸般痛苦。
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

统一平台:HelloWorld(2)

Posted on 2006-07-04 16:47  Xfan  阅读(263)  评论(0编辑  收藏  举报
 

7、中间层开发

HelloWorld.BLL下添加Messenger.cs(类),因需要调用统一平台提供的数据服务,引用平台核心库JYSoft.Platform.Core.dll,将JYSoft.Platform.Core.dll复制到C:\Inetpub\wwwroot\HelloWorld\bin下,将C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322下的System.Data.OracleClient.dll也复制到C:\Inetpub\wwwroot\HelloWorld\bin下。


using System;
using System.Data;
using System.Data.OracleClient;
using Hello.Data;
using JYSoft.Platform.Core.Services.Data;
using JYSoft.Platform.Core.Services.Data.Oracle;

namespace Hello.BLL
{
    
/// <summary>
    
/// Messenger 的摘要说明。
    
/// </summary>

    public class Messenger
    
{
        
private const string GetUserAccount = @"Select UserAccount From ACM_USER Where UserID=:UserID";

    
        
public Messenger()
        
{            
        }

        
/// <summary>
        
/// 构造函数
        
/// </summary>
        
/// <returns>HelloWorld</returns>

        public GreetingMessage GetGreetingMessage()
        
{
            
string userAccount = GetUserAccountByUserID( 0 );
            
///定义content
            GreetingMessage msg = new GreetingMessage(userAccount);
            
return msg;
        }


        
private string GetUserAccountByUserID(int userID)
        
{            
            DbCore dbService 
= new DbCore("-1");
            OracleCommandWrapper cmdWrapper 
= dbService.GetSqlStringCommandWrapper(GetUserAccount) as OracleCommandWrapper; 
            cmdWrapper.AddInParameter(
":USERID",OracleType.Number,10,userID);

            
return Convert.ToString(dbService.ExecuteScalar( cmdWrapper ));
        }

    }

}