public void EksperimentTyperSøgDbFRi(SearchForm searchForm) { DbConnection = new DBConnectionString(); var constring = new SqlConnection(DbConnection.DbConnectionString); constring.Open(); var sqlDataAdapter1 = new SqlDataAdapter( "Select tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblEksperimenttyper.eksperimenttype, tblMaterialetyper.materialetype, tblMaterialetyper.beskrivelse, tblPeriodetyper.periodetype from tblSagsoplysninger, tblMaterialetyper, tblEksperimenttyper, tblPeriodetyper " + " where eksperimenttype='" + searchForm.EksperimenttyperComboBox.SelectedItem + "' and tblSagsoplysninger.sagens_titel like'%" + searchForm.textboxSagstitel.Text + "%'" , constring); var datatable1 = new DataTable(); sqlDataAdapter1.Fill(datatable1); //if (datatable1.Rows.Count == 0) //{ // MessageBox.Show("Ingen rapporter fundet"); //} //else //{ // MessageBox.Show("fundet =" + datatable1.Rows.Count); //} searchForm.dataGridView1.DataSource = datatable1; constring.Close(); searchForm.Refresh(); }
public void KontaktpersonSøg(SearchForm searchForm) { DbConnection = new DBConnectionString(); var constring = new SqlConnection(DbConnection.DbConnectionString); constring.Open(); var sqlDataAdapter1 = new SqlDataAdapter( "Select tblKontaktpersoner.fornavn,tblKontaktpersoner.efternavn, tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblSagsoplysninger.dato_oprettet, tblSagsoplysninger.dato_afsluttet, tblSagsoplysninger.sags_placering from tblSagsoplysninger, tblKontaktpersoner " + "where efternavn like'%" + searchForm.textBoxKontaktperson.Text + "%'", constring); var datatable = new DataTable(); sqlDataAdapter1.Fill(datatable); searchForm.dataGridView1.DataSource = datatable; var rows = searchForm.dataGridView1.RowCount; //if (searchForm.dataGridView1.RowCount == 0) //{ // MessageBox.Show("ingen rapporter fundet!"); //} //else //{ // MessageBox.Show("Fundet: " + rows); //} constring.Close(); searchForm.dataGridView1.Refresh(); }
public void SøgSpecifiktEmnetyperFriTeskt(SearchForm searchForm) { _db = new DBConnectionstring(); var constring = new SqlConnection(_db.DbConnectionString); constring.Open(); var sqlDataAdapter1 = new SqlDataAdapter( "Select tblEmnetyper.emnetype, tblEmnetyper.beskrivelse, tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblMaterialetyper.materialetype from tblSagsoplysninger, tblEmnetyper, tblMaterialetyper" + " where emnetype='" + searchForm.comboEmnetyper.SelectedItem + "' and tblSagsoplysninger.sagens_titel like'" + searchForm.textboxSagstitel.Text + "%'" , constring); var datatable1 = new DataTable(); sqlDataAdapter1.Fill(datatable1); if (datatable1.Rows.Count == 0) { MessageBox.Show("Ingen rapporter fundet"); } else { MessageBox.Show("fundet =" + datatable1.Rows.Count); } searchForm.dataGridView1.DataSource = datatable1; searchForm.Refresh(); }
public void SøgÅrstaloprettetFrit(SearchForm searchForm) { DbConnection = new DBConnectionString(); var constring = new SqlConnection(DbConnection.DbConnectionString); constring.Open(); // searchForm.dateTimePickerOprettet.Format = DateTimePickerFormat.Custom; //searchForm.dateTimePickerOprettet.CustomFormat = "dd-MM-yyyy"; var sqlDataAdapter1 = new SqlDataAdapter( "Select tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblSagsoplysninger.dato_oprettet, tblSagsoplysninger.dato_afsluttet from tblSagsoplysninger" + " where dato_oprettet='%" + searchForm.textBoxSagoprettet.Text + "'" , constring); var datatable1 = new DataTable(); sqlDataAdapter1.Fill(datatable1); if (datatable1.Rows.Count == 0) { MessageBox.Show("Ingen rapporter fundet"); } else { MessageBox.Show("fundet =" + datatable1.Rows.Count); } searchForm.dataGridView1.DataSource = datatable1; constring.Close(); searchForm.Refresh(); }
private void button2_Click(object sender, EventArgs e) { SearchForm search = new SearchForm(); search.Size = this.Size; search.Location = this.Location; search.Show(); this.Close(); }
private void SearchLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { SearchForm search = new SearchForm(); search.Size = this.Size; search.Location = this.Location; search.Show(); this.Close(); }
public void SøgSpecifiktEmnetyperFriTeskt(SearchForm searchForm) { DbConnection = new DBConnectionString(); var constring = new SqlConnection(DbConnection.DbConnectionString); constring.Open(); var sqlDataAdapter1 = new SqlDataAdapter( "select tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblKontaktpersoner.fornavn, tblKontaktpersoner.efternavn, tblEmnetyper.emnetype,tblPeriodetyper.periodetype, tblSagsoplysningerEmnetyperLink.sagsIDref from tblSagsoplysninger " + "jOIN tblKontaktpersoner " + "ON tblSagsoplysninger.kontaktpersonIDref = tblKontaktpersoner.kontaktpersonID " + "join tblSagsoplysningerEmnetyperLink " + "on tblSagsoplysninger.sagsID = tblSagsoplysningerEmnetyperLink.sagsIDref " + "join tblEmnetyper " + "on tblSagsoplysningerEmnetyperLink.emneIDref = tblEmnetyper.emneID " + "join tblSagsoplysningerPeriodetyperLink " + "on tblSagsoplysninger.sagsID = tblSagsoplysningerPeriodetyperLink.sagsIDref " + "join tblPeriodetyper " + "on tblSagsoplysningerPeriodetyperLink.periodeIDref = tblPeriodetyper.periodeID " + "where sagens_titel " + "like'%" + searchForm.textboxSagstitel.Text + "%' " + "and emnetype " + "like'%" + searchForm.comboEmnetyper.Text + "%'"+ "and periodetype like'%" + searchForm.PeriodeTPComboBox.Text+ "%'" , constring); var datatable1 = new DataTable(); sqlDataAdapter1.Fill(datatable1); if (datatable1.Rows.Count == 0) { MessageBox.Show("Ingen rapporter fundet"); } else { MessageBox.Show("fundet =" + datatable1.Rows.Count); } searchForm.dataGridView1.DataSource = datatable1; constring.Close(); searchForm.Refresh(); }
public void FillPeriodeCombobox(SearchForm searchForm) { DbConnection = new DBConnectionString(); var constring = new SqlConnection(DbConnection.DbConnectionString); constring.Open(); var sqlDataAdapterEm = new SqlDataAdapter("select * from tblPeriodetyper order by periodetype", constring); var datatableCmEm = new DataTable(); sqlDataAdapterEm.Fill(datatableCmEm); for (var i = 0; i < datatableCmEm.Rows.Count; i++) { searchForm.PeriodeTPComboBox.Items.Add(datatableCmEm.Rows[i]["periodetype"]); } constring.Close(); }
private void okButton_Click(object sender, EventArgs e) { if (Directory.Exists(pathTextBox.Text) && searchedTextBox.Text.Contains("*.")) { chosenPath = pathTextBox.Text; SearchForm form = new SearchForm(); form.FolderPath = chosenPath; form.Argument = searchedTextBox.Text; if (searchOptionCheckBox.Checked == true) { form.Option = true; } else { form.Option = false; } form.Show(); this.Close(); } else { MessageBox.Show("Invalid arguments!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public NewTripForm() { InitializeComponent(); main = null; }
// GET: Home/Details/5 public ActionResult Details(SearchForm model) { return(View(model)); }
public SearchJobsPage(IWebDriver currentDriver) { driver = currentDriver; searchForm = new SearchForm(this); }
private void btnSearch_Click(object sender, EventArgs e) { SearchForm searcher = new SearchForm(); searcher.Show(this); }
// passed in here will the a nice big Destination2.WebUi.Search.Entities object public ActionResult index(SearchForm model) { return(View(model)); }
public MainPage SetPassengers(SearchForm searchForm) { new SelectElement(adultSelector).SelectByValue(searchForm.NumberOfAdults); new SelectElement(childrenSelector).SelectByValue(searchForm.NumberOfChildren); return(this); }
public void SearchItems() { SearchForm.SendKeys(itemname + Keys.Enter); }
private void searchToolStripMenuItem_Click(object sender, EventArgs e) { SearchForm searchForm = new SearchForm(this.currentUser, this); searchForm.ShowDialog(); }
public void ThenIShouldSeeTheNewPage() { SearchForm search = new SearchForm(driver); Assert.IsTrue(search.SuccessfullSearch()); }
/// <summary> /// Show Ingredients Main Menu /// </summary> public static void ShowIngredientsMenu() { string menuOption = new string(""); string menu = "Ingredients\n\n" + "1 - New\n" + "2 - Invetory\n" + "3 - Find\n" + "4 - Update\n" + //"5 - Delete\n" + "\nb - Back\n\n" + "Option: "; do { Console.Write(menu); menuOption = Console.ReadLine(); switch (menuOption) { case "1": ClearHelper.Clear(); IngredientForm.ShowForm(); break; case "2": ClearHelper.Clear(); ShowAll.Show(); Console.WriteLine(); Console.ReadKey(); ClearHelper.Clear(); break; case "3": ClearHelper.Clear(); SearchForm.Search(); break; case "4": ClearHelper.Clear(); ShowAll.Show(); Console.WriteLine(); Update.Show(); break; /*case "5": * ClearHelper.Clear(); * ShowAll.Show(); * Console.WriteLine(); * Delete.Show(); * break;*/ case "b": ClearHelper.Clear(); break; default: Console.WriteLine("Wrong option!"); Console.ReadKey(); ClearHelper.Clear(); break; } } while (menuOption != "b"); }
public void WhenClickOnTheSearchButton() { SearchForm search = new SearchForm(driver); search.ClickSearchButton(); }
public void WhenITypeIntoTheSearchBox(string searchWord) { SearchForm search = new SearchForm(driver); search.EnterSearchWord(searchWord); }
public void Search() { SearchField.Clear(); SearchField.SendKeys(GetProductForSearch); SearchForm.Submit(); }
public void FormEnter() { SearchForm.HitEnterKey(); }
// Finds notes by specific data private void toolStripButtonLookFor_Click(object sender, EventArgs e) { SearchForm find = new SearchForm(listViewNotes, notes); find.ShowDialog(this); }
/// <summary> /// 获取任务列表 /// </summary> /// <param name="form"></param> /// <param name="action"></param> /// <returns></returns> public async Task <Page <TaskItem> > GetTaskAsync(SearchForm form, Action <HttpException> action = null) => await http.GetAsync <Page <TaskItem> >("task", form.ToQueries(), action);
public void Keyword(string data) { SearchForm.InputText(data); }
/// <summary> /// 获取通知列表 /// </summary> /// <param name="form"></param> /// <param name="action"></param> /// <returns></returns> public async Task <Page <BulletinUser> > GetBulletinListAsync(SearchForm form, Action <HttpException> action = null) => await http.GetAsync <Page <BulletinUser> >("auth/bulletin", form.ToQueries(), action);
/// <summary> /// 获取今天任务 /// </summary> /// <param name="form"></param> /// <param name="action"></param> /// <returns></returns> public async Task <Page <TaskDay> > GetTaskDayListAsync(SearchForm form, Action <HttpException> action = null) => await http.GetAsync <Page <TaskDay> >("task/home/today", form.ToQueries(), action);
public override SearchForm GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification) { totalRows = 0; notification = new Notification() { Type = NotificationType.Success }; SearchForm data = new SearchForm(); data.Data = new List <ProductTestingSearchResultDTO>(); string productTestUD = null; string modelUD = null; string modelNM = null; string clientUD = null; string friendlyName = null; string testStandardNM = null; string testDate = null; if (filters.ContainsKey("ProductTestUD") && !string.IsNullOrEmpty(filters["ProductTestUD"].ToString())) { productTestUD = filters["ProductTestUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("ModelUD") && !string.IsNullOrEmpty(filters["ModelUD"].ToString())) { modelUD = filters["ModelUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("ModelNM") && !string.IsNullOrEmpty(filters["ModelNM"].ToString())) { modelNM = filters["ModelNM"].ToString().Replace("'", "''"); } if (filters.ContainsKey("ClientUD") && !string.IsNullOrEmpty(filters["ClientUD"].ToString())) { clientUD = filters["ClientUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("FriendlyName") && !string.IsNullOrEmpty(filters["FriendlyName"].ToString())) { friendlyName = filters["FriendlyName"].ToString().Replace("'", "''"); } if (filters.ContainsKey("TestStandardNM") && !string.IsNullOrEmpty(filters["TestStandardNM"].ToString())) { testStandardNM = filters["TestStandardNM"].ToString().Replace("'", "''"); } if (filters.ContainsKey("TestDate") && !string.IsNullOrEmpty(filters["TestDate"].ToString())) { testDate = filters["TestDate"].ToString().Replace("'", "''"); } DateTime?productTestDate = testDate.ConvertStringToDateTime(); try { using (var context = CreatContex()) { totalRows = context.ProductTestingMng_Function_SearchResult(productTestUD, modelUD, modelNM, clientUD, friendlyName, testStandardNM, productTestDate, orderBy, orderDirection).Count(); var result = context.ProductTestingMng_Function_SearchResult(productTestUD, modelUD, modelNM, clientUD, friendlyName, testStandardNM, productTestDate, orderBy, orderDirection); data.Data = converter.DB2DTO_SearchResult(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } } return(data); }
/// <summary> /// 获取任务执行记录 /// </summary> /// <param name="form"></param> /// <param name="action"></param> /// <returns></returns> public async Task <Page <TaskLog> > GetTaskReviewAsync(SearchForm form, Action <HttpException> action = null) => await http.GetAsync <Page <TaskLog> >("task/record", form.ToQueries(), action);
public Form1() { InitializeComponent(); _frm = new SearchForm(); this.Subscribe(_frm); }
/// <summary> /// 文章列表 /// </summary> /// <param name="data"></param> /// <returns></returns> public async Task <Page <Article> > GetPageAsync(SearchForm data) { return(await http.GetAsync <Page <Article> >("blog", data.ToQueries())); }
public SearchSteps(IWebDriver driver) : base(driver) { MainNavigationMenu = new MainNavigationMenuPage(); SearchForm = new SearchForm(); }
public ActionResult Search(SearchForm form) { return RedirectToAction("Index"); }
private void advSearchSubmit_Click(object sender, EventArgs e) { List<Movie> movieReults = new List<Movie>(); MovieFilter filter = new MovieFilter(); Cursor = Cursors.WaitCursor; if( titleTextBox.Text.Trim().Length > 0 ) { filter.FilterTitle(titleTextBox.Text.Trim()); } if( YearOfReleaseText.Text.Trim().Length > 0) { filter.FilterExactYear(Convert.ToInt32(YearOfReleaseText.Text.Trim())); } if( DirectorTextBox.Text.Trim().Length > 0) { filter.FilterDirector(DirectorTextBox.Text.Trim()); } if( MinimumRatingText.Text.Trim().Length > 0) { filter.FilterMinRating(MinimumRatingText.Text.Trim()); } if( actorTextBox.Text.Trim().Length > 0 ) { filter.FilterActor(actorTextBox.Text.Trim()); } if( GenreTextBox.Text.Trim().Length > 0 ) { filter.FilterGenre(GenreTextBox.Text.Trim()); } movieReults = filter.GetResult(); SearchForm search = new SearchForm(); search.PopulateView(movieReults); search.Show(); Cursor = Cursors.Default; this.Close(); }
public void ÅrstalSøgBetween(SearchForm searchForm) { DbConnection = new DBConnectionString(); var constring = new SqlConnection(DbConnection.DbConnectionString); constring.Open(); //searchForm.dateTimePickerOprettet.Format = DateTimePickerFormat.Custom; //searchForm.dateTimePickerOprettet.CustomFormat = "dd-MM-yyyy"; //searchForm.dateTimePickerAfslut.Format = DateTimePickerFormat.Custom; //searchForm.dateTimePickerAfslut.CustomFormat = "dd-MM-yyyy"; var datoOprettetList = new List<string>(); //var sqlDataAdapter1 = // new SqlDataAdapter( // "Select tblSagsoplysninger.dato_oprettet from tblSagsoplysninger" // , // constring); //var datatable1 = new DataTable(); //sqlDataAdapter1.Fill(datatable1); //searchForm.dataGridView1.DataSource = datatable1; var query = "Select tblSagsoplysninger.dato_oprettet from tblSagsoplysninger"; var sqlcmd = new SqlCommand(query, constring); var reader = sqlcmd.ExecuteReader(); while (reader.Read()) { datoOprettetList.Add(reader.GetString(0)); } searchForm.dataGridView1.DataSource = datoOprettetList; constring.Close(); searchForm.Refresh(); //Select* from tblSagsoplysninger where tblSagsoplysninger.dato_oprettet like '%1996%' }
public void WhenISubmitTheSearchForm() { var searchForm = new SearchForm(_driver); searchForm.SearchSubmit().Submit(); }
//Метод клика кнопки "найти" в форме поиска internal void ButtonFind(int mode, SearchForm searchForm, DataGridView dataGridView2) { try { switch (mode) { case 1: { //Не работало с float, хоть в БД колонка имеет тип float double price1 = double.Parse(searchForm.Controls["textBox1"].Text); double price2 = double.Parse(searchForm.Controls["textBox2"].Text); if (price1 > price2) { double temp = price1; price1 = price2; price2 = temp; } CoffeeModel.coffeeTableFound = CoffeeModel.coffeeTable.AsEnumerable() .Where(x => x["Coffee_Price"] as double? >= price1 && x["Coffee_Price"] as double? <= price2) .CopyToDataTable(); break; } case 2: { int gram1 = int.Parse(searchForm.Controls["numericUpDown1"].Text); int gram2 = int.Parse(searchForm.Controls["numericUpDown2"].Text); if (gram1 > gram2) { int temp = gram1; gram1 = gram2; gram2 = temp; } CoffeeModel.coffeeTableFound = CoffeeModel.coffeeTable.AsEnumerable() .Where(x => x["Coffee_Grams"] as int? >= gram1 && x["Coffee_Grams"] as int? <= gram2) .CopyToDataTable(); break; } case 3: { CoffeeModel.coffeeTableFound = CoffeeModel.coffeeTable.AsEnumerable() .Where(x => (x["Coffee_Country"] as string).ToLower() == ((searchForm.Controls["comboBox1"] as ComboBox).SelectedItem as string)) .CopyToDataTable(); break; } case 4: { DataTable temp = CoffeeModel.coffeeTable.AsEnumerable() .Where(x => (x["Coffee_Type"] as string).ToLower() == ((searchForm.Controls["comboBox2"] as ComboBox).SelectedItem as string)) .OrderBy(y => y["Coffee_Price"]) .Reverse() .CopyToDataTable(); CoffeeModel.coffeeTableFound = temp.AsEnumerable().Take(3).CopyToDataTable(); break; } case 5: { DataTable temp = CoffeeModel.coffeeTable.AsEnumerable() .Where(x => (x["Coffee_Type"] as string).ToLower() == ((searchForm.Controls["comboBox2"] as ComboBox).SelectedItem as string)) .OrderBy(y => y["Coffee_Price"]) .CopyToDataTable(); CoffeeModel.coffeeTableFound = temp.AsEnumerable().Take(3).CopyToDataTable(); break; } } } catch (InvalidOperationException e) { } Updater(dataGridView2); searchForm.Dispose(); }
public static void Main(string[] args) { var services = new ServiceCollection(); services.AddSingleton <ILocalizationService, DefaultLocalizationService>(); services.AddSingleton <IQuerySearchProvider <Item>, ItemQuerySearchProvider>(); services.AddSingleton <IQuerySearchProvider <MyClass>, MyClassQuerySearchProvider>(); services.AddSingleton <ItemQuerySearchProvider>(); var provider = services.BuildServiceProvider(); DependencyResolver.Current = new DependencyResolverImpl(provider); var factory = new MyDbContextFactory(); using (var ctx = factory.CreateDbContext(args)) { var term = "This is english"; var termReversed = term.Reverse(); var output = new string(termReversed.ToArray()); //var c = new MyClass() { SomeText = $"{term}. {output}" }; //var cf = new MyRefClass { MyClass = c, Whatver = ":):):)" }; //ctx.MyClasses.Add(c); //ctx.MyRefClasses.Add(cf); //ctx.MyClasses.Add(new MyClass() { SomeText = "Dette er dansk!" }); ctx.SaveChanges(); var form = new SearchForm { PageSize = 100, OrderByTerm = true, Term = "english" }; var result = ctx.MyClasses.Search(form, q => q.Include(x => x.MyRefClass)); Console.ReadKey(); } //var id = Guid.NewGuid(); //var items = new List<Item> //{ // new Item { Lol = "Hehehe", Id = id }, // new Item { Lol = "ABC", Id = Guid.NewGuid() }, //}; //var form = new SearchForm //{ // //OrderBy = "lol desc", // PageSize = 10, // //ParameterComposition = FilterComposition.Or, // //Parameters = new List<PropertyComparison> // //{ // // new PropertyComparison // // { // // Path = "lol", // // Type = ComparisonType.Contains, // // Value = "ehe" // // }, // // new PropertyComparison // // { // // Path = "Id", // // Type = ComparisonType.Equal, // // Value = Guid.NewGuid() // // }, // //} //}; //var result = items.AsQueryable().Search<Item, ItemQuerySearchProvider>( form ); //Console.ReadKey(); }
private void InitLoad() { form = new SearchForm(null); if (btnCancel == null) { btnCancel = new UIBarButtonItem(); btnCancel.Title = "Cancel"; btnCancel.TintColor = UIColor.Gray; btnCancel.Clicked += (sender, e) => { stepOn--; if (stepOn > 0) { if (stepOn == 1) { SearchStep1(); } else if (stepOn == 2) { SearchStep2(); } else { SearchStep3(); } } else { app.RootController.ToolbarHidden = true; app.RootController.PopViewControllerAnimated(true); } }; btnSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); } if (btnNext == null) { btnNext = new UIBarButtonItem(); btnNext.Title = "Next"; btnNext.Clicked += (sender, e) => { //postData if (btnNext.Title.Contains("Searching")) { //var v = View.FindFirstResponder(); Console.Write(postData); form.PostSearch(postData); app.ShowResultList(); } else { stepOn++; if (stepOn == 2) { SearchStep2(); } else if (stepOn == 3) { SearchStep3(); } else { SearchStep1(); stepOn = 1; } } }; } }
public ActionResult SearchFormPartialView_Update(SearchForm searchForm) { TempData["SearchForm"] = searchForm; return(RedirectToAction(searchForm.ViewName)); }
//Кнопка создать создает новый товар и записывает данные о нем из полей формы в БД таблицу comics. private void Createbutton_Click(object sender, EventArgs e) { //проверка заполненности полей, в случае незаполнения какого-либо поля выводится вообщение для того чтобы пользователь его заполнил. if (NameField.Text == "") { MessageBox.Show("Введите название товара"); return; } if (URLTextBox.Text == "") { MessageBox.Show("Введите URL изображения"); return; } if (AuthorField.Text == "") { MessageBox.Show("Укажите автора"); return; } if (ArtistField.Text == "") { MessageBox.Show("Укажите художника"); return; } if (PublishField.Text == "") { MessageBox.Show("Укажите издателя"); return; } if (GenreField.Text == "") { MessageBox.Show("Укажите жанр"); return; } if (PriceField.Text == "") { MessageBox.Show("Укажите цену на товар"); return; } if (CountField.Text == "") { MessageBox.Show("Укажите количетво товаров"); return; } if (DescriptionField.Text == "") { MessageBox.Show("Укажите описание"); return; } //если такой товар уже существует то кнопка ничего не делает. if (isProductExist()) { return; } //создание команды для SQL запроса. UsersDB db = new UsersDB(); MySqlCommand command = new MySqlCommand("INSERT INTO `comics`(`name_c`, `picture`, `description`, `price`, `count`, `author`, `genre`, `publish`, `artist`) VALUES (@name, @pic, @desc, @price, @count, @author, @genre, @publ, @artist)", db.getConnection()); command.Parameters.Add("@name", MySqlDbType.VarChar).Value = NameField.Text; command.Parameters.Add("@pic", MySqlDbType.VarChar).Value = URLTextBox.Text; command.Parameters.Add("@desc", MySqlDbType.VarChar).Value = DescriptionField.Text; command.Parameters.Add("@price", MySqlDbType.VarChar).Value = PriceField.Text; command.Parameters.Add("@count", MySqlDbType.VarChar).Value = CountField.Text; command.Parameters.Add("@author", MySqlDbType.VarChar).Value = AuthorField.Text; command.Parameters.Add("@genre", MySqlDbType.VarChar).Value = GenreField.Text; command.Parameters.Add("@publ", MySqlDbType.VarChar).Value = PublishField.Text; command.Parameters.Add("@artist", MySqlDbType.VarChar).Value = ArtistField.Text; db.openConnection(); //запись данных в таблицу. if (command.ExecuteNonQuery() == 1) { SearchForm newForm = new SearchForm(""); newForm.Left = this.Left; newForm.Top = this.Top; newForm.Show(); this.Hide(); MessageBox.Show("Товар добавлен успешно!"); } //обработка ошибки выполнения SQL команды. else { MessageBox.Show("Ошибка."); } db.closeConnection(); }
public void Delete() { Program.UpdateMovieDataBase(null, editingMovie); sentBy.Close(); SearchForm search = new SearchForm(); search.Location = this.Location; search.Show(); this.Close(); }