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

            if (rowsCount > 0)
            {
                Hotel_app.Model.Xyhsz model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hotel_app.Model.Xyhsz();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].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();
                    }
                    if (dt.Rows[n]["yhbl"] != null && dt.Rows[n]["yhbl"].ToString() != "")
                    {
                        model.yhbl = decimal.Parse(dt.Rows[n]["yhbl"].ToString());
                    }
                    if (dt.Rows[n]["yh"] != null && dt.Rows[n]["yh"].ToString() != "")
                    {
                        model.yh = dt.Rows[n]["yh"].ToString();
                    }
                    if (dt.Rows[n]["istop"] != null && dt.Rows[n]["istop"].ToString() != "")
                    {
                        if ((dt.Rows[n]["istop"].ToString() == "1") || (dt.Rows[n]["istop"].ToString().ToLower() == "true"))
                        {
                            model.istop = true;
                        }
                        else
                        {
                            model.istop = false;
                        }
                    }
                    if (dt.Rows[n]["isselect"] != null && dt.Rows[n]["isselect"].ToString() != "")
                    {
                        if ((dt.Rows[n]["isselect"].ToString() == "1") || (dt.Rows[n]["isselect"].ToString().ToLower() == "true"))
                        {
                            model.isselect = true;
                        }
                        else
                        {
                            model.isselect = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hotel_app.Model.Xyhsz model)
 {
     return(dal.Update(model));
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hotel_app.Model.Xyhsz model)
 {
     return(dal.Add(model));
 }