温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net简单公文流转系统(MVC)源码
当前文件:
GongWenLiuZhuan/App_Code/BusinessLogicLayer/File.cs[5K,2009-6-12 11:43:27],打开代码结构图
GongWenLiuZhuan/App_Code/BusinessLogicLayer/File.cs[5K,2009-6-12 11:43:27],打开代码结构图1using System; 2
using System.Data; 3
using System.Collections; 4
5
using MyOA.DataAccessLayer; 6
using MyOA.DataAccessHelper; 7
using MyOA.CommonComponent; 8
//该源码下载自www.51aspx.com(51aspx.com) 9
10
11
namespace MyOA.BusinessLogicLayer 12
...{ 13
/**//// <summary> 14
/// File 的摘要说明。 15
/// </summary> 16
public class File 17
...{ 18
私有成员#region 私有成员 19
20
private int _fileId; //公文Id 21
private string _fileTitle; //公文标题 22
private string _fileContent; //公文正文 23
private string _fromUserName; //公文撰写者 24
private string _toUserName; //公文接收者 25
private int _fileStatusId; //公文状态编号 26
private string _fileStatusName; //公文状态 27
private string _affixFile; //附件 28
29
private bool _exist; //是否存在标志 30
31
#endregion 私有成员 32
33
属性#region 属性 34
35
public int FileId 36
...{ 37
set 38
...{ 39
this._fileId=value; 40
} 41
get 42
...{ 43
return this._fileId; 44
} 45
} 46
public string FileTitle 47
...{ 48
set 49
...{ 50
this._fileTitle=value; 51
} 52
get 53
...{ 54
return this._fileTitle; 55
} 56
} 57
public string FileContent 58
...{ 59
set 60
...{ 61
this._fileContent=value; 62
} 63
get 64
...{ 65
return this._fileContent; 66
} 67
} 68
public string FromUserName 69
...{ 70
set 71
...{ 72
this._fromUserName=value; 73
} 74
get 75
...{ 76
return this._fromUserName; 77
} 78
} 79
public string ToUserName 80
...{ 81
set 82
...{ 83
this._toUserName=value; 84
} 85
get 86
...{ 87
return this._toUserName; 88
} 89
} 90
public int FileStatusId 91
...{ 92
set 93
...{ 94
this._fileStatusId=value; 95
} 96
get 97
...{ 98
return this._fileStatusId; 99
} 100
} 101
public string FileStatusName 102
...{ 103
set 104
...{ 105
this._fileStatusName=value; 106
} 107
get 108
...{ 109
return this._fileStatusName; 110
} 111
} 112
public string AffixFile 113
...{ 114
set 115
...{ 116
this._affixFile=value; 117
} 118
get 119
...{ 120
return this._affixFile; 121
} 122
} 123
public bool Exist 124
...{ 125
get 126
...{ 127
return this._exist; 128
} 129
} 130
131
#endregion 属性 132
133
方法#region 方法 134
135
/**//// <summary> 136
/// 根据参数fileId,获取公文详细信息 137
/// </summary> 138
/// <param name="fileId">公文ID</param> 139
public void LoadData(int fileId) 140
...{ 141
Database db=new Database(); //实例化一个Database类 142
143
string sql=""; 144
sql="Select * from [File],[FileStatus] where FileId = "+fileId 145
+" And [File].FileStatus=[FileStatus].FileStatusId"; 146
147
DataRow dr=db.GetDataRow(sql); //利用Database类的GetDataRow方法查询公文数据 148
149
//根据查询得到的数据,对成员赋值 150
if(dr!=null) 151
...{ 152
this._fileId=GetSafeData.ValidateDataRow_N(dr,"FileID"); 153
this._fileTitle=GetSafeData.ValidateDataRow_S(dr,"FileTitle"); 154
this._fileContent=GetSafeData.ValidateDataRow_S(dr,"FileContent"); 155
this._fromUserName=GetSafeData.ValidateDataRow_S(dr,"FromUserName"); 156
this._toUserName=GetSafeData.ValidateDataRow_S(dr,"ToUserName"); 157
this._fileStatusId=GetSafeData.ValidateDataRow_N(dr,"FileStatusId"); 158
this._fileStatusName=GetSafeData.ValidateDataRow_S(dr,"FileStatusName"); 159
this._affixFile=GetSafeData.ValidateDataRow_S(dr,"AffixFile"); 160
161
this._exist=true; 162
} 163
else 164
...{ 165
this._exist=false; 166
} 167
} 168
169
/**//// <summary> 170
/// 向数据库添加一个公文 171
/// </summary> 172
/// <param name="htUserInfo">公文信息哈希表</param> 173
public static void Add(Hashtable fileInfo) 174
...{ 175
Database db=new Database(); //实例化一个Database类 176
db.Insert("[File]",fileInfo ); //利用Database类的Insert方法添加公文数据 177
} 178
179
/**//// <summary> 180
/// 修改公文数据 181
/// </summary> 182
/// <param name="htUserInfo">公文信息哈希表</param> 183
public static void Update(Hashtable fileInfo,string where) 184
...{ 185
Database db=new Database(); //实例化一个Database类 186
db.Update("[File]",fileInfo,where); //利用Database类的Update方法修改公文数据 187
} 188
189
/**//// <summary> 190
/// 查询公文 191
/// </summary> 192
/// <param name="andQueryItems">“AND”子句查询条件哈希表</param> 193
/// <param name="orQueryItems">“OR”子句查询条件哈希表</param> 194
/// <returns>以DataTable形式返回查询结果数据</returns> 195
public static DataTable Query(Hashtable andQueryItems,Hashtable orQueryItems) 196
...{ 197
string whereAnd=SqlStringConstructor.GetConditionClause(andQueryItems,"AND"); 198
string whereOr=SqlStringConstructor.GetConditionClause(orQueryItems,"OR"); 199
200
if(whereOr!="") 201
whereOr+= " Or [File].ToUserName='全部' "; 202
else 203
whereOr+= " Where [File].ToUserName='全部' "; 204
205
string sql="Select * From [File],[FileStatus]"; 206
string where=""; 207
208
if(whereAnd=="" && whereOr=="") 209
...{ 210
where=" Where [File].FileStatus=[FileStatus].FileStatusId"; 211
} 212
else if(whereAnd=="" && whereOr!="") 213
...{ 214
where=whereOr +" And [File].FileStatus=[FileStatus].FileStatusId"; 215
} 216
else if(whereAnd!="" && whereOr=="") 217
...{ 218
where=whereAnd +" And [File].FileStatus=[FileStatus].FileStatusId"; 219
} 220
else 221
...{ 222
whereOr=whereOr.Remove(0,6); //去掉Where 223
where=whereAnd +" And ("+whereOr+") And [File].FileStatus=[FileStatus].FileStatusId"; 224
} 225
226
sql+=where+" "; 227
228
Database db = new Database(); 229
return db.GetDataTable(sql); 230
} 231
232
/**//// <summary> 233
/// 删除公文数据 234
/// </summary> 235
/// <param name="fileId">公文编号</param> 236
public static void Delete(int fileId) 237
...{ 238
Database db=new Database(); //实例化一个Database类 239
string sql="Delete from [File] Where [FileId] = "+fileId.ToString(); 240
db.ExecuteSQL(sql); 241
} 242
243
#endregion 方法 244
} 245
} 246






}