private void AddingButton_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(AddName.Text) && !string.IsNullOrWhiteSpace(AddDescription.Text) && !string.IsNullOrWhiteSpace(AddPrice.Text) && !string.IsNullOrWhiteSpace(AddQuantity.Text)) { try { string InsertQuery = "insert into items(ITEM_NAME,ITEM_PRICE,ITEM_DESCRIPTION,ITEM_QUANTATY) VALUES('" + AddName.Text + "','" + int.Parse(AddPrice.Text) + "','" + AddDescription.Text + "'," + int.Parse(AddQuantity.Text) + ")"; connection.Open(); MySqlCommand cmd = new MySqlCommand(InsertQuery, connection); cmd.ExecuteNonQuery(); } catch (MySqlException ex) { MessageBox.Show(ex.ToString()); } finally { connection.Close(); MessageBox.Show("Successfully Added", "Success"); AddName.Clear(); AddDescription.Clear(); AddPrice.Clear(); AddQuantity.Clear(); } } else { MessageBox.Show("incorrect input", "ERROR"); } }
public void EditExistingSkill() { //initialize excel sheet by calling the ExcelLib GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "EditSkill"); ManageListinTab.Click(); EditSkillIcon.Click(); UpdateTitle.Clear(); UpdateTitle.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); AddDescription.Clear(); AddDescription.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); AddTags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); enterBtn.SendKeys(Keys.Return).Perform(); AvailableDays.Click(); AvailableStartTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Start Time")); AvailableEndTime.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "End Time")); SaveSkill.Click(); //GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("//div[@class='ns-box ns-growl ns-effect-jelly ns-type-success ns-show']/div"), 10); }