⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parksettings.cs

📁 电子选课系统 电子选课系统电子选课系统电子选课系统
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;

namespace Park.Common
{

	public class UserView
	{
		public string Role;
		public string FirstIndex;
		public string SecondIndex;
		public string ThirdIndex;
		public string Content;
	}

	public class Task
	{
		public string IndexName;
		public string Content;
		public string ChildIndexName;
		public string Icon;
		public string Title;
	}


	/// <summary>
	/// ParkSettings 的摘要说明。
	/// </summary>
	public class ParkSettings
	{
		/// <summary>
		/// 用户视图
		/// </summary>
		public UserView View;
		
		/// <summary>
		/// 任务列表一、二、三
		/// </summary>
		public ArrayList FirstIndex = new ArrayList();
		public ArrayList SecondIndex = new ArrayList();
		public ArrayList ThirdIndex = new ArrayList();

		/// <summary>
		/// 得到当前的UserView
		/// </summary>
		/// <param name="role">用户角色</param>
		public ParkSettings(string role ,string childindex)
		{
			SqlConnection myConnection=Utils.GetConnection();

			SqlCommand myCommand = new SqlCommand("Login_Get_UserView", myConnection);

			// Mark the Command as a SPROC
			myCommand.CommandType = CommandType.StoredProcedure;

			// Add Parameters to SPROC
			SqlParameter Role = new SqlParameter("@role", SqlDbType.Char, 20);
			Role.Value = role;
			myCommand.Parameters.Add( Role );

			// Add Parameters to SPROC
			SqlParameter ChildIndex = new SqlParameter("@childindex", SqlDbType.VarChar, 50);
			if(childindex==null || childindex.Equals(""))
				ChildIndex.Value = "";
			else
				ChildIndex.Value = childindex;
			myCommand.Parameters.Add( ChildIndex );

			
			// Execute the command
			myConnection.Open();
			SqlDataReader result=myCommand.ExecuteReader();

			// Read the first resultset -- Desktop Tab Information
			if( result.Read() ) 
			{

				UserView userview = new UserView();
				userview.Role = result["Role"].ToString();
				userview.FirstIndex =  result["FirstIndex"].ToString();
				userview.SecondIndex = result["SecondIndex"].ToString();
				userview.ThirdIndex = result["ThirdIndex"].ToString();
				userview.Content = result["Content"].ToString();
				this.View = userview;
			}

			// Read the 2th result --  First Index Information
			result.NextResult();

			while( result.Read() )
			{
				Task task = new Task();
				task.IndexName = result["IndexName"].ToString();
				task.Title = result["Title"].ToString();
				task.Content = result["Content"].ToString();
				task.ChildIndexName = result["ChildIndexName"].ToString();
				task.Icon = result["Icon"].ToString();

				FirstIndex.Add(task);
			}

			// Read the 3th result --  Second Index Information
			result.NextResult();

			while( result.Read() )
			{
				Task task = new Task();
				task.IndexName = result["IndexName"].ToString();
				task.Title = result["Title"].ToString();
				task.Content = result["Content"].ToString();
				task.ChildIndexName = result["ChildIndexName"].ToString();
				task.Icon = result["Icon"].ToString();
				
				SecondIndex.Add(task);
			}

			// Read the 4th result --  First Index Information
			result.NextResult();

			while( result.Read() )
			{
				Task task = new Task();
				task.IndexName = result["IndexName"].ToString();
				task.Title = result["Title"].ToString();
				task.Content = result["Content"].ToString();
				task.ChildIndexName = result["ChildIndexName"].ToString();
				task.Icon = result["Icon"].ToString();
				
				ThirdIndex.Add(task);
			}

			result.Close();
			myCommand.Dispose();
			myConnection.Dispose();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -