亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? votingutility.cs

?? 非常不錯(cuò)的學(xué)校在線考試分析系統(tǒng)
?? CS
?? 第 1 頁 / 共 2 頁
字號(hào):
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web;
using System.Web.Caching;
using ASPNET.StarterKit.Communities;

namespace ASPNET.StarterKit.Communities {
	/// <summary>
	/// Sort direction for managing poll choices.
	/// </summary>
	public enum PollChoiceDirection {
		Up,
		Down
	}

	/// <summary>
	/// Utility class for all functions related to the Voting WebBox.
	/// </summary>
	public class VotingUtility {
		// Default cache timeout.
		// Caches are generally updated in realtime when the data is changed.
		private static readonly int DEFAULT_CACHE_TIMEOUT=20;

		/// <summary>
		/// Grabs an available Poll, if any, for the end-user to be 
		/// rendered as a WebBox.
		/// </summary>
		/// <remarks>Use <see cref="GetPolls"/> for retrieving all polls.</remarks>
		public static PollDetails GetPollForWebBox(int Community_ID, int Section_ID, string Username) {
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingGetPollsForWebBox",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InCommunity_ID",SqlDbType.Int);
			myParam.Value=Community_ID;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InSection_ID",SqlDbType.Int);
			myParam.Value=Section_ID;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InUsername",SqlDbType.NVarChar,50);
			myParam.IsNullable=true;
			myParam.Value=Username;
			myCommand.Parameters.Add(myParam);

			myConnection.Open();
			SqlDataReader myReader = myCommand.ExecuteReader();
			ArrayList PollList = new ArrayList();
			while(myReader.Read()) {
				PollList.Add(myReader.GetInt32(0));
			}
			myConnection.Close();

			if (PollList.Count>0) {
				// We have some Polls to randomly choose from	
				Random rnd = new Random();
				int PollIndex = rnd.Next(0,PollList.Count);
				return GetPollForWebBox((int)PollList[PollIndex]);
			} else {
				// There are no Polls available for this user or section.
				return null;
			}
		}

		/// <summary>
		/// Use for getting a specific poll for the Voting Control WebBox
		/// </summary>
		public static PollDetails GetPollForWebBox(int Poll_ID) {
			DataRow poll = GetPoll(Poll_ID);
			DataTable pollChoices = VotingUtility.GetPollChoices(Poll_ID);
			ChoiceCollection choices = new ChoiceCollection();
			int i=0;
			foreach (DataRow row in pollChoices.Rows) {
				choices.Add((int)row["PollChoice_ID"],new ChoiceInfo((string)row["choice"],i,(int)row["PollChoice_ID"]));
				i++;
			}
			// Return PollDetails to the calling object.
			return new PollDetails(Poll_ID,(string)poll["PollQuestion"],choices,(bool)poll["DisplayResultsToPublic"]);
		}

		/// <summary>
		/// Returns a single Poll record.
		/// </summary>
		public static DataRow GetPoll(int Poll_ID) {
			return GetPollCache(Poll_ID);
		}

		/// <summary>
		/// Updates the sort order or a PollChoice
		/// </summary>
		public static void UpdatePollChoiceSortOrder(int PollChoice_ID, PollChoiceDirection Direction) {
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingPollChoicesUpdateSortOrder",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InPollChoice_ID",SqlDbType.Int);
			myParam.Value=PollChoice_ID;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InDirection",SqlDbType.Bit);
			if (Direction==PollChoiceDirection.Up)
				myParam.Value=1;
			else
				myParam.Value=0;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@OutPoll_ID",SqlDbType.Int);
			myParam.Direction=ParameterDirection.Output;
			myCommand.Parameters.Add(myParam);

			myConnection.Open();
			myCommand.ExecuteNonQuery();
			myConnection.Close();

			// Update Cache
			UpdatePollChoiceCache((int)myCommand.Parameters["@OutPoll_ID"].Value);
		}

		/// <summary>
		/// Returns all Polls for administration purposes.
		/// </summary>
		public static SqlDataReader GetPolls(int Community_ID) {
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingGetPolls",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InCommunity_ID",SqlDbType.Int);
			myParam.Value=Community_ID;
			myCommand.Parameters.Add(myParam);

			myConnection.Open();
			return myCommand.ExecuteReader(CommandBehavior.CloseConnection);
		}

		public static DataTable GetPollChoices(int Poll_ID) {
			return GetPollChoiceCache(Poll_ID);
		}

		/// <summary>
		/// Returns all Roles allowed to view a given Poll.
		/// </summary>
		public static string[] GetPollRoles(int Poll_ID) {
		    ArrayList colRoles = new ArrayList();
		
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingGetPollRoles",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InPoll_ID",SqlDbType.Int);
			myParam.Value=Poll_ID;
			myCommand.Parameters.Add(myParam);

			myConnection.Open();
			SqlDataReader dr = myCommand.ExecuteReader();
			while (dr.Read())
			 colRoles.Add((string)dr["RoleName"]);;
		    myConnection.Close();
		    if (colRoles.Count == 0)
		      colRoles.Add("Community-Everyone");

		    return (string[])colRoles.ToArray(typeof(string));
		}

		/// <summary>
		/// Returns all Sections allowed to view a given Poll.
		/// </summary>
		public static string[] GetPollSections(int Poll_ID) {
			ArrayList colSections = new ArrayList();
			
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingGetPollSections",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InPoll_ID",SqlDbType.Int);
			myParam.Value=Poll_ID;
			myCommand.Parameters.Add(myParam);
			
			myConnection.Open();
			SqlDataReader dr = myCommand.ExecuteReader();
			while (dr.Read())
			 colSections.Add((string)dr["section_name"]);
		    myConnection.Close();
		    return (string[])colSections.ToArray(typeof(string));
		}

		/// <summary>
		/// Returns the number of votes for each PollChoice in a given Poll.
		/// </summary>
		public static Hashtable GetPollResults(int Poll_ID) {
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingGetPollResults",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InPoll_ID",SqlDbType.Int);
			myParam.Value=Poll_ID;
			myCommand.Parameters.Add(myParam);
			
			myConnection.Open();
			SqlDataReader myReader = myCommand.ExecuteReader();
			Hashtable results = new Hashtable();
			while (myReader.Read()) {
				int amount=0;
				// If there are no votes (NULL) we default to 0
				if (!myReader.IsDBNull(1))
					amount=myReader.GetInt32(1);
				results.Add(myReader.GetInt32(0),amount);
			}
			myConnection.Close();
			return results;
		}

		/// <summary>
		/// Return a users vote for a given Poll.  
		/// </summary>
		/// <remarks>Only use for authenticated users.  Anonymous users are all lumped under one username.</remarks>
		public static ChoiceInfo GetUsersChoice(int Poll_ID, string Username) {
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingGetUsersChoice",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InPoll_ID",SqlDbType.Int);
			myParam.Value=Poll_ID;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InUsername",SqlDbType.NVarChar,50);
			myParam.Value=Username;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@OutPollChoice_ID",SqlDbType.Int);
			myParam.Direction=ParameterDirection.Output;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@OutChoice",SqlDbType.NVarChar,100);
			myParam.Direction=ParameterDirection.Output;
			myCommand.Parameters.Add(myParam);
			
			myConnection.Open();
			myCommand.ExecuteNonQuery();
			myConnection.Close();

			ChoiceInfo choice=new ChoiceInfo(String.Empty,0,0);
			if (!Convert.IsDBNull(myCommand.Parameters["@OutPollChoice_ID"].Value)) {
				choice.PollChoice_ID=(int)myCommand.Parameters["@OutPollChoice_ID"].Value;
				choice.Choice=(string)myCommand.Parameters["@OutChoice"].Value;
			}
			return choice;
		}

		/// <summary>
		/// Create's a new poll.
		/// </summary>
		public static int CreatePoll(int Community_ID, string PollQuestion, DateTime StartDate, DateTime EndDate, bool IsGlobal, bool DisplayResultsToPublic, bool IsActive) {
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingPollsInsert",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InCommunity_ID",SqlDbType.Int);
			myParam.Value=Community_ID;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InPollQuestion",SqlDbType.NVarChar,255);
			myParam.Value=PollQuestion;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InStartDate",SqlDbType.DateTime);
			if (StartDate.Equals(DateTime.MinValue))
				myParam.Value=DBNull.Value;
			else
				myParam.Value=StartDate;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InEndDate",SqlDbType.DateTime);
			if (EndDate.Equals(DateTime.MaxValue))
				myParam.Value=DBNull.Value;
			else
				myParam.Value=EndDate;
			myCommand.Parameters.Add(myParam);
			
			myParam = new SqlParameter("@InIsGlobal",SqlDbType.Bit);
			myParam.Value=IsGlobal?1:0;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InDisplayResultsToPublic",SqlDbType.Bit);
			myParam.Value=DisplayResultsToPublic?1:0;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InIsActive",SqlDbType.Bit);
			myParam.Value=IsActive?1:0;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@OutPoll_ID",SqlDbType.Int);
			myParam.Direction=ParameterDirection.Output;
			myCommand.Parameters.Add(myParam);

			myConnection.Open();
			myCommand.ExecuteNonQuery();
			myConnection.Close();
			
			// Update Poll Cache
			UpdatePollCache((int)myCommand.Parameters["@OutPoll_ID"].Value);

			return (int)myCommand.Parameters["@OutPoll_ID"].Value;
		}

	
		/// <summary>
		/// Updates an existing Poll.
		/// </summary>
		public static void UpdatePoll(int Poll_ID, string PollQuestion, DateTime StartDate, DateTime EndDate, bool IsGlobal, bool DisplayResultsToPublic, bool IsActive) {
			SqlConnection myConnection = new SqlConnection(CommunityGlobals.ConnectionString);
			SqlCommand myCommand = new SqlCommand("Community_VotingPollsUpdate",myConnection);
			myCommand.CommandType=CommandType.StoredProcedure;
			SqlParameter myParam;

			myParam = new SqlParameter("@InPoll_ID",SqlDbType.Int);
			myParam.Value=Poll_ID;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InPollQuestion",SqlDbType.NVarChar,255);
			myParam.Value=PollQuestion;
			myCommand.Parameters.Add(myParam);

			myParam = new SqlParameter("@InStartDate",SqlDbType.DateTime);
			if (StartDate.Equals(DateTime.MinValue))

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91视频观看视频| 国产99精品国产| 最新日韩在线视频| 国产精品美女www爽爽爽| 精品欧美一区二区三区精品久久| 欧美日韩国产综合一区二区| 欧美性色aⅴ视频一区日韩精品| 色偷偷88欧美精品久久久| 色婷婷综合五月| 欧美久久久久中文字幕| 91精品久久久久久久久99蜜臂| 在线播放日韩导航| 欧美成人性战久久| 久久精品一区八戒影视| 亚洲国产高清在线| 亚洲精品美国一| 午夜激情一区二区三区| 日本女人一区二区三区| 久久国产精品99久久人人澡| 国产美女在线观看一区| yourporn久久国产精品| 91国在线观看| 欧美一级片免费看| 久久久www免费人成精品| 国产精品久久看| 一区二区三区在线观看国产| 日韩高清不卡一区二区| 韩国一区二区三区| 99亚偷拍自图区亚洲| 欧美人xxxx| 国产区在线观看成人精品| 亚洲免费观看视频| 美女在线观看视频一区二区| 成人免费黄色在线| 91精品国产欧美一区二区| 久久久久久久久久久久久夜| 一区二区三区欧美视频| 激情久久五月天| 91高清视频在线| 久久久精品国产免费观看同学| 亚洲欧洲中文日韩久久av乱码| 美日韩一区二区| 色屁屁一区二区| 国产人久久人人人人爽| 日韩成人午夜电影| 99天天综合性| 久久精品人人爽人人爽| 亚洲成人你懂的| 白白色 亚洲乱淫| 久久久亚洲国产美女国产盗摄| 一区二区免费在线播放| 大胆欧美人体老妇| 欧美白人最猛性xxxxx69交| 亚洲欧美偷拍卡通变态| 国产精品一区一区| 日韩欧美二区三区| 亚洲成年人影院| 91农村精品一区二区在线| 久久婷婷一区二区三区| 日本伊人午夜精品| 色视频一区二区| 亚洲三级理论片| 成人激情午夜影院| 久久婷婷国产综合国色天香| 免费av成人在线| 7777精品伊人久久久大香线蕉最新版| 亚洲欧洲av色图| 国产91丝袜在线播放九色| 精品国产乱码久久久久久老虎| 五月天网站亚洲| 欧美日韩不卡视频| 亚洲成av人在线观看| 99久久精品免费看| 中文字幕在线视频一区| 成人黄色软件下载| 国产精品视频yy9299一区| 国产一区欧美一区| 久久女同精品一区二区| 国产一区二区精品久久| 久久精品免费在线观看| 国产一区二区剧情av在线| 国产亚洲福利社区一区| 国产成人精品免费一区二区| 国产嫩草影院久久久久| 成人丝袜高跟foot| 亚洲色图制服诱惑| 精品视频1区2区| 日本在线不卡视频| 久久久久久久久99精品| 国产福利精品一区二区| 中文字幕中文字幕在线一区 | 成人av第一页| 国产精品亲子乱子伦xxxx裸| 91在线一区二区三区| 亚洲高清久久久| 欧美一区二区视频在线观看2020 | 91丝袜美女网| 亚洲精品老司机| 51精品视频一区二区三区| 国产一区二区在线看| 久久久蜜桃精品| 91蜜桃在线免费视频| 一区二区三区四区高清精品免费观看| 欧美日韩国产高清一区二区三区 | 男女视频一区二区| 久久久久久9999| 91丝袜美女网| 蜜桃精品视频在线| 国产精品网站在线播放| 欧美日韩免费一区二区三区| 琪琪久久久久日韩精品| 久久久久久综合| 欧洲av在线精品| 日韩av不卡一区二区| 中文字幕一区二区三区在线播放| 欧美日韩一区 二区 三区 久久精品| 老鸭窝一区二区久久精品| 国产精品电影一区二区| 91精品欧美久久久久久动漫| 成人激情文学综合网| 蜜乳av一区二区| 一个色妞综合视频在线观看| 久久精品一区二区三区av| 欧美老肥妇做.爰bbww视频| 成人精品国产福利| 久久精品国产第一区二区三区| 亚洲免费av在线| 国产欧美一区二区精品婷婷| 欧美人牲a欧美精品| 一本大道久久a久久综合| 国产乱国产乱300精品| 日韩av一区二| 亚洲品质自拍视频网站| 国产偷v国产偷v亚洲高清 | 日本人妖一区二区| 樱桃国产成人精品视频| 国产三级精品三级在线专区| 欧美高清激情brazzers| 欧美在线视频全部完| 99热这里都是精品| 国产九色sp调教91| 韩国av一区二区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 日韩欧美亚洲国产另类| 在线观看亚洲一区| 色综合久久天天| av一区二区三区四区| 粉嫩一区二区三区在线看| 国产一区二区在线影院| 国产精品亚洲一区二区三区在线| 亚洲成人黄色小说| 亚洲图片欧美色图| 亚洲成av人片www| 亚洲国产一区二区三区青草影视| 亚洲精品国产精品乱码不99| 亚洲免费视频中文字幕| 亚洲精品久久久久久国产精华液| 亚洲柠檬福利资源导航| 亚洲精品日韩综合观看成人91| 亚洲色大成网站www久久九九| 亚洲蜜桃精久久久久久久| 亚洲欧美福利一区二区| 亚洲精品伦理在线| 偷拍自拍另类欧美| 三级久久三级久久久| 日韩电影在线免费看| 精品在线播放午夜| 国产精品1区2区| 91在线精品一区二区| 欧美午夜精品理论片a级按摩| 欧美剧在线免费观看网站| 欧美一级一区二区| 26uuu久久天堂性欧美| 欧美国产综合色视频| 成人欧美一区二区三区小说 | 国产欧美精品一区| 国产精品三级电影| 亚洲一区二区三区四区中文字幕| 亚洲精品国产精品乱码不99| 亚洲成人免费av| 免费观看一级欧美片| 激情伊人五月天久久综合| 国产成a人亚洲精| 欧美性xxxxx极品少妇| 日韩一区二区三区四区五区六区| 国产清纯白嫩初高生在线观看91| ㊣最新国产の精品bt伙计久久| 亚洲18女电影在线观看| 国内精品在线播放| 在线免费观看日本欧美| 久久亚洲一区二区三区四区| 亚洲男帅同性gay1069| 午夜精品成人在线视频| 高清在线观看日韩| 欧美高清视频www夜色资源网| 国产精品免费观看视频| 蜜臀99久久精品久久久久久软件| 不卡的av中国片| 欧美变态凌虐bdsm| 亚洲一区二区欧美日韩|