?? roomtypemanager.cs
字號:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using HotelManager.Models;
using HotelManager.DAL;
/****************************************
* 類名: RoomTypeManager
* 創(chuàng)建日期: 2007-9-15
* 功能描述:提供客房分類信息業(yè)務(wù)邏輯處理
* **************************************/
namespace HotelManager.BLL
{
public class RoomTypeManager
{
#region Private Members
RoomTypeService roomTypeService = new RoomTypeService();
private static RoomType roomType = new RoomType();
#endregion
#region Public Methods
/// <summary>
/// 通過客房類型名稱得到客房類型ID
/// </summary>
/// <param name="typeName">類型名稱</param>
/// <returns>客房類型ID</returns>
public int GetRoomTypeIDByTypeName(string typeName)
{
try
{
return roomTypeService.GetRoomTypeIDByTypeName(typeName);
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}
/// <summary>
/// 得到客房類型名稱
/// </summary>
/// <returns></returns>
public IList GetRoomTypeName()
{
try
{
return roomTypeService.GetRoomTypeName();
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}
/// <summary>
/// 得到客房價格
/// </summary>
/// <param name="typeName">類型名稱</param>
/// <returns></returns>
public string GetRoomPriceByTypeName(string typeName)
{
try
{
return roomTypeService.GetTypePriceByTypeName(typeName);
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}
/// <summary>
/// 通過客房類型ID得到客房類型
/// </summary>
/// <param name="typeID">類型ID</param>
/// <returns></returns>
public RoomType GetRoomTypeByTypeID(int typeID)
{
try
{
return roomTypeService.GetRoomTypeByTypeID(typeID);
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}
/// <summary>
/// 得到客房類型信息列表
/// </summary>
/// <returns></returns>
public IList<RoomType> GetRoomTypeList()
{
try
{
return roomTypeService.GetRoomTypeList();
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}
/// <summary>
/// 新增客房類型信息
/// </summary>
/// <param name="roomType">客房類型實(shí)體對象</param>
/// <returns></returns>
public string SaveRoomType(RoomType roomType)
{
//返回信息
string message = string.Empty;
//客房類型ID
int typeID;
//客房類型名稱
string typeName = string.Empty;
try
{
typeName = roomType.TypeName;
typeID = roomTypeService.GetRoomTypeIDByTypeName(typeName);
if (typeID != 0)
{
//修改客房類型信息
roomType.TypeId = typeID;
roomTypeService.ModifyRoomType(roomType);
message = "類型信息更新成功!";
}
else
{
typeID = roomTypeService.AddRoomType(roomType);
if (typeID > 0)
message = "類型信息錄入成功!";
else
message = "類型信息錄入失敗!";
}
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
return message;
}
/// <summary>
/// 刪除客房類型信息
/// </summary>
/// <param name="typeID">類型ID</param>
public void DeleteRoomType(int typeID)
{
try
{
roomTypeService.DeleteRoomType(typeID);
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}
/// <summary>
/// 通過類型名稱得到類型列表
/// </summary>
/// <param name="typeName">類型名稱</param>
/// <returns></returns>
public IList<RoomType> GetRoomTypeListByTypeName(string typeName)
{
try
{
return roomTypeService.GetRoomTypeListByTypeName(typeName);
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
}
#endregion
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -