private static AdminGroupInfo LoadAdminGroupInfo(DataRow dr) { AdminGroupInfo admingroup = new AdminGroupInfo(); admingroup.Admingid = short.Parse(dr["admingid"].ToString()); admingroup.Alloweditpost = byte.Parse(dr["alloweditpost"].ToString()); admingroup.Alloweditpoll = byte.Parse(dr["alloweditpoll"].ToString()); return admingroup; }
/// <summary> /// 获得到指定管理组信息 /// </summary> /// <returns>管理组信息</returns> public static AdminGroupInfo[] GetAdminGroupList() { DataTable dt = DatabaseProvider.GetInstance().GetAdminGroupList(); AdminGroupInfo[] admingroupArray = new AdminGroupInfo[dt.Rows.Count]; int Index = 0; foreach (DataRow dr in dt.Rows) { admingroupArray[Index] = LoadAdminGroupInfo(dr); Index++; } dt.Dispose(); return admingroupArray; }
/// <summary> /// 设置管理组信息 /// </summary> /// <param name="admingroupsInfo">管理组信息</param> /// <returns>更改记录数</returns> public static int SetAdminGroupInfo(AdminGroupInfo admingroupsInfo) { return DatabaseProvider.GetInstance().SetAdminGroupInfo(admingroupsInfo); }
/// <summary> /// 创建一个新的管理组信息 /// </summary> /// <param name="__admingroupsInfo">要添加的管理组信息</param> /// <returns>更改记录数</returns> public int CreateAdminGroupInfo(AdminGroupInfo adminGroupsInfo) { DbParameter[] parms = { DbHelper.MakeInParam("@admingid",(DbType)OleDbType.SmallInt,2,adminGroupsInfo.Admingid), DbHelper.MakeInParam("@alloweditpost",(DbType)OleDbType.TinyInt,1,adminGroupsInfo.Alloweditpost), DbHelper.MakeInParam("@alloweditpoll",(DbType)OleDbType.TinyInt,1,adminGroupsInfo.Alloweditpoll) }; return DbHelper.ExecuteNonQuery(CommandType.StoredProcedure, string.Format("{0}createadmingroup", BaseConfigs.GetTablePrefix), parms); }