Ejemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <GSSModel.Roles> DataTableToList(DataTable dt)
        {
            List <GSSModel.Roles> modelList = new List <GSSModel.Roles>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                GSSModel.Roles model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new GSSModel.Roles();
                    if (dt.Rows[n]["F_RoleID"].ToString() != "")
                    {
                        model.F_RoleID = int.Parse(dt.Rows[n]["F_RoleID"].ToString());
                    }
                    model.F_RoleName = dt.Rows[n]["F_RoleName"].ToString();
                    if (dt.Rows[n]["F_IsUsed"].ToString() != "")
                    {
                        if ((dt.Rows[n]["F_IsUsed"].ToString() == "1") || (dt.Rows[n]["F_IsUsed"].ToString().ToLower() == "true"))
                        {
                            model.F_IsUsed = true;
                        }
                        else
                        {
                            model.F_IsUsed = false;
                        }
                    }
                    model.F_Power = dt.Rows[n]["F_Power"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GSSModel.Roles model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(GSSModel.Roles model)
 {
     return(dal.Add(model));
 }