gordonliweiID:gordonliwei
167305次访问,排名441好友0人,关注者10
gordonliwei的文章
原创 43 篇
翻译 0 篇
转载 0 篇
评论 266 篇
李维的公告
最近评论
quzhoushijie:gby杭州机票
杭州打折机票
杭州特价机票
WoW GoldWoW Gold
myshijieye:饰品加盟
浙江整形医院
浙江省人民医院
myshijieye:粉末涂料
购物篮
充电器
艺术漆
myshijieye:健康管理
飞凌
网络跳线
配线架
文章分类
    收藏
      相册
      作品集
      个人网站链接!
      博文视点读书热线(期书早知道)
      李维个人网站!
      存档
      软件项目交易
      订阅我的博客
      XML聚合  FeedSky
      订阅到鲜果
      订阅到Google
      订阅到抓虾
      订阅到BlogLines
      订阅到Yahoo
      订阅到GouGou
      订阅到飞鸽
      订阅到Rojo
      订阅到newsgator
      订阅到netvibes

      原创 TEcoForumServices 类(繁体版4月15日博客)收藏

      新一篇: 《Delphi MDA/DDA程序设计——使用ECO》一书已到台湾(繁体版4月16号博客) | 旧一篇: 生日快乐,师大附中!(繁体版4月15日博客)

      TEcoForumServices

       

      有位大陆的读者写信跟我说他在《Delphi MDA/DDA程序设计——使用ECO》一书的CD中找不到TEcoForumServices 类的源代码,虽然我记得我已经把整本书下的Source打包到CD中了,而且TEcoForumServices 是一个很简易的类.Anyway,如果有人也需要这个类的源代码,下面就是它完整的列表。

      unit EcoForumWrapperServices;

      interface

      uses System.Web, ECOForumWebAppDemo1EcoSpace, PECOForumUnit,
           Borland.Eco.Handles, Borland.Eco.ObjectRepresentation,
           System.Web.Security, Borland.Eco.Services;

      type
        TEcoForumServices = class
        private
          { Private Declarations }
        public
          class function CreateMemeber(mySpace :  Borland.Eco.Handles.EcoSpace) : ForumMember;
          class function getForumSite(objl : IObjectList) : ForumSite;
          class function MemberLogin(mySpace :  Borland.Eco.Handles.EcoSpace; const UserId : string; const sPassword : string) : ForumMember;
        end;

      implementation


      { TEcoForumServices }

      class function TEcoForumServices.CreateMemeber(mySpace :  Borland.Eco.Handles.EcoSpace): ForumMember;
      begin
        Result := ForumMember.Create(mySpace);
      end;

      class function TEcoForumServices.getForumSite(objl: IObjectList): ForumSite;
      var
        obj : System.Object;
      begin
        Result := HttpContext.Current.Session['ForumSite'] as ForumSite;

        if (Result = nil) then
        begin
          obj := objl[0].AsObject;
          Result := obj as ForumSite;
          HttpContext.Current.Session['ForumSite'] := Result;
        end;
      end;

      class function TEcoForumServices.MemberLogin(mySpace :  Borland.Eco.Handles.EcoSpace;
        const UserId, sPassword: string): ForumMember;
      const
        selectUser = 'ForumMember.allInstances->select( M | (M.Name = ''{0}'')  and  (M.Password = ''{1}'') )->First';
      var
        enPW : string;
        userOCL : string;
        OCLResult : IElement;
        oclService : IOclService;
      begin
        enPW := FormsAuthentication.HashPasswordForStoringInConfigFile(sPassword,'md5');
        oclService := mySpace.GetEcoService(typeof(IOclService)) as IOclService;
        userOCL := System.String.Format(selectUser,UserId,enPW);
        OCLResult := oclService.Evaluate(userOCL);
        Result := nil;
        if (OCLResult.GetAsCollection.Count <> 0) then
          Result := OCLResult.GetAsCollection.Item[0].AsObject as ForumMember;
        HttpContext.Current.Session['ForumMember'] := Result;
      end;

      end.

       

      发表于 @ 2007年05月16日 14:46:00|评论(loading...)|编辑

      新一篇: 《Delphi MDA/DDA程序设计——使用ECO》一书已到台湾(繁体版4月16号博客) | 旧一篇: 生日快乐,师大附中!(繁体版4月15日博客)

      评论:没有评论。

      发表评论  


      当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
      Csdn Blog version 3.1a
      Copyright © 李维