示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <BookShop.Model.RoomType> DataTableToList(DataTable dt)
        {
            List <BookShop.Model.RoomType> modelList = new List <BookShop.Model.RoomType>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                BookShop.Model.RoomType model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new BookShop.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() != "")
                    {
                        model.AddBed = int.Parse(dt.Rows[n]["AddBed"].ToString());
                    }
                    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);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BookShop.Model.RoomType model)
 {
     dal.Update(model);
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(BookShop.Model.RoomType model)
 {
     return(dal.Add(model));
 }