/// <summary>
/// 获得数据列表
/// </summary>
public List<HotelManager.Model.RoomType> DataTableToList(DataTable dt)
{
List<HotelManager.Model.RoomType> modelList = new List<HotelManager.Model.RoomType>();
int rowsCount = dt.Rows.Count;
if (rowsCount > 0)
{
HotelManager.Model.RoomType model;
for (int n = 0; n < rowsCount; n++)
{
model = new HotelManager.Model.RoomType();
if(dt.Rows[n]["TypeId"].ToString()!="")
{
model.TypeId=int.Parse(dt.Rows[n]["TypeId"].ToString());
}
model.TypeName=dt.Rows[n]["TypeName"].ToString();
if(dt.Rows[n]["Price"].ToString()!="")
{
model.Price=decimal.Parse(dt.Rows[n]["Price"].ToString());
}
if(dt.Rows[n]["AddBed"].ToString()!="")
{
if((dt.Rows[n]["AddBed"].ToString()=="1")||(dt.Rows[n]["AddBed"].ToString().ToLower()=="true"))
{
model.AddBed=true;
}
else
{
model.AddBed=false;
}
}
if(dt.Rows[n]["BedPrice"].ToString()!="")
{
model.BedPrice=decimal.Parse(dt.Rows[n]["BedPrice"].ToString());
}
model.Remark=dt.Rows[n]["Remark"].ToString();
modelList.Add(model);
}
}
return modelList;
}