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

            if (rowsCount > 0)
            {
                Hotel_app.Model.Hhyjf_jp_Class model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hotel_app.Model.Hhyjf_jp_Class();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["Title"] != null && dt.Rows[n]["Title"].ToString() != "")
                    {
                        model.Title = dt.Rows[n]["Title"].ToString();
                    }
                    if (dt.Rows[n]["yydh"] != null && dt.Rows[n]["yydh"].ToString() != "")
                    {
                        model.yydh = dt.Rows[n]["yydh"].ToString();
                    }
                    if (dt.Rows[n]["qymc"] != null && dt.Rows[n]["qymc"].ToString() != "")
                    {
                        model.qymc = dt.Rows[n]["qymc"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hotel_app.Model.Hhyjf_jp_Class model)
 {
     return(dal.Update(model));
 }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hotel_app.Model.Hhyjf_jp_Class model)
 {
     return(dal.Add(model));
 }