コード例 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Dianda.Model.Project_CarList> DataTableToList(DataTable dt)
        {
            List <Dianda.Model.Project_CarList> modelList = new List <Dianda.Model.Project_CarList>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Dianda.Model.Project_CarList model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Dianda.Model.Project_CarList();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.CarName    = dt.Rows[n]["CarName"].ToString();
                    model.DriverName = dt.Rows[n]["DriverName"].ToString();
                    model.CarNum     = dt.Rows[n]["CarNum"].ToString();
                    model.Infors     = dt.Rows[n]["Infors"].ToString();
                    if (dt.Rows[n]["DELFLAG"].ToString() != "")
                    {
                        model.DELFLAG = int.Parse(dt.Rows[n]["DELFLAG"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Dianda.Model.Project_CarList model)
 {
     dal.Update(model);
 }
コード例 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Dianda.Model.Project_CarList model)
 {
     return(dal.Add(model));
 }