当前文件:
StudentManager/BLL/Affiche.cs[4K,2009-6-12 11:56:49],
打开代码结构图
1
using System;
2
using System.Web;
3
using System.Web.UI;
4
using System.Data;
5
using System.Web.Security;
6
using System.Web.UI.WebControls;
7
using System.Web.UI.HtmlControls;
8
using System.Data.SqlClient;
9
using StudentManager.IDAL;
10
using StudentManager.Common;
11
using StudentManager.DALFactory;
12
using StudentManager.Model;
13
14
业务逻辑层公告实体#region 业务逻辑层公告实体
15
namespace StudentManager.BLL
16
...{
17
/**//// <summary>
18
/// 业务逻辑层公告实体
19
/// 创建者:余洪
20
/// 时间:2008-3
21
/// </summary>
22
public class Affiche
23
...{
24
工厂实例化公告实体#region 工厂实例化公告实体
25
/**//// <summary>
26
/// 工厂实例化公告实体
27
/// </summary>
28
IAffiche affiche = DataAccess.CreateAffiche();
29
#endregion
30
31
绑定数据到页面数据控件#region 绑定数据到页面数据控件
32
/**//// <summary>
33
/// 绑定数据到页面数据控件
34
/// </summary>
35
/// <param name="gdvAffiche"></param>
36
public void BindAffiches(GridView gdvAffiche)
37
...{
38
gdvAffiche.DataSource = affiche.GetAffiches();
39
gdvAffiche.DataBind();
40
}
41
#endregion
42
43
绑定指定公告信息#region 绑定指定公告信息
44
/**//// <summary>
45
/// 绑定指定公告信息
46
/// </summary>
47
/// <param name="af_Id">公告编号</param>
48
/// <param name="dvAfficheDetails">详细控件</param>
49
/// <returns></returns>
50
public void BindAffiche(int af_Id,DetailsView dvAfficheDetails)
51
...{
52
dvAfficheDetails.DataSource=affiche.GetAffiche(af_Id);
53
dvAfficheDetails.DataBind();
54
}
55
#endregion
56
57
获取公告信息表#region 获取公告信息表
58
/**//// <summary>
59
/// 获取公告信息表
60
/// </summary>
61
/// <param name="af_Id">公告编号</param>
62
/// <returns>公告信息表</returns>
63
public DataTable GetAfficheTb(int af_Id)
64
...{
65
return affiche.GetAffiche(af_Id).Tables[0];
66
}
67
#endregion
68
69
发表公告信息#region 发表公告信息
70
/**//// <summary>
71
/// 发表公告信息
72
/// </summary>
73
/// <param name="afficheInf">公告实体</param>
74
public void Add_Affiche(AfficheInf afficheInf)
75
...{
76
if (afficheInf.Af_EnableTime < DateTime.Now)
77
...{
78
JScript.Alert("输入的有效日期小于了现在日期!");
79
}
80
else
81
...{
82
if (affiche.AddAffiche(afficheInf) == false)
83
...{
84
JScript.AlertAndRedirect("发表公告失败!", "AddAffiche.aspx");
85
}
86
else
87
...{
88
JScript.AlertAndRedirect("发表公告成功!", "AddAffiche.aspx");
89
}
90
}
91
}
92
#endregion
93
94
删除公告信息#region 删除公告信息
95
/**//// <summary>
96
/// 删除公告信息
97
/// </summary>
98
/// <param name="af_Id">公告编号</param>
99
/// <param name="dp_Id">部门ID</param>
100
/// <returns></returns>
101
public void DelAffiche(int af_Id, string dp_Id)
102
...{
103
int int_reault = affiche.DelAffiche(af_Id, dp_Id);
104
if (int_reault==-1)
105
...{
106
JScript.AlertAndRedirect("你没有权限!删除其他部门的公告信息.", "Default.aspx");
107
}
108
if(int_reault==0)
109
...{
110
JScript.AlertAndRedirect("公告信息删除失败,请重试!", "Default.aspx");
111
}
112
}
113
#endregion
114
115
返回公告的行#region 返回公告的行
116
/**//// <summary>
117
/// 返回公告的行
118
/// </summary>
119
/// <param name="af_Id">公告编号</param>
120
/// <param name="dp_Id">部门编号</param>
121
/// <returns></returns>
122
public void BindAfForUpdate(int af_Id, string dp_Id,TextBox txtAfTitle,TextBox txtAfContent,TextBox txt_Af_EnableTile)
123
...{
124
AfficheInf afficheInf = affiche.GetAfficheForUpdate(af_Id, dp_Id);
125
if (afficheInf != null)
126
...{
127
txtAfTitle.Text = afficheInf.Af_Title;
128
txtAfContent.Text = afficheInf.Af_Content;
129
txt_Af_EnableTile.Text = afficheInf.Af_EnableTime.ToString();
130
}
131
}
132
#endregion
133
134
修改公告信息#region 修改公告信息
135
/**//// <summary>
136
/// 修改公告信息
137
/// </summary>
138
/// <param name="afficheInf">公告实体</param>
139
/// <returns></returns>
140
public void UpdateAffiche(AfficheInf afficheInf)
141
...{
142
if (affiche.UpdateAffiche(afficheInf) == false)
143
...{
144
JScript.Alert("修改公告信息失败!");
145
}
146
else
147
...{
148
JScript.AlertAndRedirect("修改公告信息成功!","Default.aspx");
149
}
150
}
151
#endregion
152
153
}
154
}
155
#endregion
156