Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <zs.Model.Tbl_Flex> DataTableToList(DataTable dt)
        {
            List <zs.Model.Tbl_Flex> modelList = new List <zs.Model.Tbl_Flex>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                zs.Model.Tbl_Flex model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new zs.Model.Tbl_Flex();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["keyName"] != null && dt.Rows[n]["keyName"].ToString() != "")
                    {
                        model.keyName = dt.Rows[n]["keyName"].ToString();
                    }
                    if (dt.Rows[n]["keyValue"] != null && dt.Rows[n]["keyValue"].ToString() != "")
                    {
                        model.keyValue = dt.Rows[n]["keyValue"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(zs.Model.Tbl_Flex model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(zs.Model.Tbl_Flex model)
 {
     return(dal.Add(model));
 }