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

            if (rowsCount > 0)
            {
                zlzw.Model.AdminListModel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new zlzw.Model.AdminListModel();
                    if (dt.Rows[n]["AdminID"] != null && dt.Rows[n]["AdminID"].ToString() != "")
                    {
                        model.AdminID = int.Parse(dt.Rows[n]["AdminID"].ToString());
                    }
                    if (dt.Rows[n]["AdminGUID"] != null && dt.Rows[n]["AdminGUID"].ToString() != "")
                    {
                        model.AdminGUID = new Guid(dt.Rows[n]["AdminGUID"].ToString());
                    }
                    if (dt.Rows[n]["AdminName"] != null && dt.Rows[n]["AdminName"].ToString() != "")
                    {
                        model.AdminName = dt.Rows[n]["AdminName"].ToString();
                    }
                    if (dt.Rows[n]["AdminPassword"] != null && dt.Rows[n]["AdminPassword"].ToString() != "")
                    {
                        model.AdminPassword = dt.Rows[n]["AdminPassword"].ToString();
                    }
                    if (dt.Rows[n]["IsEnable"] != null && dt.Rows[n]["IsEnable"].ToString() != "")
                    {
                        model.IsEnable = int.Parse(dt.Rows[n]["IsEnable"].ToString());
                    }
                    if (dt.Rows[n]["PublishDate"] != null && dt.Rows[n]["PublishDate"].ToString() != "")
                    {
                        model.PublishDate = DateTime.Parse(dt.Rows[n]["PublishDate"].ToString());
                    }
                    if (dt.Rows[n]["Other01"] != null && dt.Rows[n]["Other01"].ToString() != "")
                    {
                        model.Other01 = dt.Rows[n]["Other01"].ToString();
                    }
                    if (dt.Rows[n]["Other02"] != null && dt.Rows[n]["Other02"].ToString() != "")
                    {
                        model.Other02 = dt.Rows[n]["Other02"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(zlzw.Model.AdminListModel model)
 {
     return(dal.Update(model));
 }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(zlzw.Model.AdminListModel model)
 {
     return(dal.Add(model));
 }