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

            if (rowsCount > 0)
            {
                CdHotelManage.Model.modes model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CdHotelManage.Model.modes();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["moshi_name"] != null && dt.Rows[n]["moshi_name"].ToString() != "")
                    {
                        model.moshi_name = dt.Rows[n]["moshi_name"].ToString();
                    }
                    if (dt.Rows[n]["Reanker"] != null && dt.Rows[n]["Reanker"].ToString() != "")
                    {
                        model.Reanker = dt.Rows[n]["Reanker"].ToString();
                    }
                    if (dt.Rows[n]["sort"] != null && dt.Rows[n]["sort"].ToString() != "")
                    {
                        model.sort = int.Parse(dt.Rows[n]["sort"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CdHotelManage.Model.modes model)
 {
     return(dal.Update(model));
 }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(CdHotelManage.Model.modes model)
 {
     return(dal.Add(model));
 }