温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(ExtJs)源码
当前文件:
MyHotelManager/HotelDAL/RoomDAO.cs,打开代码结构图
MyHotelManager/HotelDAL/RoomDAO.cs,打开代码结构图1using System; 2
using System.Collections.Generic; 3
using System.Text; 4
using System.Data; 5
using System.Data.SqlClient; 6
using HotelModels; 7
//该源码首发自www.51aspx.com(51aspx.com) 8
9
namespace HotelDAL 10
{ 11
public class RoomDAO 12
{ 13
14
SqlHelper sh = new SqlHelper(); 15
DataSet ds; 16
private SqlParameter para; //参数 17
18
19
/// <summary> 20
/// 根据类型Id查询所有客房信息(状态为空闲) 21
/// </summary> 22
/// <param name="TypeId"></param> 23
/// <returns></returns> 24
public DataSet GetRoomByTypeId(int TypeId) 25
{ 26
try 27
{ 28
SqlParameter[] sp ={ 29
para = new SqlParameter("@TypeId",TypeId) 30
}; 31
ds = sh.GetDataSet("GetRoomByTypeId", sp); 32
} 33
catch (Exception ex) 34
{ 35
throw ex; 36
} 37
return ds; 38
} 39
40
41
/// <summary> 42
/// 添加客房表 43
/// </summary> 44
/// <param name="rb"></param> 45
/// <returns></returns> 46
public int AddRoom(RoomBean rb) 47
{ 48
int count = 0; 49
try 50
{ 51
SqlParameter[] sp ={ 52
para = new SqlParameter("@Number",rb.Number), 53
para = new SqlParameter("@BedNumber",rb.BedNumber), 54
para = new SqlParameter("@TypeId",rb.TypeId), 55
para = new SqlParameter("@StateId",rb.StateId), 56
para = new SqlParameter("@Remark",rb.Remark) 57
}; 58
count = sh.RunSql("AddRoom", sp); 59
} 60
catch (Exception ex) 61
{ 62
throw ex; 63
} 64
return count; 65
} 66
67
68
69
/// <summary> 70
/// 查询所有客房信息(查看客房信息用到,带搜索) 71
/// </summary> 72
/// <param name="message"></param> 73
/// <returns></returns> 74
public DataSet GetAllRoom(string message) 75
{ 76
try 77
{ 78
SqlParameter[] sp ={ 79
para = new SqlParameter("@message",message) 80
}; 81
ds = sh.GetDataSet("GetAllRoom", sp); 82
} 83
catch (Exception ex) 84
{ 85
throw ex; 86
} 87
return ds; 88
} 89
90
91
/// <summary> 92
/// 查询所有状态为空闲的房间(删除客房时用到) 93
/// </summary> 94
/// <returns></returns> 95
public DataSet GetRoom() 96
{ 97
try 98
{ 99
ds = sh.GetDataSet("GetRoom"); 100
} 101
catch (Exception ex) 102
{ 103
throw ex; 104
} 105
return ds; 106
} 107
108
109
/// <summary> 110
/// 删除客房表(根据房间编号) 111
/// </summary> 112
/// <param name="Number"></param> 113
/// <returns></returns> 114
public int DelRoom(string Number) 115
{ 116
int count = 0; 117
try 118
{ 119
SqlParameter[] sp ={ 120
para = new SqlParameter("@Number",Number) 121
}; 122
count = sh.RunSql("DelRoom", sp); 123
} 124
catch (Exception ex) 125
{ 126
throw ex; 127
} 128
return count; 129
} 130
} 131
} 132





}