代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
CSharp
】
调用DominoAPI连接LOTUS Domino的类
作者:
Dezai.CN
/ 发布于
2012/12/21
/
602
调用DominoAPI连接LOTUS Domino的类
1: using System; 2: using System.Data; 3: 4: namespace LotusDbLink 5: { 6: public class LotusDB 7: { 8: private string _userName; 9: private string _password; 10: private string _server; 11: private string _databaseName; 12: private string _lotusView; 13: 14: private string _fieldSet; 15: 16: 17: public string UserName 18: { 19: get { return _userName; } 20: set { _userName = value; } 21: } 22: 23: public string Password 24: { 25: get { return _password; } 26: set { _password = value; } 27: } 28: 29: public string Server 30: { 31: get { return _server; } 32: set { _server = value; } 33: } 34: 35: public string DatabaseName 36: { 37: get { return _databaseName; } 38: set { _databaseName = value; } 39: } 40: 41: public string LotusView 42: { 43: get { return _lotusView; } 44: set { _lotusView = value; } 45: } 46: 47: public string FieldSet 48: { 49: get { return _fieldSet; } 50: set { _fieldSet = value; } 51: } 52: 53: 54: public DataTable GetDataTable() 55: { 56: DataTable dataTable = new DataTable(_lotusView); 57: Domino.NotesSession s = new Domino.NotesSession(); 58: 59: s.InitializeUsingNotesUserName(_userName, _password); 60: Domino.NotesDatabase db; 61: Domino.NotesView vw; 62: Domino.NotesDocument doc; 63: db = s.GetDatabase(_server, _databaseName, false); 64: if (db != null) 65: { 66: vw = db.GetView(_lotusView); 67: doc = vw.GetFirstDocument(); 68: string[] FieldSetTemp = FieldSet.Split(','); 69: for (int i = 0; i < FieldSetTemp.Length; i++) 70: { 71: DataColumn dc = new DataColumn(FieldSetTemp[i], Type.GetType("System.String")); 72: dataTable.Columns.Add(dc); 73: } 74: 75: while (doc != null) 76: { 77: DataRow dr = dataTable.NewRow(); 78: for (int i = 0; i < FieldSetTemp.Length; i++) 79: { 80: dr[FieldSetTemp[i]] = doc.GetFirstItem(FieldSetTemp[i]).Text; 81: } 82: dataTable.Rows.Add(dr); 83: doc = vw.GetNextDocument(doc); 84: } 85: } 86: 87: return dataTable; 88: } 89: 90: public DataTable GetDataTable(int index, int count) 91: { 92: DataTable dataTable = new DataTable(_lotusView); 93: Domino.NotesSession s = new Domino.NotesSession(); 94: 95: s.InitializeUsingNotesUserName(_userName, _password); 96: Domino.NotesDatabase db; 97: Domino.NotesView vw; 98: Domino.NotesDocument doc; 99: db = s.GetDatabase(_server, _databaseName, false); 100: if (db != null) 101: { 102: vw = db.GetView(_lotusView); 103: doc = vw.GetFirstDocument(); 104: string[] FieldSetTemp = FieldSet.Split(','); 105: for (int i = 0; i < FieldSetTemp.Length; i++) 106: { 107: DataColumn dc = new DataColumn(FieldSetTemp[i], Type.GetType("System.String")); 108: dataTable.Columns.Add(dc); 109: } 110: 111: int c = 0; 112: while (doc != null) 113: { 114: if (c < index) 115: { 116: doc = vw.GetNextDocument(doc); 117: continue; 118: } 119: DataRow dr = dataTable.NewRow(); 120: for (int i = 0; i < FieldSet.Length; i++) 121: { 122: dr[FieldSetTemp[i]] = doc.GetFirstItem(FieldSetTemp[i]).Text; 123: } 124: dataTable.Rows.Add(dr); 125: doc = vw.GetNextDocument(doc); 126: c++; 127: if (c > count) break; 128: } 129: } 130: 131: return dataTable; 132: } 133: 134: } 135: } 136: 137: 138: 使用方法(实例为WebService中的方法) 139: 140: [WebMethod(Description = "获取视图的方法,返回一个DataTable结构,以下为各参数说明:username = 用户名password = 密码databasename = 文档库名lotusview = 视图名fieldset = 视图字段(用','分割)")] 141: public System.Data.DataTable GetLotusTable(string username, string password, string server, string databasename, string lotusview, string fieldset) 142: { 143: LotusDbLink.LotusDB ldb = new LotusDbLink.LotusDB(); 144: ldb.UserName = username; 145: ldb.Password = password; 146: ldb.Server = server; 147: ldb.DatabaseName = databasename; 148: ldb.LotusView = lotusview; 149: ldb.FieldSet = fieldset; 150: return ldb.GetDataTable(); 151: } 152: 153: [WebMethod(Description = "获取视图前N项的方法,返回一个DataTable结构,以下为各参数说明:username = 用户名password = 密码databasename = 文档库名lotusview = 视图名fieldset = 视图字段(用','分割)index = 开始索引count = 前N项")] 154: public System.Data.DataTable GetLotusTableCount(string username, string password, string server, string databasename, string lotusview, string fieldset, int index, int count) 155: { 156: LotusDbLink.LotusDB ldb = new LotusDbLink.LotusDB(); 157: ldb.UserName = username; 158: ldb.Password = password; 159: ldb.Server = server; 160: ldb.DatabaseName = databasename; 161: ldb.LotusView = lotusview; 162: ldb.FieldSet = fieldset; 163: return ldb.GetDataTable(index, count); 164: }
试试其它关键字
同语言下
.
文件IO 操作类库
.
Check图片类型[JPEG(.jpg 、.jpeg),TIF,GIF,BMP,PNG,P
.
机器名和IP取得(IPV4 IPV6)
.
Tiff转换Bitmap
.
linqHelper
.
MadieHelper.cs
.
RegHelper.cs
.
如果关闭一个窗体后激活另一个窗体的事件或方法
.
创建日志通用类
.
串口辅助开发类
可能有用的
.
文件IO 操作类库
.
Check图片类型[JPEG(.jpg 、.jpeg),TIF,GIF,BMP,PNG,P
.
机器名和IP取得(IPV4 IPV6)
.
Tiff转换Bitmap
.
linqHelper
.
MadieHelper.cs
.
RegHelper.cs
.
如果关闭一个窗体后激活另一个窗体的事件或方法
.
创建日志通用类
.
串口辅助开发类
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3