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

            if (rowsCount > 0)
            {
                Hownet.Model.KQ_UserInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.KQ_UserInfo();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    if (dt.Rows[n]["EmpID"] != null && dt.Rows[n]["EmpID"].ToString() != "")
                    {
                        model.EmpID = int.Parse(dt.Rows[n]["EmpID"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    if (dt.Rows[n]["Privilege"] != null && dt.Rows[n]["Privilege"].ToString() != "")
                    {
                        model.Privilege = int.Parse(dt.Rows[n]["Privilege"].ToString());
                    }
                    if (dt.Rows[n]["Password"] != null && dt.Rows[n]["Password"].ToString() != "")
                    {
                        model.Password = int.Parse(dt.Rows[n]["Password"].ToString());
                    }
                    if (dt.Rows[n]["enabled"] != null && dt.Rows[n]["enabled"].ToString() != "")
                    {
                        model.enabled = int.Parse(dt.Rows[n]["enabled"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hownet.Model.KQ_UserInfo model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.KQ_UserInfo model)
 {
     return(dal.Add(model));
 }