| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 865 人关注过本帖
标题:[讨论]初学者的Manager是否有改进的地方啊
只看楼主 加入收藏
liuminghui
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:2882
专家分:0
注 册:2007-1-26
收藏
 问题点数:0 回复次数:1 
[讨论]初学者的Manager是否有改进的地方啊

#region Page_load
/// <summary>
/// 初始化Page属性
/// </summary>
/// <param name="page">调用者Web Page</param>
public BookManager(Page page) : base(page)
{}

public BookManager(string itemName, Page page) : base(itemName,page)
{}

public BookManager() : base()
{}

public BookManager(string itemName) : base(itemName)
{}
#endregion Page_load

#region FetchBookInfo
/// <summary>r
/// 根据查询条件 返回用户查询的图书信息
/// 参数为查询条件,查询条件可选;
/// </summary>
/// <param name="book_name">书名</param>
/// <param name="author">作者</param>
/// <param name="publish_date">出版日期</param>
/// <param name="type_name">类别</param>
/// <param name="company_name">出版社</param>
/// <returns>DataTable</returns>
public DataTable FetchBookInfo(string book_name ,string type_name,string author,string company_name,string publish_date_min,string publish_date_max )
{
return Book.FetchBookInfo(this.DbSession , book_name , type_name, author, company_name, publish_date_min,publish_date_max);
}
#endregion FetchBookInfo

#region FetchBookType
/// <summary>
/// 查询C_BIO_BookType,返回所有图书类别
/// </summary>
/// <param name="dbSession"></param>
/// <returns></returns>
public DataTable FetchBookType()
{
return BookType.FetchBookType(this.DbSession);
}
#endregion FetchBookType

#region FetchPublishCompany
/// <summary>
/// 查询C_BIO_PublishCompany,返回所有出版社
/// </summary>
/// <param name="dbSession"></param>
/// <returns></returns>
public DataTable FetchPublishCompany()
{
return PublishCompany.FetchPublishCompany(this.DbSession);
}
#endregion FetchPublishCompany

#region FetchBookOnLendByUser
/// <summary>
/// 返回已借阅图书
/// </summary>
/// <param name="user_id"></param>
/// <returns>DataTable</returns>
public DataTable FetchBookOnLendByUser(string user_id)
{
return BookOutRecord.FetchOutRecord(this.DbSession,user_id);
}
#endregion FetchBookOnLendByUser

#region LockBookOnPreview
/// <summary>
/// 将图书添加至参数lockID指定的预览列表中
/// </summary>
/// <param name="bookID"></param>
/// <param name="lockID"></param>
public void LockBookOnPreview(string book_id, string lock_id)
{
string lock_time=DateTime.Now.ToString();

BookPreview.AddNewR_BIO_BookPreview(this.DbSession,lock_id,book_id,lock_time);
Book book = Book.GetInstance(this.DbSession ,book_id,true);
book.On_Lend ="N";
book.On_Preview ="Y";
book.Update();
}
#endregion LockBookOnPreview

#region UnLockBookOnPreview
/// <summary>
/// 取消指定的一组图书的预览状态
/// </summary>
/// <param name="book_id"></param>
public void UnLockBookOnPreview(string lock_id,string book_id)
{
//修改C_BIO_BOOK里面的预览状态
Book book = Book.GetInstance(this.DbSession,book_id,true);
book.On_Preview ="N";
book.Update();
}
#endregion UnLockBookOnPreview

#region UnLockBookOnPreview
/// <summary>
/// 取消指定的一组图书的预览状态
/// </summary>
/// <param name="book_id"></param>
public void UnLockBookOnPreview(string lock_id)
{
//删除R_BIO_BookPreview里面的预览状态
BookPreview bookPreview =BookPreview.GetInstance (this.DbSession,lock_id,true);
bookPreview.Delete();
}
#endregion UnLockBookOnPreview


#region FetchBookOnPreview
/// <summary>
/// 返回指定lockID的预览中的图书
/// </summary>
/// <param name="lock_id"></param>
/// <returns>DataTable</returns>
public DataTable FetchBookOnPreview(string lock_id)
{
return BookPreview.FetchBookByLockID(this.DbSession ,lock_id);
}
#endregion FetchBookOnPreview

#region CheckBookPreview
/// <summary>
/// Check指定图书的预览是否还在预览中
/// 会检查R_BIO_BookPreview中指定BookID的图书,
/// 若存在该图书资料,则表明该图书还在预览中
/// </summary>
/// <param name="bookID"></param>
/// <returns></returns>
public bool CheckBookPreview(string book_id,string lock_id)
{
BookPreview bookPreview=BookPreview.GetInstance(this.DbSession ,lock_id,false);
DataTable dt= bookPreview.FetchBookByBookID (this.DbSession,book_id);
if(dt.Rows.Count==0 )
{
return false;
}
else return true;
}
#endregion CheckBookPreview

#region CheckUserStatus
/// <summary>
/// Check用户在借图书(包括预览)数目是否超过限制(最多10本),
///若超过,则返回false
/// </summary>
/// <param name="userID"></param>
/// <param name="lockID"></param>
/// <returns></returns>
public bool CheckUserStatus(string user_id, string lock_id)
{
int bookOutCount = BookOutRecord.FetchOutRecord(this.DbSession ,user_id).Rows .Count;
//正在预览的书籍数目
int bookPreviewCount=BookPreview.FetchBookByLockID(this.DbSession ,lock_id).Rows.Count;
int bookSum=bookOutCount+bookPreviewCount;
if(bookSum<=10)
return true;
else
{
return false;
}

}
#endregion CheckUserStatus

#region LendBook
/// <summary>
/// 借阅图书:将指定LockID的预览中的图书借出
/// </summary>
/// <param name="lock_id"></param>
/// <param name="user_id"></param>
public void LendBook(string out_date,string dute_date,string out_time, string lock_id,string book_id, string user_id)
{
BookPreview.DeleteByLockID(this.DbSession,lock_id);

out_date=DateTime.Now.ToString();
dute_date=DateTime.Now.AddDays(10).ToString();
out_time=DateTime.Now.TimeOfDay.ToString();

//修改图书的预览状态
Book book = Book.GetInstance(this.DbSession , book_id, true );
book.On_Lend= "Y";
book.On_Preview= "N";
book.Update();

//删除BookOutRecord对象
BookOutRecord bookOutRecord=BookOutRecord.GetInstance(this.DbSession ,user_id,false);
bookOutRecord.Book_Id=book_id;
bookOutRecord.User_Id=user_id;
bookOutRecord.Out_Date =DateTime.Parse(out_date);
bookOutRecord.Dute_Date =DateTime.Parse(dute_date);
bookOutRecord.Out_Time=DateTime.Parse(out_time);
bookOutRecord.Insert();
}
#endregion LendBook

#region RecallBook
/// <summary>
/// 用户归还图书
/// </summary>
/// <param name="book_id"></param>
/// <param name="userID"></param>
public void RecallBook(string book_id, string user_id)
{

string in_date=DateTime.Now.Date.ToString();
string in_time=DateTime.Now.TimeOfDay .ToString();

//修改图书的借阅和预览状态
Book book = Book.GetInstance(this.DbSession , book_id, true );
book.On_Lend= "N";
book.On_Preview= "N";
book.Update();

BookInRecord bookInRecord=BookInRecord.GetInstance(this.DbSession ,false);
bookInRecord.User_Id =user_id;
bookInRecord.Book_Id=book_id;
bookInRecord.In_Date =DateTime.Parse(in_date);
bookInRecord.In_Time=DateTime.Parse(in_time);
bookInRecord.Insert();

BookOutRecord bookOutRecod=BookOutRecord.GetInstance(this.DbSession,user_id,true);
bookOutRecod.Book_Id=book_id;
bookOutRecod.User_Id=user_id;
bookOutRecod.Delete();

}
#endregion RecallBook

#region FetchPopularity
/// <summary>
/// 得到图书排行榜
/// </summary>
/// <returns></returns>
public DataTable FetchPopularity()
{
return library.Entity.BookPopularity.FetchPopularity(this.DbSession);
}
#endregion FetchPopularity

#region FetchBookIntroduction
/// <summary>
/// 得到图书的简介
/// </summary>
/// <param name="dbSession"></param>
/// <param name="book_id"></param>
/// <returns></returns>
public DataTable FetchBookIntroduction(string book_id )
{
return Book.FetchBookIntroduction(this.DbSession,book_id);
}
#endregion FetchBookIntroduction

#region FetchBookIDByLockID
/// <summary>
///
/// </summary>
/// <param name="lock_id">lock_id</param>
/// <returns>DataTable</returns>
public DataTable FetchBookIDByLockID(string lock_id )
{
return BookPreview.FetchBookIDByLockID(this.DbSession,lock_id);
}
#endregion FetchBookIDByLockID

搜索更多相关主题的帖子: Manager base public page 
2007-09-28 10:13
dgwdgw
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2006-12-31
收藏
得分:0 
这个用C#编的吗?看不明白,最好发个VBNET的
2007-10-04 10:12
快速回复:[讨论]初学者的Manager是否有改进的地方啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016975 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved