Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ZhangWei.Model.UserRight> DataTableToList(DataTable dt)
        {
            List <ZhangWei.Model.UserRight> modelList = new List <ZhangWei.Model.UserRight>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ZhangWei.Model.UserRight model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZhangWei.Model.UserRight();
                    if (dt.Rows[n]["UserId"] != null && dt.Rows[n]["UserId"].ToString() != "")
                    {
                        model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString());
                    }
                    if (dt.Rows[n]["Rights"] != null && dt.Rows[n]["Rights"].ToString() != "")
                    {
                        model.Rights = int.Parse(dt.Rows[n]["Rights"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ZhangWei.Model.UserRight model)
 {
     return(dal.Update(model));
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(ZhangWei.Model.UserRight model)
 {
     dal.Add(model);
 }