温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:三层入门之留言板
当前文件:
JMWQZM6NWKG61/BLL/Rules/Messages.cs,打开代码结构图
JMWQZM6NWKG61/BLL/Rules/Messages.cs,打开代码结构图1using System; 2
using MessageBoard7.Classes; 3
using MessageBoard7.IDAL; 4
5
namespace MessageBoard7.RulesBLL 6
{ 7
/// <summary> 8
/// 留言逻辑规则处理类 9
/// </summary> 10
public class Messages 11
{ 12
public Messages() 13
{ 14
// 15
// TODO: 在此处添加构造函数逻辑 16
// 17
} 18
/// <summary> 19
/// 留言规则: 20
/// 1。只有早上6点到晚上23点才能留言 21
/// 2。当天留言总数超过20条就不能再留言 22
/// </summary> 23
/// <returns></returns> 24
public static bool IsAllowPost() 25
{ 26
int hour = DateTime.Now.Hour; 27
if(hour < 6 || hour > 23) 28
{ 29
return false; 30
} 31
DateTime today = DateTime.Today; 32
DateTime tomorrow = DateTime.Today.AddDays(1); 33
MessagesInfo[] messagesInfos = (new MessageBoard7.DALFactory.Messages()).Create().GetMessages(today, tomorrow); 34
if(messagesInfos != null && messagesInfos.Length >= 20) 35
{ 36
return false; 37
} 38
return true; 39
} 40
} 41
} 42





}