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

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