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

            if (rowsCount > 0)
            {
                ims.Model.User model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ims.Model.User();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.UserName = dt.Rows[n]["UserName"].ToString();
                    model.RealName = dt.Rows[n]["RealName"].ToString();
                    model.UserPwd  = dt.Rows[n]["UserPwd"].ToString();
                    if (dt.Rows[n]["Role"].ToString() != "")
                    {
                        model.Role = int.Parse(dt.Rows[n]["Role"].ToString());
                    }
                    model.IsAdmin = dt.Rows[n]["IsAdmin"].ToString();
                    model.Email   = dt.Rows[n]["Email"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        //public int Add(ims.Model.User model)
        //{
        //    return ims.DAL
        //        ims.dal.Add(model);
        //}

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ims.Model.User model)
        {
            return(dal.Update(model));
        }