?? interguestbook.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Model;
using IDAL;
/// <summary>
/// guestbook中間業務層
/// </summary>
public class InterGuestbook //: Iguestbook
{
public InterGuestbook()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
//得到留言列表內容
public guestbook [] getListGuestBook()
{
// (new DriveGuestbook()).drive().getListGuestBook();
// 反射類 相應驅動 接口方法
return (new DriveGuestbook()).drive().getListGuestBook();//通過接口調用數據訪問層
}
//得到一條留言
public guestbook [] only(string id)
{
return (new DriveGuestbook()).drive().getOnly(id);
}
//添加留言內容
public void setGuestBook(string name,string email,string content,string pic)
{
guestbook gb = new guestbook();
if (name == string.Empty)
{
gb.Name = "匿名";
}
else
{
gb.Name = ReplaceString.Replace(name);
}
if (email == string.Empty)
{
gb.Email = "無";
}
else
{
gb.Email = email ;
}
gb.Content = ReplaceString.Replace(content);
gb.Ip = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
gb.Pic = "../App_Themes/Default/images/" + face(pic);
gb.Time = DateTime.Now;
(new DriveGuestbook()).drive().setGuestBook(gb);
}
/// <summary>
/// 留言頭像
/// </summary>
/// <param name="pic"></param>
/// <returns></returns>
private string face(string pic)
{
switch (pic)
{
case "face1": return "1.gif";
case "face2": return "2.gif";
case "face3": return "3.gif";
case "face4": return "4.gif";
case "face5": return "5.gif";
}
return "1.gif";
}
//回復留言
public void setReGuestBook(string content,string id)
{
guestbook gb = new guestbook();
gb.Recontent ="<hr /><font color='#FF0000'>管理員回復:</font>"+ReplaceString.Replace(content);
gb.Id = id;
(new DriveGuestbook()).drive().setReGuestBook(gb);
}
//刪除留言
public bool delGuestBook(string id)
{
return (new DriveGuestbook ()).drive ().delGuestBook (id);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -