public void Should_be_able_Generate_the_Input_tag_with_Submit_Tag() { ISubmitButton textbox = new SubmitButton("Name").Value("Satish"); string htmlTextBox = textbox.ToString(); var cq = CQ.Create(htmlTextBox); cq.Attr("name").Should().Be("Name"); cq.Val().Should().Be("Satish"); }
public bool use_submit; //Should a submit button be used? #endregion Fields #region Methods //Event that's fired when submit button is clicked. public override void OnSubmit(SubmitButton submitButton) { for(int i=0;i<widgets.Count;i++) { //Gather some data from the widgets... } //Then use data from the widgets for something... Debug.Log ("Your answer is " + IsCorrect()); //Then maybe destroy the menu... Destroy (gameObject); }
//What happens when the submit button for this menu is clicked? public override void OnSubmit(SubmitButton submitButton) { string sentence = ""; for(int i=stringWidgets.Count-1;i>=0;i--) { sentence += (stringWidgets[i]).GetChoice(); if(i != 0) sentence += " "; } sentence += "."; Debug.Log (sentence); }
//What happens when the submit button for this menu is clicked? public override void OnSubmit(SubmitButton submitButton) { string order = ""; for(int i=0;i<widgets.Count;i++) { if(widgets[i].IsSelected && widgets[i] is FoodMenuItem) { order += ((FoodMenuItem)widgets[i]).food_name += " : "; order += ((FoodMenuItem)widgets[i]).price.ToString ("C"); order += "\n"; } } Debug.Log (order); //For now, reset all selections and set num_submitted to 0 after submission so you can order again. for(int i=0;i<widgets.Count;i++) { widgets[i].Unselect(); } }
public void submit_button_with_formnovalidate_renders_attribute() { var html = new SubmitButton("foo").FormNoValidate(true).ToString(); html.ShouldHaveHtmlNode("foo").ShouldHaveAttribute(HtmlAttribute.FormNoValidate).WithValue("formnovalidate"); }
public void Show() { Container = Div.CreateContainer(default(Element), container=>{ Div.CreateRow(container, row=>{ // new Div(row,element=>{ element.ClassName="span4 offset4 well"; new Legend(element, new LegendConfig{Text="Por favor inicie session"}); new Form(element, fe=>{ fe.Action= Config.Action; fe.Method = Config.Method; var cg = Div.CreateControlGroup(fe); var user= new InputText(cg.Element(), pe=>{ pe.ClassName="span4"; pe.SetPlaceHolder("nombre de usuario"); pe.Name="UserName"; }); cg = Div.CreateControlGroup(fe); var pass =new InputPassword(cg.Element(), pe=>{ pe.ClassName="span4"; pe.SetPlaceHolder("Digite su clave"); pe.Name="Password"; }); var bt = new SubmitButton(fe, b=>{ b.JSelect().Text("Iniciar Session"); b.ClassName="btn btn-info btn-block"; b.LoadingText(" autenticando...."); }); var vo = new ValidateOptions() .SetSubmitHandler( f=>{ bt.ShowLoadingText(); jQuery.PostRequest<LoginResponse>(f.Action, f.Serialize(), cb=>{ Cayita.Javascript.Firebug.Console.Log("callback", cb); },"json") .Success(d=>{ UserName= user.Element().Value; if(OnLogin!=null) OnLogin(d,this); }) .Error((request, textStatus, error)=>{ Div.CreateAlertErrorBefore(fe.Elements[0],textStatus+": " +( request.StatusText.StartsWith("ValidationException")? "Usario/clave no validos": request.StatusText)); }) .Always(a=>{ bt.ResetLoadingText(); }) ; }) .AddRule((rule, msg)=>{ rule.Element=pass.Element(); rule.Rule.Minlength(2).Required(); msg.Minlength("minimo 2 caracteres").Required("Digite su password"); }) .AddRule( (rule, msg)=> { rule.Element= user.Element(); rule.Rule.Required().Minlength(2); msg.Minlength("minimo 2 caracteres"); }); fe.Validate(vo); }); }); }); }); Parent.AppendChild(Container.Element()); }
public void Awake() { Transform tr = transform.Find("Background"); if(!tr) { Debug.LogError("Error in " + name + " menu : no background gameobject child attached with name \"Background\""); Destroy(gameObject); } background = tr.gameObject; ScaleBackground(); wand = GameObject.FindObjectOfType(typeof(Wand)) as Wand; widgets = new List<Widget>(); Widget[] awidgets = GetComponentsInChildren<Widget>(); for(int i=0;i<awidgets.Length;i++) { if(awidgets[i] is SubmitButton) { Submit = (SubmitButton)awidgets[i]; ((SubmitButton)awidgets[i]).OnSubmit += OnSubmit; //Subscribe the OnSubmit method to SubmitButton's OnSubmit event. } //Add non-label widgets else if(!(awidgets[i] is LabelWidget)) { widgets.Add (awidgets[i]); awidgets[i].OnWidgetClick += OnWidgetClick; awidgets[i].OnWidgetHover += OnWidgetHover; awidgets[i].OnWidgetLeave += OnWidgetLeave; } //Add label widgets else if(awidgets[i] is LabelWidget) { labels.Add(awidgets[i] as LabelWidget); } } SortWidgets(); }
public SingleInputPage WaitReady() { SubmitButton.WaitPresent(); ValidationLevel.WaitPresent(); return(this); }
public void CreateNewPerson() { SubmitButton.Click(); }
//Event that's fired when submit button is clicked. public virtual void OnSubmit(SubmitButton submitButton) { }
public void Login(string username, string password) { EmailTextbox.SendKeys(username); PasswordTextbox.SendKeys(password); SubmitButton.Click(); }
private void SynchronizeToWeChat() { try { ProcessProgress.Current.RegisterResponser(SubmitButtonProgressResponser.Instance); var allGroups = ConditionalGroupAdapter.Instance.LoadAll(); var accounts = AccountInfoAdapter.Instance.LoadAll(); WeChatGroupCollection weChatGroups = WeChatGroupAdapter.Instance.LoadAll(); ProcessProgress.Current.MaxStep = allGroups.Count * accounts.Count; ProcessProgress.Current.CurrentStep = 0; ProcessProgress.Current.StatusText = "开始同步..."; ProcessProgress.Current.Response(); foreach (var account in accounts) { WeChatRequestContext.Current.LoginInfo = WeChatHelper.ExecLogin(account.UserID, account.Password); Thread.Sleep(1000); foreach (var group in allGroups) { var fakeIDs = WeChatFriendAdapter.Instance.GetFakeIDsByLocalGroupID(group.GroupID).ToArray(); //找到本组里成员的fakeID var matchedGroup = weChatGroups.Find(p => p.Name == group.Name && p.AccountID == WeChatRequestContext.Current.LoginInfo.AccountID); int groupID = 0; if (matchedGroup == null) { var modifiedGroup = WeChatHelper.AddGroup(group.Name, WeChatRequestContext.Current.LoginInfo); var newGroup = new WeChatGroup() { AccountID = account.AccountID, GroupID = modifiedGroup.GroupId, Name = group.Name, Count = modifiedGroup.MemberCnt }; WeChatGroupAdapter.Instance.Update(newGroup); Thread.Sleep(1000); groupID = modifiedGroup.GroupId; } else { groupID = matchedGroup.GroupID; } if (fakeIDs.Length > 0) { WeChatHelper.ChangeFriendsGroup(groupID, fakeIDs, WeChatRequestContext.Current.LoginInfo); } ProcessProgress.Current.Increment(); ProcessProgress.Current.StatusText = string.Format("帐号\"{0}\",同步组\"{1}\"完成", account.UserID, group.Name); ProcessProgress.Current.Response(); Thread.Sleep(1000); } } ProcessProgress.Current.StatusText = string.Format("同步完成"); ProcessProgress.Current.Response(); Thread.Sleep(1000); } catch (Exception ex) { WebUtility.ResponseShowClientErrorScriptBlock(ex); } finally { this.Response.Write(SubmitButton.GetResetAllParentButtonsScript(true)); this.Response.End(); } }
/// <summary> /// Fills the required fields on the enter a CPD activity page /// </summary> /// public void FillOutAssessmentForm() { //generate the data to fill out the data DateTime dt = DateTime.Now; int currentDay = dt.Day; int currentMonth = dt.Month; int currentYear = dt.Year; int currentHour = dt.Hour; int currentMinute = dt.Minute; int currentSecond = dt.Second; //create a string for the program title String ProgramTitle = "TestRun_" + currentMonth + "_" + currentDay + "_" + currentYear + "-" + currentHour + ":" + currentMinute + ":" + currentSecond; Thread.Sleep(2000); ProgramTitleCertifiedAssessmentTxt.SendKeys(ProgramTitle); //move down to the province selection screen IWebElement element = Browser.FindElement(By.Id("ctl00_ContentPlaceHolder1_CFPCActivitiesWizard_ctl03_fb1_ctl06_ctl17_CEComboBox3449685")); // Put this element in the page bys class ElemSet.ScrollToElement(Browser, element); // MIKE: Removed a bunch of end lines //select alberta ProvinceSelectorDrpDn.SelectByIndex(1); ProvinceSelectorDrpDn.SelectByText("Alberta (AB)"); // MIKE: I added this line and commented the one above it. Why use index when you know which item you are going to choose? The index might change in the future if more items are added to the select list //Fill out the test city CityTxt.SendKeys("Test City"); //fill out the PlanningOrganizationTxt.SendKeys("Test"); //generate a date for these Activity Test string date = DateTime.Today.AddDays(-1).ToString("MM/dd/yyyy", CultureInfo.InvariantCulture); // MIKE: I added this line and commented out the below lines. Reduces lines and having seperate varaibles for the start and end doesnt make sense in this case //DateTime dt2 = DateTime.Today.AddDays(-1); //String startDateText = dt2.Month + "/" + dt2.Day + "/" + dt2.Year; //String completionDateText = dt2.Month + "/" + dt2.Day + "/" + dt2.Year; //send the text to the box ActivityStartDateTxt.SendKeys(date); ActivityCompletionDateTxt.SendKeys(date); CreditsClaimedTxt.SendKeys("1"); ChangedImprovedRdo.Click(); LearnedNewRdo.Click(); LearnMoreRdo.Click(); //scroll to the dissatisfied radio button // ElemSet.ScrollToElement(Browser,DissatisfiedRdo); ElemSet.ClickAfterScroll(Browser, DissatisfiedRdo); // MIKE: I added this line and commented the above one. We can talk at meeting BiasedRdo.Click(); //scroll to element ElemSet.ClickAfterScroll(Browser, ConfirmedRdo); // MIKE: I would name these elements with a little more detail. It took me, a new person, a little bit of time to figure out what radio button was for each variable // MIKE: Always start with the beginning text when naming elements. For example for this radio button, name it "ThisExperienceConfirmedRdo" instead of just "Confirmed" // For some reason, whenever we use Selenium's built in click method here, it triggers the application to add more than // 1 credit for the activity/user (We entered "1" into the CreditsClaimed text box above, so only 1 credit should get // added for the user). I added a workaround to use the javascript version of a click, and this // works (only adds the specified amount of credits) For more info, // see https://stackoverflow.com/questions/24571048/selenium-webelement-click-vs-javascript-click-event JavascriptUtils.Click(Browser, SubmitButton); SubmitButton.SendKeys(Keys.Tab); Thread.Sleep(20000); // MIKE: Definitely add wait criteria here. I see that a popup appears, we can wait on an element in this popup }
/// <summary> /// Fills out the Self page /// </summary> /// public void FillOutSelfLearningForm() { //generate the data to fill out the data DateTime dt = DateTime.Now; int currentDay = dt.Day; int currentMonth = dt.Month; int currentYear = dt.Year; int currentHour = dt.Hour; int currentMinute = dt.Minute; int currentSecond = dt.Second; //create a string for the program title String ProgramTitle = "TestRun_" + currentMonth + "_" + currentDay + "_" + currentYear + "-" + currentHour + ":" + currentMinute + ":" + currentSecond; Thread.Sleep(3000);//add wait criteria later ElemSet.ScrollToElement(Browser, ProgramTitleCertifiedSelfLearningTxt); ProgramTitleCertifiedSelfLearningTxt.SendKeys(ProgramTitle); //move down to the province selection screen ElemSet.ScrollToElement(Browser, CityTxtCertifiedSelfLearningTxt); //select alberta ProvinceSelectorCertifiedSelfLearningDrpDn.SelectByIndex(1); //Fill out the test city CityTxtCertifiedSelfLearningTxt.SendKeys("Test City"); //fill out the PlanningOrganizationCertifiedSelfLearningTxt.SendKeys("Test"); //generate a date for these Activity Test DateTime dt2 = DateTime.Today.AddDays(-1); String startDateText = dt2.Month + "/" + dt2.Day + "/" + dt2.Year; String completionDateText = dt2.Month + "/" + dt2.Day + "/" + dt2.Year; ActivityStartDateCertifiedSelfLearningTxt.SendKeys(startDateText); ActivityCompletionDateCertifiedSelfLearningTxt.SendKeys(completionDateText); CreditsClaimedDateCertifiedSelfLearningTxt.SendKeys("1"); ElemSet.ClickAfterScroll(Browser, ChangedImprovedCertifiedGSelfLearningRdo); ElemSet.ClickAfterScroll(Browser, LearnedNewCertifiedSelfLearningRdo); ElemSet.ClickAfterScroll(Browser, LearnedMoreCertifiedSelfLearningRdo); ElemSet.ClickAfterScroll(Browser, ConfirmedCertifiedSelfLearningRdo); ElemSet.ClickAfterScroll(Browser, BiasedCertifiedSelfLearningRdo); ElemSet.ClickAfterScroll(Browser, DissatisfiedCertifiedSelfLearningRdo); ElemSet.ScrollToElement(Browser, SubmitButton); // For some reason, whenever we use Selenium's built in click method here, it triggers the application to add more than // 1 credit for the activity/user (We entered "1" into the CreditsClaimed text box above, so only 1 credit should get // added for the user). I added a workaround to use the javascript version of a click, and this // works (only adds the specified amount of credits) For more info, // see https://stackoverflow.com/questions/24571048/selenium-webelement-click-vs-javascript-click-event JavascriptUtils.Click(Browser, SubmitButton); SubmitButton.SendKeys(Keys.Tab); Thread.Sleep(20000); }
public void SearchThroughAccountName(IWebDriver driver) { SignIn_Page.Click(); UserEmail.SendKeys("*****@*****.**"); Password.SendKeys("Test@123"); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(800)); Thread.Sleep(800); SubmitButton.Click(); MyAccount_Toggle.Click(); BankAccount_Page.Click(); AJAXCall.WaitForAjax(); Thread.Sleep(1000); downArrow.Click(); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(900)); Thread.Sleep(1000); EditLink.Click(); Actions action = new Actions(driver); action.KeyDown(Keys.Control).SendKeys(Keys.End).Perform(); NextButton.Click(); AJAXCall.WaitForAjax(); Thread.Sleep(2000); if (AJAXCall.IsElementPresent(By.PartialLinkText("Upload Document"))) { action.KeyDown(Keys.Control).SendKeys(Keys.End).Perform(); NextButton.Click(); } else { Thread.Sleep(1000); } AJAXCall.WaitForAjax(); Thread.Sleep(1000); Thread.Sleep(2000); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(100)); if (AJAXCall.IsElementPresent(By.Id("eyp_validationcode"))) { Excel_Suite read_BankCode = new Excel_Suite(@"C:\Pobal_AutomationProject\Pobal_Test_Project\Automation_Suite\TestData_Repository\BankCode.xlsx"); read_BankCode.getCellData("Bank_Sheet", false); IWebElement value_Code = driver.FindElement(By.XPath("//*[@id='eyp_validationcode']")); value_Code.Click(); value_Code.Clear(); Thread.Sleep(2000); value_Code.SendKeys(Keys.Tab); value_Code.SendKeys(Env.Data_Retrieve); } NextButton.Click(); }
public void SP_Portal_SignIN_Submit(IWebDriver driver) { CommonUtils Cu = new CommonUtils(driver); Cu.AcceptAll_Cookies(); SignIn_Page.Click(); Thread.Sleep(900); Excel_Suite userEmail = new Excel_Suite(Env.EXCEL_TEST_URL); userEmail.getCellData("SPP_TestData", true); UserEmail.SendKeys(Env.Email_Id); // UserEmail.SendKeys(Constant_functions.UserEmailId); Password.SendKeys("Test@123"); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(800)); SubmitButton.Click(); MyAccount_Toggle.Click(); BankAccount_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "pageload is working fine"); BankAccountLink_Button.Click(); Thread.Sleep(1000); Excel_Suite Es = new Excel_Suite(Env.EXCEL_BANK_DATA); ExcelData bankData = Es.getBankData("Sheet1"); SelectElement bankBranchOption = new SelectElement(DropDown_Bank); if (bankData != null) { accountName.SendKeys(bankData.AccountName); List <string> bankNames = new List <string> { "AIB", "An Post", "Bank of Ireland", "First Active", "ING Bank", "Aareal Bank AG", "Bank of America Merrill Lynch International Ltd", "Ulster Bank" }; Thread.Sleep(800); IList <IWebElement> bankNames_1 = bankBranchOption.Options; DropDown_Bank.Click(); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(900)); string val = ""; Thread.Sleep(1000); foreach (var bankNameText in bankNames) { if (bankNameText.Contains(bankData.BankName)) { val = bankNameText; if (AJAXCall.IsElementPresent(By.Id("eyp_bank"))) { bankBranchOption.SelectByText(val); } } else { bankBranchOption.SelectByIndex(4); break; } } Thread.Sleep(1000); foreach (char c in bankData.IBAN1) { iban_text.SendKeys(c.ToString()); } Bank_branch.SendKeys(bankData.BankBranch); Accountnumber.SendKeys(bankData.AccountNumber); Thread.Sleep(600); foreach (char s in bankData.BIC) { BIC_Num.SendKeys(s.ToString()); } Thread.Sleep(600); sortCode.SendKeys(bankData.SortCode); } wait = new WebDriverWait(driver, TimeSpan.FromSeconds(900)); NextButton.Click(); AJAXCall.WaitForReady(driver); Thread.Sleep(1000); Upload_Document.Click(); AJAXCall.WaitForAjax(); Thread.Sleep(1000); driver.SwitchTo().Frame(1); SelectElement doc = new SelectElement(dropdown_documenttypeid); doc.SelectByText("Bank Account Statement"); Thread.Sleep(500); AJAXCall.WaitForAjax(); IWebElement upload = driver.FindElement(By.Id("AttachFile")); upload.SendKeys("C:\\temp\\Tech_Cities_Future_report.pdf"); upload_Btn.Click(); Thread.Sleep(1000); AJAXCall.WaitForReady(driver); driver.SwitchTo().DefaultContent(); Thread.Sleep(1000); IJavaScriptExecutor js = (IJavaScriptExecutor)driver; js.ExecuteScript("window.scrollBy(0, 500)", ""); js.ExecuteScript("arguments[0].scrollIntoView();", NextButton); if (AJAXCall.IsElementPresent(By.Id("NextButton"))) { NextButton.Click(); } else { IJavaScriptExecutor jse = (IJavaScriptExecutor)driver; jse = (IJavaScriptExecutor)driver; jse.ExecuteScript("arguments[0].scrollIntoView();", NextButton); } ReportsGeneration._test.Log(Status.Pass, "SPP" + " " + driver.Url + " " + "PASSED"); Thread.Sleep(700); }
public void MyAccount_NavigationTest(IWebDriver driver) { try { Thread.Sleep(900); CommonUtils CookiesAction = new CommonUtils(driver); CookiesAction.RejectAll_Cookies(); Thread.Sleep(900); SignIn_Page.Click(); Excel_Suite userEmail = new Excel_Suite(Env.EXCEL_TEST_URL); userEmail.getCellData("SPP_TestData", true); UserEmail.SendKeys(Env.Email_Id); Password.SendKeys("Test@123"); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(800)); Thread.Sleep(800); SubmitButton.Click(); MyAccount_Toggle.Click(); Organisation.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "dropdown is working fine"); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(800)); AJAXCall.WaitForAjax(); MyAccount_Toggle.Click(); ServiceProvider_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "dropdown is working fine"); Thread.Sleep(1000); MyAccount_Toggle.Click(); userRoles_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "pageload is working fine"); MyAccount_Toggle.Click(); BankAccount_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "pageload is working fine"); MyAccount_Toggle.Click(); TuslaCertificate_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "pageload is working fine"); Thread.Sleep(500); MyAccount_Toggle.Click(); FeesList_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "pageload is working fine"); MyAccount_Toggle.Click(); ServiceCalendar_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "pageload is working fine"); MyAccount_Toggle.Click(); ECCEPreContracting_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "pageload is working fine"); MyAccount_Toggle.Click(); CapitalWorksEquipment_Page.Click(); ReportsGeneration._test.Log(Status.Pass, " " + " " + driver.Url + " " + "dropdown is working fine"); } catch (Exception e) { Console.WriteLine(e.Message); } }
public void submit_button_with_method_renders_method() { var html = new SubmitButton("foo").Method(FormMethod.Post).ToString(); html.ShouldHaveHtmlNode("foo") .ShouldHaveAttribute(HtmlAttribute.FormMethod).WithValue("post"); }
protected void btnCalculate_Click(object sender, EventArgs e) { try { ProcessProgress.Current.RegisterResponser(SubmitButtonProgressResponser.Instance); if (ddlGroups.SelectedIndex == 0) { var allGroups = ConditionalGroupAdapter.Instance.LoadAll(); ProcessProgress.Current.MaxStep = allGroups.Count; ProcessProgress.Current.StatusText = "开始计算..."; ProcessProgress.Current.Response(); foreach (var group in allGroups) { var result = Common.GetCalculatedGroupMembers(group.Condition); using (TransactionScope scope = TransactionScopeFactory.Create()) { GroupAndMemberAdapter.Instance.DeleteByGroupID(group.GroupID); foreach (var member in result) { GroupAndMember gm = new GroupAndMember(); gm.GroupID = group.GroupID; gm.MemberID = member.MemberID; GroupAndMemberAdapter.Instance.Update(gm); } scope.Complete(); } ProcessProgress.Current.StatusText = ""; ProcessProgress.Current.Increment(); ProcessProgress.Current.Response(); } } else { var group = ConditionalGroupAdapter.Instance.Load(p => p.AppendItem("GroupID", ddlGroups.SelectedValue)).FirstOrDefault(); var result = Common.GetCalculatedGroupMembers(group.Condition); ProcessProgress.Current.MaxStep = result.Count; ProcessProgress.Current.Response(); using (TransactionScope scope = TransactionScopeFactory.Create()) { GroupAndMemberAdapter.Instance.DeleteByGroupID(group.GroupID); foreach (var member in result) { GroupAndMember gm = new GroupAndMember(); gm.GroupID = group.GroupID; gm.MemberID = member.MemberID; GroupAndMemberAdapter.Instance.Update(gm); ProcessProgress.Current.Increment(); ProcessProgress.Current.Response(); } scope.Complete(); } } ProcessProgress.Current.StatusText = ""; ProcessProgress.Current.CurrentStep = 0; ProcessProgress.Current.Response(); } catch (Exception ex) { WebUtility.ResponseShowClientErrorScriptBlock(ex); } finally { this.Response.Write(SubmitButton.GetResetAllParentButtonsScript(true)); this.Response.End(); } }
public void SubmitForSearch() { SubmitButton.Click(); }
public void ServiceCalendar_Page() { CommonUtils cookieIgnore = new CommonUtils(webDriver); cookieIgnore.RejectAll_Cookies(); SignIn_Page.Click(); Excel_Suite userEmail = new Excel_Suite(Env.EXCEL_TEST_URL); userEmail.getCellData("SPP_TestData", true); UserEmail.SendKeys(Env.Email_Id); Password.SendKeys("Test@123"); WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(800)); System.Threading.Thread.Sleep(800); SubmitButton.Click(); Thread.Sleep(1000); MyAccount_Toggle.Click(); AJAXCall.WaitForAjax(); ServiceCalendar_Tab.Click(); CreateCalendar.Click(); SelectElement ProgCell = new SelectElement(Eyp_programmecall); var ECCE2021 = "ECCE 2021"; var ECCE2022 = "ECCE 2022"; var NCS2020 = "NCS 2020"; var NCS2021 = "NCS 2021"; var NCS2022 = "NCS 2022"; ProgCell.SelectByText(NCS2020); Thread.Sleep(800); NextButton.Click(); var startDate = "09:00"; var closeDate = "12:00"; Eyp_monopeningtime.SendKeys(startDate); Eyp_monclosingtime.SendKeys(closeDate); Eyp_tueopeningtime.SendKeys(startDate); Eyp_tueclosingtime.SendKeys(closeDate); Eyp_wedopeningtime.SendKeys(startDate); Eyp_wedclosingtime.SendKeys(closeDate); Eyp_thuopeningtime.SendKeys(startDate); Eyp_thuclosingtime.SendKeys(closeDate); Eyp_friopeningtime.SendKeys(startDate); Eyp_friclosingtime.SendKeys(closeDate); Thread.Sleep(800); NextButton.Click(); }
private void Synchronize() { try { ProcessProgress.Current.RegisterResponser(SubmitButtonProgressResponser.Instance); List <WeChatFriend> allFriends = new List <WeChatFriend>(); if (ddlAccount.SelectedIndex == 0) { var allAccounts = AccountInfoAdapter.Instance.LoadAll(); foreach (var account in allAccounts) { WeChatRequestContext.Current.LoginInfo = WeChatHelper.ExecLogin(account.UserID, account.Password); ProcessProgress.Current.StatusText = string.Format("正在准备帐号\"{0}\"的数据...", account.UserID); ProcessProgress.Current.Response(); Thread.Sleep(1000); var flag = true; var curIndex = 0; while (flag) { WeChatFriendCollection friends = WeChatHelper.GetAllMembers(curIndex, 100, WeChatRequestContext.Current.LoginInfo); Thread.Sleep(1000); foreach (var friend in friends) { friend.AccountID = account.AccountID; allFriends.Add(friend); } if (friends.Count == 0) { flag = false; } else { curIndex++; } ProcessProgress.Current.Response(); } } } else { var account = AccountInfoAdapter.Instance.Load(p => p.AppendItem("AccountID", ddlAccount.SelectedValue)).FirstOrDefault(); WeChatRequestContext.Current.LoginInfo = WeChatHelper.ExecLogin(account.UserID, account.Password); ProcessProgress.Current.StatusText = string.Format("正在准备帐号\"{0}\"的数据...", account.UserID); ProcessProgress.Current.Response(); Thread.Sleep(1000); var flag = true; var curIndex = 0; while (flag) { WeChatFriendCollection friends = WeChatHelper.GetAllMembers(curIndex, 100, WeChatRequestContext.Current.LoginInfo); Thread.Sleep(1000); foreach (var friend in friends) { friend.AccountID = account.AccountID; allFriends.Add(friend); } if (friends.Count == 0) { flag = false; } else { curIndex++; } ProcessProgress.Current.Response(); } } ProcessProgress.Current.MaxStep = allFriends.Count; ProcessProgress.Current.StatusText = "开始同步..."; ProcessProgress.Current.Response(); foreach (var friend in allFriends) { WeChatFriendAdapter.Instance.Update(friend); ProcessProgress.Current.Increment(); ProcessProgress.Current.Response(); } ProcessProgress.Current.CurrentStep = 0; ProcessProgress.Current.StatusText = ""; ProcessProgress.Current.Response(); } catch (Exception ex) { WebUtility.ResponseShowClientErrorScriptBlock(ex); } finally { this.Response.Write(SubmitButton.GetResetAllParentButtonsScript(true)); this.Response.End(); } }
public void Show() { Container = Div.CreateContainer(default(Element), container=>{ Div.CreateRow(container, row=>{ // new Div(row,element=>{ element.ClassName="span4 offset4 well"; new Legend(element, l=>l.Text("Por favor inicie session")); new Form(element, fe=>{ fe.Action= "/api/User/login"; new TextField(fe, i=>{ i.SetPlaceHolder("NIT");i.Name="Nit";i.ClassName="span4"; i.SetRequired();i.SetMinLength(8); }); new TextField(fe, i=>{ i.SetPlaceHolder("nombre usuario"); i.Name="Nombre";i.ClassName="span4"; i.SetRequired();i.SetMinLength(4); }); new TextField(fe, i=>{ i.SetPlaceHolder("clave"); i.Name="Clave";i.ClassName="span4"; i.SetRequired();i.SetMinLength(4); i.Type="password"; }); var bt = new SubmitButton(fe, b=>{ b.JQuery().Text("Iniciar Session"); b.ClassName="btn btn-info btn-block"; b.LoadingText(" autenticando...."); }); var vo = new ValidateOptions() .SetSubmitHandler( f=>{ bt.ShowLoadingText(); var req=jQuery.PostRequest<UserLoginResponse>(f.Action, f.Serialize(), cb=>{},"json"); req.Done(d=>{ Cayita.Javascript.Firebug.Console.Log(d); f.Clear(); if(OnLogin!=null) OnLogin(d,this); }); req.Fail(e=> { Cayita.Javascript.Firebug.Console.Log("fail :",req); Div.CreateAlertErrorBefore(fe.Elements[0], req.Status.ToString()+":"+ (req.StatusText.StartsWith("ValidationException")? "Usario/clave no validos": req.StatusText)); }); req.Always(a=>{ bt.ResetLoadingText(); }) ; }); fe.Validate(vo); }); }); }); }); Parent.AppendChild(Container.Element()); }
public void Submit() { SubmitButton.Click(); }
void Paint(Element parent) { new Div(parent, div=>{ div.ClassName="span6 offset3 well"; div.Hide(); }) ; SearchDiv= new Div(default(Element), searchdiv=>{ searchdiv.ClassName= "span6 offset3 nav"; BNew = new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-plus-sign icon-large"; abn.JSelect().Click(evt=>{ GridDiv.Hide(); FormDiv.FadeIn(); Form.Element().Reset(); BDelete.Element().Disabled=true; BList.Element().Disabled=false; }); }); BDelete= new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-remove-sign icon-large"; abn.Disabled=true; abn.JSelect().Click(evt=>{ RemoveRow(); }); }); BList= new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-reorder icon-large"; abn.JSelect().Click(evt=>{ FormDiv.Hide(); GridDiv.FadeIn(); BList.Element().Disabled=true; }); }); }); SearchDiv.AppendTo(parent); GridDiv= new Div(default(Element), gdiv=>{ gdiv.ClassName="span6 offset3"; TableFuentes= new HtmlTable(gdiv, table=>{ InitTable(table); LoadFuentes(table); }); }); GridDiv.AppendTo(parent); FormDiv= new Div(default(Element), formdiv=>{ formdiv.ClassName="span6 offset3 well"; formdiv.Hide(); Form = new Form(formdiv, f=>{ f.ClassName="form-horizontal"; f.Action="api/Fuente/"; var inputId= new InputText(f, e=>{ e.Name="Id"; e.Hide(); }); var cbTipo= new SelectField(f, (e)=>{ e.Name="Tipo"; e.ClassName="span12"; new HtmlOption(e, o=>{ o.Value=""; o.Selected=true; o.Text="Seleccione el tipo "; }); new HtmlOption(e, o=>{ o.Value="Credito"; o.Text="Credito"; }); new HtmlOption(e, o=>{ o.Value="Debito"; o.Text="Debito"; }); }); var fieldCodigo=new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Codigo"; field.SetPlaceHolder("Codigo del Recurso ## Grupo ##.## Item"); }); var fieldNombre=new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Nombre"; field.SetPlaceHolder("Nombre del Recurso"); }); var bt = new SubmitButton(f, b=>{ b.JSelect().Text("Guardar"); b.LoadingText(" Guardando ..."); b.ClassName="btn btn-info btn-block" ; }); var vo = new ValidateOptions() .SetSubmitHandler( form=>{ bt.ShowLoadingText(); var action= form.Action+(string.IsNullOrEmpty(inputId.Value())?"create":"update"); jQuery.PostRequest<BLResponse<Fuente>>(action, form.Serialize(), cb=>{},"json") .Success(d=>{ Cayita.Javascript.Firebug.Console.Log("Success guardar recurso",d); if(string.IsNullOrEmpty(inputId.Value()) ) AppendRow(d.Result[0]); else UpdateRow(d.Result[0]); FormDiv.FadeOut(); GridDiv.Show (); }) .Error((request, textStatus, error)=>{ Cayita.Javascript.Firebug.Console.Log("request", request ); Div.CreateAlertErrorBefore(form.Elements[0], textStatus+": "+ request.StatusText); }) .Always(a=>{ bt.ResetLoadingText(); }); }) .AddRule((rule, msg)=>{ rule.Element=cbTipo.Element(); rule.Rule.Required(); msg.Required("Seleccione tipo de Recurso"); }) .AddRule((rule,msg)=>{ rule.Element=fieldNombre.Element(); rule.Rule.Required().Maxlength(64); msg.Required("Indique el nombre del Recurso").Maxlength("Maximo 64 Caracteres"); }).AddRule((rule,msg)=>{ rule.Element=fieldCodigo.Element(); rule.Rule.Required().Maxlength(5); msg.Required("Indique el codigo del Recurso").Maxlength("Maximo 5 caracteres"); }); f.Validate(vo); }); }); FormDiv.AppendTo(parent); }
public void ClickSubmitButton() { SubmitButton.Click(); }
/// <summary> /// In HTML konvertieren /// </summary> /// <returns>Das Control als HTML</returns> public override IHtmlNode ToHtml() { CancelButton.Url = RedirectUrl; var classes = new List <string>(); classes.Add(Class); switch (Layout) { case TypesLayoutForm.Inline: classes.Add("form-inline"); break; } // Prüfe ob Formular abgeschickt wurde if (string.IsNullOrWhiteSpace(GetParam(SubmitButton.Name))) { OnInit(); } var button = SubmitButton.ToHtml(); var next = SubmitAndNextButton.ToHtml(); var cancel = CancelButton.ToHtml(); var html = new HtmlElementForm() { ID = ID, Class = string.Join(" ", classes.Where(x => !string.IsNullOrWhiteSpace(x))), Style = Style, Name = Name.ToLower() != "form" ? "form_" + Name.ToLower() : Name.ToLower(), Action = Url, Method = "post" }; html.Elements.AddRange(Content.Select(x => x.ToHtml())); foreach (var v in ValidationResults) { var layout = TypesLayoutAlert.Default; switch (v.Type) { case TypesInputValidity.Error: layout = TypesLayoutAlert.Danger; break; case TypesInputValidity.Warning: layout = TypesLayoutAlert.Warning; break; case TypesInputValidity.Success: layout = TypesLayoutAlert.Success; break; } html.Elements.Add(new ControlAlert(Page) { Layout = layout, Text = v.Text, Dismissible = true, Fade = true }.ToHtml()); } foreach (var v in Items) { html.Elements.Add(new ControlFormularLabelGroup(this) { Item = v }.ToHtml()); } html.Elements.Add(button); if (EnableSubmitAndNextButton) { html.Elements.Add(next); } if (EnableCancelButton) { html.Elements.Add(cancel); } return(html); }
public void SubmitEnrollment() { SubmitButton.Click(); }
public LoginCompletePage SubmitApplication() { SubmitButton.Click(); return(new LoginCompletePage(Driver)); }
//Event that's fired when submit button is clicked. public override void OnSubmit(SubmitButton submitButton) { }
private void Send() { ProcessProgress.Current.RegisterResponser(SubmitButtonProgressResponser.Instance); if (VerifyInput()) { try { if (ddlAccount.SelectedIndex == 0) { WeChatAppMessage appMessage = null; ProcessProgress.Current.MaxStep = ddlAccount.Items.Count - 1; ProcessProgress.Current.CurrentStep = 0; ProcessProgress.Current.StatusText = ""; ProcessProgress.Current.Response(); foreach (ListItem accountItem in ddlAccount.Items) { try { if (accountItem.Value == "-1") { continue; } appMessage = SendOne(accountItem.Value, ddlGroups.SelectedItem); ProcessProgress.Current.StatusText = string.Format("对帐号 {0} 发送成功!", accountItem.Text); ProcessProgress.Current.Response(); Thread.Sleep(1000); } catch (Exception ex) { //WebUtility.ResponseShowClientErrorScriptBlock(ex); ProcessProgress.Current.StatusText = string.Format("对帐号 {0} 发送失败,原因:{1}", accountItem.Text, ex.Message); ProcessProgress.Current.Response(); Thread.Sleep(2000); } finally { ProcessProgress.Current.Increment(); ProcessProgress.Current.Response(); } } if (appMessage != null) { WeChatAppMessageAdapter.Instance.Update(appMessage); } ProcessProgress.Current.CurrentStep = 0; ProcessProgress.Current.StatusText = ""; ProcessProgress.Current.Response(); } else { ProcessProgress.Current.MaxStep = 1; ProcessProgress.Current.CurrentStep = 0; ProcessProgress.Current.StatusText = ""; ProcessProgress.Current.Response(); var appMessage = SendOne(ddlAccount.SelectedValue, ddlGroups.SelectedItem); WeChatAppMessageAdapter.Instance.Update(appMessage); ProcessProgress.Current.Increment(); ProcessProgress.Current.Response(); } //ClientScript.RegisterStartupScript(this.GetType(), "sendComplete", "alert('发送完毕!');", true); } catch (Exception ex) { WebUtility.ResponseShowClientErrorScriptBlock(ex); } finally { this.Response.Write(SubmitButton.GetResetAllParentButtonsScript(true)); this.Response.End(); } } else { this.Response.Write(SubmitButton.GetResetAllParentButtonsScript(true)); } }
public void AuthenticateUser(string user, string password) { EmailFieldTextBox.SendKeys(user); PasswordFieldTextBox.SendKeys(password); SubmitButton.Click(); }
public void LoginIntoApplication(User user) { EmailFieldTextBox.SendKeys(user.userEmail); PasswordFieldTextBox.SendKeys(user.userPassword); SubmitButton.Click(); }
public void submit_button_with_enctype_renders_enctype() { var html = new SubmitButton("foo").EncType("test").ToString(); html.ShouldHaveHtmlNode("foo") .ShouldHaveAttribute(HtmlAttribute.FormEncType).WithValue("test"); }
#pragma warning restore 414 IEnumerator ProcessTwitchCommand(string command) { string[] parameters = command.Split(' '); if (Regex.IsMatch(command, @"^\s*send\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); SendButton.OnInteract(); yield break; } if (Regex.IsMatch(command, @"^\s*submit\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); for (int x = 0; x < 5; x++) { if (BottomRenderer[x].sprite == null) { yield return("sendtochaterror Pressing submit will only work when 5 letters have been sent!"); yield break; } } yield return("strike"); yield return("solve"); SubmitButton.OnInteract(); } if (Regex.IsMatch(parameters[0], @"^\s*left\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); if (parameters.Length == 1) { Arrows[0].OnInteract(); } else if (parameters.Length == 2) { int temp = 0; bool check = int.TryParse(parameters[1], out temp); if (!check) { yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is not a number!"); yield break; } if (temp < 1 || temp > 32) { yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is under 1 or over 32!"); yield break; } for (int i = 0; i < temp; i++) { Arrows[0].OnInteract(); yield return(new WaitForSecondsRealtime(0.1f)); } } else if (parameters.Length == 3) { int temp = 0; bool check = int.TryParse(parameters[1], out temp); if (!check) { yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is not a number!"); yield break; } if (temp < 1 || temp > 32) { yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is under 1 or over 32!"); yield break; } if (!Regex.IsMatch(parameters[2], @"^\s*slow\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return("sendtochaterror A third parameter is only valid if it's 'slow'! Your parameter: '" + parameters[2] + "'."); yield break; } for (int i = 0; i < temp; i++) { Arrows[0].OnInteract(); yield return(new WaitForSecondsRealtime(1f)); } } else if (parameters.Length > 3) { yield return("sendtochaterror Too many parameters!"); } } if (Regex.IsMatch(parameters[0], @"^\s*right\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return(null); if (parameters.Length == 1) { Arrows[1].OnInteract(); } else if (parameters.Length == 2) { int temp = 0; bool check = int.TryParse(parameters[1], out temp); if (!check) { yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is not a number!"); yield break; } if (temp < 1 || temp > 32) { yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is under 1 or over 32!"); yield break; } for (int i = 0; i < temp; i++) { Arrows[1].OnInteract(); yield return("trycancel Halted slow button presses due to a request to cancel!"); yield return(new WaitForSecondsRealtime(0.1f)); } } else if (parameters.Length == 3) { int temp = 0; bool check = int.TryParse(parameters[1], out temp); if (!check) { yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is not a number!"); yield break; } if (temp < 1 || temp > 32) { yield return("sendtochaterror The specified number of times to press the left button '" + parameters[1] + "' is under 1 or over 32!"); yield break; } if (!Regex.IsMatch(parameters[2], @"^\s*slow\s*$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)) { yield return("sendtochaterror A third parameter is only valid if it's 'slow'! Your parameter: '" + parameters[2] + "'."); yield break; } for (int i = 0; i < temp; i++) { Arrows[1].OnInteract(); yield return("trycancel Halted slow button presses due to a request to cancel!"); yield return(new WaitForSecondsRealtime(1f)); } } else if (parameters.Length > 3) { yield return("sendtochaterror Too many parameters!"); } } }
public void submit_button_with_form_renders_form() { var html = new SubmitButton("foo").Form("test").ToString(); html.ShouldHaveHtmlNode("foo") .ShouldHaveAttribute(HtmlAttribute.Form).WithValue("test"); }
/// <summary> /// シーン内の更新処理 /// </summary> public void Update() { // IPアドレス関連の更新 IpAddressText.Update(); PortNumberText.Update(); if (SaveIpAddressButton.LeftClicked()) { if (IPAddress.TryParse(IpAddressText.Text, out _) && int.TryParse(PortNumberText.Text, out _)) { SocketManager.SetAddress(IpAddressText.Text, int.Parse(PortNumberText.Text)); } } // メインの更新処理 switch (state) { // スタートボタンを押す画面 case State.Start: if (StartButton.LeftClicked()) { state = State.Select; } if (EndButton.LeftClicked()) { DX.DxLib_End(); return; } break; // 部屋を作るか、部屋に参加するか選ぶ画面 case State.Select: if (BackButton.LeftClicked()) { state = State.Start; } if (MakeRoomButton.LeftClicked()) { state = State.MakeRoom; } if (JoinRoomButton.LeftClicked()) { state = State.FindRoom; roomName.Text = string.Empty; } break; // 部屋を作る画面 case State.FindRoom: if (BackButton.LeftClicked()) { state = State.Start; } if (SubmitButton.LeftClicked()) { if (roomName.Text.Length != 0 && playerName.Text.Length != 0) { state = State.Load; Data.PlayerName = playerName.Text; Data.RoomName = roomName.Text; } IsWaitJoin = false; } if (FindRoomButton.LeftClicked()) { state = State.Popup; FindRoomWindow.IsVisible = true; } roomName.Update(); playerName.Update(); break; // 部屋に参加する画面 case State.MakeRoom: if (BackButton.LeftClicked()) { state = State.Start; } if (SubmitButton.LeftClicked()) { if (roomName.Text.Length != 0 && playerName.Text.Length != 0 && playerNum.Text.Length != 0) { state = State.Load; Data.PlayerName = playerName.Text; Data.RoomName = roomName.Text; var num = int.Parse(playerNum.Text); if (num > 4 || num < 0) { num = 4; playerNum.Text = num.ToString(); } Data.PlayerNum = num; IsWaitJoin = false; } } roomName.Update(); playerName.Update(); playerNum.Update(); break; // ロード画面 case State.Load: if (BackButton.LeftClicked()) { state = State.Start; } if (!IsWaitJoin) { IsWaitJoin = true; Task.Run(() => JoinMatch(Data.RoomName, Data.PlayerName)); } if (!LoadTexture.IsVisible()) { LoadTexture.Start(); } LoadTexture.Update(); break; // 部屋を探す画面 case State.Popup: FindRoomWindow.Update(); if (!FindRoomWindow.IsVisible) { Data.MatchInfo = FindRoomWindow.GetSelectedMatch(); roomName.Text = Data.MatchInfo.MatchKey; state = State.FindRoom; } break; // ゲームシーンに遷移する処理を行う状態 case State.ChangeGameScene: SceneManager.ChangeScene(SceneManager.SceneName.Game); break; default: break; } }
public void submit_button_with_target_self_renders_target_self() { var html = new SubmitButton("foo").TargetSelf().ToString(); html.ShouldHaveHtmlNode("foo") .ShouldHaveAttribute(HtmlAttribute.FormTarget).WithValue("_self"); }
/// <summary> /// シーン内の描画処理 /// </summary> public void Draw() { TextureAsset.Draw(LogoImageHandle, 490, 90, 300, 300, DX.TRUE); IpAddressText.Draw(); PortNumberText.Draw(); SaveIpAddressButton.Draw(); switch (state) { case State.Start: StartButton.Draw(); StartButton.DrawText(); EndButton.Draw(); EndButton.DrawText(); break; case State.Select: BackButton.Draw(); BackButton.DrawText(); MakeRoomButton.Draw(); MakeRoomButton.DrawText(); JoinRoomButton.Draw(); JoinRoomButton.DrawText(); break; case State.FindRoom: BackButton.Draw(); BackButton.DrawText(); FindRoomButton.Draw(); FindRoomButton.DrawText(); SubmitButton.Draw(); SubmitButton.DrawText(); roomName.Draw(); playerName.Draw(); FontAsset.Draw("button1Base", "部屋名", roomName.x1 - 250, roomName.y1 + 5, DX.GetColor(125, 125, 125)); FontAsset.Draw("button1Base", "プレイヤー名", playerName.x1 - 250, playerName.y1 + 5, DX.GetColor(125, 125, 125)); break; case State.MakeRoom: BackButton.Draw(); BackButton.DrawText(); SubmitButton.Draw(); SubmitButton.DrawText(); roomName.Draw(); playerName.Draw(); playerNum.Draw(); FontAsset.Draw("button1Base", "部屋名", roomName.x1 - 260, roomName.y1 + 5, DX.GetColor(125, 125, 125)); FontAsset.Draw("button1Base", "プレイヤー名", playerName.x1 - 260, playerName.y1 + 5, DX.GetColor(125, 125, 125)); FontAsset.Draw("button1Base", "人数", playerNum.x1 - 260, playerNum.y1 + 5, DX.GetColor(125, 125, 125)); break; case State.Load: BackButton.Draw(); BackButton.DrawText(); LoadTexture.Draw(); break; case State.Popup: if (FindRoomWindow.IsVisible) { FindRoomWindow.Draw(); } break; default: break; } }
void Paint(Element parent) { new Div(parent, div=>{ div.ClassName="span6 offset3 well"; div.Hide(); }) ; SearchDiv= new Div(default(Element), searchdiv=>{ searchdiv.ClassName= "span6 offset3 nav"; var inputFecha=new InputText(searchdiv, ip=>{ ip.ClassName="input-medium search-query"; ip.SetAttribute("data-mask","99.99.9999"); ip.SetPlaceHolder("dd.mm.aaaa"); }).Element(); new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-search icon-large"; abn.JSelect().Click(evt=>{ if( ! inputFecha.Value.IsDateFormatted()){ Div.CreateAlertErrorAfter(SearchDiv.Element(),"Digite una fecha valida"); return; } LoadGastos( inputFecha.Value.ToServerDate() ); }); }); BNew= new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-plus-sign icon-large"; abn.JSelect().Click(evt=>{ FormDiv.FadeIn(); GridDiv.FadeOut(); Form.Element().Reset(); BDelete.Element().Disabled=true; }); }); BDelete=new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-remove-sign icon-large"; abn.Disabled=true; abn.JSelect().Click(evt=>{ RemoveRow(); }); }); BList= new IconButton(searchdiv, (abn, ibn)=>{ ibn.ClassName="icon-reorder icon-large"; abn.Disabled=true; abn.JSelect().Click(evt=>{ FormDiv.FadeOut(); GridDiv.FadeIn(); abn.Disabled=true; }); }); }); SearchDiv.AppendTo(parent); FormDiv= new Div(default(Element), formdiv=>{ formdiv.ClassName="span6 offset3 well"; Form = new Form(formdiv, f=>{ f.ClassName="form-horizontal"; f.Action="api/Gasto/"; f.Method="post"; var inputId= new InputText(f, e=>{ e.Name="Id"; e.Hide(); }); var cbConcepto=new SelectField(f, (e)=>{ e.Name="IdConcepto"; e.ClassName="span12"; new HtmlOption(e, o=>{ o.Value=""; o.Selected=true; o.Text="Seleccione el concepto ..."; }); LoadConceptos(e); }); var cbFuente= new SelectField(f, (e)=>{ e.Name="IdFuente"; e.ClassName="span12"; new HtmlOption(e, o=>{ o.Value=""; o.Selected=true; o.Text="Seleccione la fuente de pago ..."; }); LoadFuentes(e); }); var fieldValor= new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Valor"; field.SetPlaceHolder("$$$$$$$$$$"); field.AutoNumericInit(); field.Style.TextAlign="right"; }); new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Beneficiario"; field.SetPlaceHolder("Pagado a ...."); }); new TextField(f,(field)=>{ field.ClassName="span12"; field.Name="Descripcion"; field.SetPlaceHolder("Descripcion"); }); var bt = new SubmitButton(f, b=>{ b.JSelect().Text("Guardar"); b.LoadingText(" Guardando ..."); b.ClassName="btn btn-info btn-block" ; }); var vo = new ValidateOptions() .SetSubmitHandler( form=>{ bt.ShowLoadingText(); var action= form.Action+(string.IsNullOrEmpty(inputId.Value())?"create":"update"); jQuery.PostRequest<BLResponse<Gasto>>(action, form.AutoNumericGetString(), cb=>{},"json") .Success(d=>{ Cayita.Javascript.Firebug.Console.Log("Success guardar gasto",d); if(string.IsNullOrEmpty(inputId.Value()) ) AppendRow(d.Result[0]); else UpdateRow(d.Result[0]); form.Reset(); }) .Error((request, textStatus, error)=>{ Cayita.Javascript.Firebug.Console.Log("request", request ); Cayita.Javascript.Firebug.Console.Log("error", error ); Div.CreateAlertErrorBefore(form.Elements[0], textStatus+": "+ request.StatusText); }) .Always(a=>{ bt.ResetLoadingText(); }); }) .AddRule((rule, msg)=>{ rule.Element=fieldValor.Element(); rule.Rule.Required(); msg.Required("Digite el valor del gasto"); }) .AddRule((rule, msg)=>{ rule.Element=cbConcepto.Element(); rule.Rule.Required(); msg.Required("Seleccione el concepto"); }) .AddRule((rule, msg)=>{ rule.Element=cbFuente.Element(); rule.Rule.Required(); msg.Required("Seleccione al fuente del pago"); }); f.Validate(vo); }); }); FormDiv.AppendTo(parent); GridDiv= new Div(default(Element), gdiv=>{ gdiv.ClassName="span10 offset1"; TableGastos= new HtmlTable(gdiv, table=>{ InitTable (table); }); gdiv.Hide(); }); GridDiv.AppendTo(parent); }
public void SubmitTheForm() { SubmitButton.Submit(); }