⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 roomtypemanager.cs

📁 简单的酒店管理系统 c# +9 SQLserver 2
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using HotelManager.Models;
using HotelManager.DAL;
/****************************************
 * 类名: RoomTypeManager
 * 创建日期: 2007-9-15
 * 功能描述:提供客房分类信息业务逻辑处理
 * **************************************/
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">客房类型实体对象</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
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -