TEcoForumServices 类(繁体版4月15日博客)
来源:互联网 发布:发网络短信 编辑:程序博客网 时间:2024/05/06 22:17
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.
- TEcoForumServices 类(繁体版4月15日博客)
- TEcoForumServices 类(繁体版4月15日博客)
- TEcoForumServices 类(繁体版4月15日博客)
- TEcoForumServices 类(繁体版4月15日博客)
- TEcoForumServices 类(繁体版4月15日博客)
- 生日快乐,师大附中!(繁体版4月15日博客)
- 生日快乐,师大附中!(繁体版4月15日博客)
- 《Delphi MDA/DDA程序设计——使用ECO》一书已到台湾(繁体版4月16号博客)
- 《Delphi MDA/DDA程序设计——使用ECO》一书已到台湾(繁体版4月16号博客)
- C#中利用SMTPClient发送邮件 修改4月15日写的博客
- 2015年3月15日开始坚持博客
- 报到博客_2016年4月4日
- 2009年4月8日 博客改进公告!
- 2010年4月24日开通博客
- 4月17日参加博客园俱乐部活动
- CSDN博客2014年4月24日清理缓存
- 4月15日-5月15日工作总结
- 4月15日到4月21日学习计划
- 用XML实现弹出式菜单(附图)
- AIS解码算法
- NetCDF文件概要与读写
- ASP.NET File Upload Example
- RCP 集成 citrix 导致Text没有焦点光标
- TEcoForumServices 类(繁体版4月15日博客)
- AIS(自动识别系统)介绍
- Java开发人员的十大戒律
- 心跳防护程序
- 方便管理plugin或rcp的icons
- 遗憾,未能参加CSDN英雄会
- 显示上标与下标的函数
- Hello World:解剖 ASP.NET 项目
- 泛型与模式