예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <SmartTeaching.Entity.Base_UserRole> DataTableToList(DataTable dt)
        {
            List <SmartTeaching.Entity.Base_UserRole> modelList = new List <SmartTeaching.Entity.Base_UserRole>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                SmartTeaching.Entity.Base_UserRole model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new SmartTeaching.Entity.Base_UserRole();
                    if (dt.Rows[n]["UserRoleId"].ToString() != "")
                    {
                        model.UserRoleId = int.Parse(dt.Rows[n]["UserRoleId"].ToString());
                    }
                    if (dt.Rows[n]["UserId"].ToString() != "")
                    {
                        model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString());
                    }
                    if (dt.Rows[n]["RoleId"].ToString() != "")
                    {
                        model.RoleId = int.Parse(dt.Rows[n]["RoleId"].ToString());
                    }
                    if (dt.Rows[n]["NewsTypeId"].ToString() != "")
                    {
                        model.NewsTypeId = int.Parse(dt.Rows[n]["NewsTypeId"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(SmartTeaching.Entity.Base_UserRole model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(SmartTeaching.Entity.Base_UserRole model)
 {
     dal.Add(model);
 }