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

            if (rowsCount > 0)
            {
                lgk.Model.tb_area model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new lgk.Model.tb_area();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["areaID"] != null && dt.Rows[n]["areaID"].ToString() != "")
                    {
                        model.areaID = dt.Rows[n]["areaID"].ToString();
                    }
                    if (dt.Rows[n]["area"] != null && dt.Rows[n]["area"].ToString() != "")
                    {
                        model.area = dt.Rows[n]["area"].ToString();
                    }
                    if (dt.Rows[n]["father"] != null && dt.Rows[n]["father"].ToString() != "")
                    {
                        model.father = dt.Rows[n]["father"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_area model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(lgk.Model.tb_area model)
 {
     dal.Add(model);
 }