Proxy

类别:.NET开发 点击:0 评论:0 推荐:

/// <summary>
/// 主题管理类
/// </summary>
public class TitlesManage:ITitles
{
  /// <summary>
  /// 删除主题
  /// </summary>
  /// <param name="titleID">主题编号</param>
  /// <param name="operName">操作员</param>
  public void DelTitle(int titleID,string operName)
  {
   //...
  }
}

public interface ITitles
{
  void DelTitle(int TitleID,string operName);
}


/// <summary>
///主题管理代理类
/// </summary>
public class ProxyTitlesManage:ITitles
{
  public struct ValidateInfo
  {
   public int userID;
   public int forumID;
   public int groupID;
   public int ownerID;
  }

  private ValidateInfo m_Validate;
  private ITitles m_Title;

  public ProxyTitlesManage(ValidateInfo v,ITitles it)
  {
   m_Validate = v;
   m_Title = it;
  }

  //删除主题
  public void DelTitle(int titleID,string operName)
  {
   if(CheckIdentity())
   {
    m_Title.DelTitle(titleID,operName);
   }
   else
   {
    throw new Exception("系统检测到你没有权限!");
   }   
  }

  private bool CheckIdentity( )
  {
   //...
  }

}

本文地址:http://com.8s8s.com/it/it42819.htm