private void ClearForm() { if (AutoPartId == 0) { AutoPartTextbox.Clear(); DescriptionTextbox.Clear(); MakeTextbox.Clear(); ModelTextbox.Clear(); brandBindingSource.Position = -1; BrandDropdown.SelectedIndex = -1; SellingPriceTextbox.Text = "0.00"; SellingPrice2Textbox.Text = "0.00"; PurchasePriceTextbox.Text = "0.00"; ReorderTextbox.Text = "0"; InitialQtyTextbox.Text = "0"; UnitTextbox.Clear(); PartNumberTextbox.Clear(); SizeTextbox.Clear(); AltTextbox.Clear(); PictureTextbox.Clear(); } else { LoadPartDetails(); } }
private void ClearScreen() { SiteNameTextbox.Clear(); LatitudeTextbox.Clear(); LongitudeTextbox.Clear(); DescriptionTextbox.Clear(); TownsCombobox.Items.Clear(); }
private void SaveFile_Button_Click(object sender, EventArgs e) { if (AlertGroupTextbox.Text == AGTEXT || DescriptionTextbox.Text == DESCTEXT || SolutionsTextbox.Text == SLNTEXT) { return; } DialogResult result; if (AlertGroupTextbox.Text == "") { return; } if (DescriptionTextbox.Text == "") { result = MessageBox.Show("You have to write a description and add solutions.", "Saving Denied", MessageBoxButtons.OK, MessageBoxIcon.Error); if (result == DialogResult.Cancel) { return; } } if (DescriptionTextbox.Text != "") { result = MessageBox.Show("Have you finished writing everything?" + "\r\n" + "Also, make sure your info is correct and valid.", "Confirm Saving?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { return; } String AlertGroup = AlertGroupTextbox.Text; String DirectoryPath = @"E:\DB"; String Path = DirectoryPath + @"\" + AlertGroup + ".txt"; String text = "Alert Description:" + "\r\n" + DescriptionTextbox.Text + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "Suggested Solution: " + "\r\n" + SolutionsTextbox.Text; File.WriteAllText(Path, text); MessageBox.Show("Your alert has been added", "New Alert", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); AlertGroupTextbox.Clear(); DescriptionTextbox.Clear(); SolutionsTextbox.Clear(); } }
//[FindsBy(How = How.XPath, Using = "//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr/td[4]")] //private IWebElement ItemToDelete { get; set; } //[FindsBy(How = How.XPath, Using = "")] //private IWebElement { get; set; } //[FindsBy(How = How.XPath, Using = "")] //private IWebElement { get; set; } #endregion internal void AddSkill() { //Populate the Excel sheet Global.GlobalDefinitions.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Skill"); ShareSkillBtn.Click(); Global.GlobalDefinitions.wait(5); TitleTextbox.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Title")); DescriptionTextbox.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description")); CategoryDropdown.Click(); var category = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div/select")); var selectElement = new SelectElement(category); selectElement.SelectByIndex(3); SubcategoryDropdown.Click(); var subcategory = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[3]/div[2]/div/div[2]/div[1]/select")); var selectElement1 = new SelectElement(subcategory); selectElement1.SelectByIndex(3); TagsTextbox.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); TagsTextbox.SendKeys(Keys.Enter); TagsTextbox1.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(3, "Tags")); TagsTextbox1.SendKeys(Keys.Enter); OneoffService.Click(); Thread.Sleep(500); HourlyService.Click(); Thread.Sleep(500); OnSite.Click(); Thread.Sleep(500); Online.Click(); StartdateTextbox.Click(); StartdateTextbox.SendKeys(DateTime.Now.AddDays(5).ToString("dd/MM/yyyy")); EnddateTextbox.Click(); EnddateTextbox.SendKeys(DateTime.Now.AddMonths(1).ToString("dd/MM/yyyy")); SunCheckBox.Click(); SunStartTime.Click(); SunStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour")); SunStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes")); SunStartTime.SendKeys(Keys.Up); SunEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour")); SunEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes")); SunEndTime.SendKeys(Keys.ArrowDown); MonCheckBox.Click(); MonStartTime.Click(); MonStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour")); MonStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes")); MonStartTime.SendKeys(Keys.Up); MonEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour")); MonEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes")); MonEndTime.SendKeys(Keys.ArrowDown); TueCheckBox.Click(); TueStartTime.Click(); TueStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour")); TueStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes")); TueStartTime.SendKeys(Keys.Up); TueEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour")); TueEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes")); TueEndTime.SendKeys(Keys.ArrowDown); WedCheckBox.Click(); WedStartTime.Click(); WedStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour")); WedStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes")); WedStartTime.SendKeys(Keys.Up); WedEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour")); WedEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes")); WedEndTime.SendKeys(Keys.ArrowDown); ThuCheckBox.Click(); ThuStartTime.Click(); ThuStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour")); ThuStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes")); ThuStartTime.SendKeys(Keys.Up); ThuEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour")); ThuEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes")); ThuEndTime.SendKeys(Keys.ArrowDown); FriCheckBox.Click(); FriStartTime.Click(); FriStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour")); FriStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes")); FriStartTime.SendKeys(Keys.Up); FriEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour")); FriEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes")); FriEndTime.SendKeys(Keys.ArrowDown); SatCheckBox.Click(); SatStartTime.Click(); SatStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartHour")); SatStartTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "StartMinutes")); SatStartTime.SendKeys(Keys.Up); SatEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndHour")); SatEndTime.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "EndMinutes")); SatEndTime.SendKeys(Keys.ArrowDown); SkillExchangeButton.Click(); SkillExchangeTag.Click(); SkillExchangeTag.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "SkillToExchange")); SkillExchangeTag.SendKeys(Keys.Enter); CreditButton.Click(); CreditAmount.Click(); CreditAmount.SendKeys(Global.GlobalDefinitions.ExcelLib.ReadData(2, "CreditAmount")); PlusCircleIcon.Click(); //Upload file AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); autoIt.Send(@"C:\Users\Nemesis\Pictures\TanslatePix\zodiac.jpg"); Thread.Sleep(500); autoIt.Send("{ENTER}"); Thread.Sleep(500); PlusCircleIcon.Click(); AutoItX3 autoIt1 = new AutoItX3(); autoIt1.WinActivate("Open"); Thread.Sleep(500); autoIt1.Send(@"C:\Users\Nemesis\Pictures\TanslatePix\doggie.jpg"); Thread.Sleep(500); autoIt1.Send("{ENTER}"); Thread.Sleep(500); RemoveItem.Click(); HiddenRadioButton.Click(); Thread.Sleep(1000); ActiveRadioButton.Click(); SaveButton.Click(); Global.GlobalDefinitions.wait(5); //Add Skill Verification ManageListingsTab.Click(); Global.GlobalDefinitions.wait(5); string ExpectedText = Global.GlobalDefinitions.ExcelLib.ReadData(2, "Description"); string ActualText = Global.GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/table/tbody/tr/td[4]")).Text; if (ExpectedText.Equals(ActualText)) { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Add Skill Successful"); String img = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "AddSkill_Pass"); test.Log(LogStatus.Info, "Image example: " + img); } else { Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Add Skill UnSuccessful"); String img1 = SaveScreenShotClass.SaveScreenshot(GlobalDefinitions.driver, "AddSkill_Fail"); test.Log(LogStatus.Info, "Image example: " + img1); } }