Element add_View_Connect_LoggedOut_NoFacebook_SignUp2Panel() { #region LoggedOut_NoFacebook_SignUp2Panel string s = @" <div id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2Panel"" class=""LoginPanel"" style=""display:none;""> <div class=""LoginPanelInner""> <p class=""LoginPanelTitle""> Enter your details... </p> <p style=""position:relative; height:25px; line-height:25px;""> Real name: <input id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_FirstNameTextbox"" type=""text"" style=""padding-left:5px; height:20px; left:140px; top:0px; position:absolute; width:100px; height:25px; line-height:25px;"" /> <input id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_LastNameTextbox"" type=""text"" style=""padding-left:5px; height:20px; left:250px; top:0px; position:absolute; width:100px; height:25px; line-height:25px;"" /> </p> <p style=""position:relative; height:25px; line-height:25px;""> Nickname: <input id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox"" type=""text"" style=""padding-left:5px; height:20px; left:140px; top:0px; position:absolute; width:210px; height:25px; line-height:25px;"" /> </p> <p style=""position:relative; height:25px; line-height:25px;""> Date of birth: <span style=""left:140px; top:0px; position:absolute;""> <select id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthDayDropDown"" class=""xui-state-default ui-corner-all"" style=""padding-left:5px; height:25px; line-height:25px;""></select> <select id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthMonthDropDown"" class=""xui-state-default ui-corner-all"" style=""padding-left:5px; height:25px; line-height:25px;""></select> <select id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthYearDropDown"" class=""xui-state-default ui-corner-all"" style=""padding-left:5px; height:25px; line-height:25px;""></select> </span> </p> <p style=""position:relative; height:25px; line-height:25px;""> Sex: <span style=""left:140px; top:0px; position:absolute;""> <input id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_SexMaleRadio"" type=""radio"" name=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp1_Sex"" /> <label for=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_SexMaleRadio""> Male</label> <input id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_SexFemaleRadio"" type=""radio"" name=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp1_Sex"" /> <label for=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_SexFemaleRadio""> Female</label> </span> </p> <p style=""position:relative; height:25px; line-height:25px;""> <button id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_SaveButton"" class=""ui-state-default ui-corner-all Pointer BigButton"" style=""left:140px; top:0px; position:absolute; width:50px;"">Save</button> <span id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel"" class=""ForegroundAttentionRed"" style=""left:200px; position:absolute; font-weight:bold; top:7px;""></span> </p> </div> <p style=""position:relative;""> <button id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_BackButton"" class=""ui-state-default ui-corner-all Pointer SmallButton"" style=""float:left; position:absolute; left:0px;"">Back</button> <button id=""{ClientID}Connect_LoggedOut_NoFacebook_SignUp2_CancelButton"" class=""ui-state-default ui-corner-all Pointer SmallButton"" style=""float:right;"">Cancel</button> </p> </div> "; addChild(s); #endregion jQuery.FromElement(View.Connect_LoggedOut_NoFacebook_SignUp2_FirstNameTextbox).Keyup(new jQueryEventHandler(noFacebookSignup2NameKeyUp)); jQuery.FromElement(View.Connect_LoggedOut_NoFacebook_SignUp2_LastNameTextbox).Keyup(new jQueryEventHandler(noFacebookSignup2NameKeyUp)); jQuery.FromElement(View.Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox).Keyup(new jQueryEventHandler(noFacebookSignup2NicknameKeyUp)); jQuery.FromElement(View.Connect_LoggedOut_NoFacebook_SignUp2_CancelButton).Click(new jQueryEventHandler(cancelButtonClick)); jQuery.FromElement(View.Connect_LoggedOut_NoFacebook_SignUp2_BackButton).Click(new jQueryEventHandler(noFacebookSignup2BackClick)); jQuery.FromElement(View.Connect_LoggedOut_NoFacebook_SignUp2_SaveButton).Click(new jQueryEventHandler(noFacebookSignup2SaveClick)); #region add date dropdown options if (View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthDayDropDown.Options.Length == 0) { addOption("-1", "", View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthDayDropDown); for (int i = 1; i <= 31; i++) addOption(i.ToString(), i.ToString(), View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthDayDropDown); } if (View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthMonthDropDown.Options.Length == 0) { addOption("-1", "", View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthMonthDropDown); string[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; for (int i = 0; i < months.Length; i++) addOption(i.ToString(), months[i], View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthMonthDropDown); } if (View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthYearDropDown.Options.Length == 0) { addOption("-1", "", View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthYearDropDown); Date t = new Date(); int year = t.GetFullYear(); for (int i = year; i > year - 100; i--) addOption(i.ToString(), i.ToString(), View.Connect_LoggedOut_NoFacebook_SignUp2_DateOfBirthYearDropDown); } #endregion defaultButton(View.Connect_LoggedOut_NoFacebook_SignUp2_FirstNameTextbox, View.Connect_LoggedOut_NoFacebook_SignUp2_SaveButton); defaultButton(View.Connect_LoggedOut_NoFacebook_SignUp2_LastNameTextbox, View.Connect_LoggedOut_NoFacebook_SignUp2_SaveButton); defaultButton(View.Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox, View.Connect_LoggedOut_NoFacebook_SignUp2_SaveButton); return View.Connect_LoggedOut_NoFacebook_SignUp2Panel; }
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"); } else { string newNickname = U.get(response, "Nickname").ToString(); if (View.Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox.Value != newNickname) { View.Connect_LoggedOut_NoFacebook_SignUp2_NicknameTextbox.Value = newNickname; View.Connect_LoggedOut_NoFacebook_SignUp2_ErrorLabel.InnerHTML = "We changed your nickname. Is this OK?"; return; } else { noFacebookSignup2SaveDone(); } } } ) ); #endregion }
public static void UpdateClock() { if (syncToClock) { Date justNow = Date.Now; if (timeRate != 1.0) { int ts = justNow.GetTime() - last.GetTime(); int ticks = (int)(ts * timeRate); offset += ticks; } last = justNow; try { //now = new Date(justNow.GetTime()); now = new Date(justNow.GetTime() + offset); } catch { now = new Date(1, 12, 25, 23, 59, 59); offset = now - Date.Now; } if (now.GetFullYear() > 4000) { now = new Date(4000, 12, 31, 23, 59, 59); offset = now - Date.Now; } if (now.GetFullYear() < 1) { now = new Date(0, 12, 25, 23, 59, 59); offset = now - Date.Now; } } }