當前位置: 首頁>>代碼示例>>C#>>正文


C# Date.SetMonth方法代碼示例

本文整理匯總了C#中System.Date.SetMonth方法的典型用法代碼示例。如果您正苦於以下問題:C# Date.SetMonth方法的具體用法?C# Date.SetMonth怎麽用?C# Date.SetMonth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Date的用法示例。


在下文中一共展示了Date.SetMonth方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: noFacebookSignup2SaveClick

		void noFacebookSignup2SaveClick(jQueryEvent e)
		{
			e.PreventDefault();

			if (AsyncInProgress)
				return;

			View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "";

			#region Check name
			if (View.Connect_LoggedOut_NoFacebook_SignUp2_FirstNameTextbox.Value.Length == 0)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Enter your first name";
				return;
			}

			if (View.Connect_LoggedOut_NoFacebook_SignUp2_LastNameTextbox.Value.Length == 0)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Enter your last name";
				return;
			}

			if (View.Connect_LoggedOut_NoFacebook_SignUp2_FirstNameTextbox.Value.Length > 20)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "First name is too long";
				return;
			}

			if (View.Connect_LoggedOut_NoFacebook_SignUp2_LastNameTextbox.Value.Length > 20)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Last name is too long";
				return;
			}
			#endregion

			#region Check nickname
			if (View.Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox.Value.Length == 0)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Enter a nickname";
				return;
			}

			if (View.Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox.Value.Length < 2)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Nickname must be longer";
				return;
			}

			if (View.Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox.Value.Length > 20)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Nickname is too long";
				return;
			}
			#endregion

			#region Check date of birth
			if (int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthYearDropDown.Value) < 0 ||
				int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthMonthDropDown.Value) < 0 ||
				int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthDayDropDown.Value) < 0)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Enter your date of birth";
				return;
			}

			Date d = new Date();
			d.SetFullYear(int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthYearDropDown.Value));
			d.SetMonth(int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthMonthDropDown.Value));
			d.SetDate(int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthDayDropDown.Value));

			if (d.GetFullYear() != int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthYearDropDown.Value) ||
				d.GetMonth() != int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthMonthDropDown.Value) ||
				d.GetDate() != int.Parse(View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthDayDropDown.Value))
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Check your date of birth";
				return;
			}
			#endregion

			#region Check sex
			if (!View.Connect_LoggedOut_NoFacebook_SignUp2_SexMaleRadio.Checked && !View.Connect_LoggedOut_NoFacebook_SignUp2_SexFemaleRadio.Checked)
			{
				View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "Enter your sex";
				return;
			}
			#endregion

			#region Check nickname
			int thisAsyncOperation = RegisterStartAsync("Checking nickname...");
			Server.GetUniqueNickName(
				View.Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox.Value,
				NoFacebookSignUp2PanelLoginUsrK,
				new Response(
					delegate(Dictionary<object, object> response)
					{
						if (RegisterEndAsync(thisAsyncOperation))
							return;

						if (U.isTrue(response, "Exception"))
						{
							showError(7, "Internal server error");
//.........這裏部分代碼省略.........
開發者ID:davelondon,項目名稱:dontstayin,代碼行數:101,代碼來源:Login.Controller.cs


注:本文中的System.Date.SetMonth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。