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

            if (rowsCount > 0)
            {
                DTcms.Model.Vehicle model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DTcms.Model.Vehicle();
                    if (dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    model.PlateNumber = dt.Rows[n]["PlateNumber"].ToString();
                    model.Driver      = dt.Rows[n]["Driver"].ToString();
                    model.LinkTel     = dt.Rows[n]["LinkTel"].ToString();
                    model.LinkAddress = dt.Rows[n]["LinkAddress"].ToString();
                    model.Remark      = dt.Rows[n]["Remark"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DTcms.Model.Vehicle model)
 {
     return(dal.Update(model));
 }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(DTcms.Model.Vehicle model)
 {
     return(dal.Add(model));
 }