?? customerstypedal.cs
字號(hào):
?using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using HotelManagerModels;
namespace HotelManagerDAL
{
public class CustomersTypeDAL
{
string strConn = ConfigurationManager.ConnectionStrings["HotelConn"].ToString();
#region 查詢用戶信息
/// <summary>
/// 查詢用戶信息
/// </summary>
/// <returns>返回實(shí)體</returns>
public List<CustomersType> SelectCustomersType()
{
using(SqlConnection conn=new SqlConnection(strConn))
{
SqlCommand cmd = new SqlCommand("usp_SelectCustomersTypeAll", conn);
cmd.CommandType = CommandType.StoredProcedure;
List<CustomersType> list = new List<CustomersType>();
try
{
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
CustomersType ct = new CustomersType();
ct.ID = Convert.ToInt32(dr["ID"]);
ct.Name = dr["Name"].ToString();
ct.CDiscount = Convert.ToSingle(dr["CDiscount"]);
list.Add(ct);
}
return list;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
conn.Close();
}
}
}
#endregion
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -