newTovarForm.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace Brovi07.session1
  11. {
  12. public partial class newTovarForm : Form
  13. {
  14. public newTovarForm()
  15. {
  16. InitializeComponent();
  17. }
  18. private void productBindingNavigatorSaveItem_Click(object sender, EventArgs e)
  19. {
  20. this.Validate();
  21. this.productBindingSource.EndEdit();
  22. this.tableAdapterManager.UpdateAll(this.broviDataSet);
  23. }
  24. private void newTovarForm_Load(object sender, EventArgs e)
  25. {
  26. // TODO: данная строка кода позволяет загрузить данные в таблицу "broviDataSet.Product". При необходимости она может быть перемещена или удалена.
  27. this.productTableAdapter.Fill(this.broviDataSet.Product);
  28. }
  29. private void firstButton_Click(object sender, EventArgs e)
  30. {
  31. productBindingSource.MoveFirst();
  32. }
  33. private void lastButton_Click(object sender, EventArgs e)
  34. {
  35. productBindingSource.MoveLast();
  36. }
  37. private void prevButton_Click(object sender, EventArgs e)
  38. {
  39. productBindingSource.MovePrevious();
  40. }
  41. private void nextButton_Click(object sender, EventArgs e)
  42. {
  43. productBindingSource.MoveNext();
  44. }
  45. private void saveButtton_Click(object sender, EventArgs e)
  46. {
  47. MessageBoxButtons mb = MessageBoxButtons.YesNo;
  48. String message = "Вы действительно хотите сохранить данные?";
  49. String caption = "Выход";
  50. if (MessageBox.Show(message, caption, mb) == DialogResult.Yes)
  51. {
  52. this.Validate();
  53. this.productBindingSource.EndEdit();
  54. this.tableAdapterManager.UpdateAll(this.broviDataSet);
  55. }
  56. }
  57. private void delButton_Click(object sender, EventArgs e)
  58. {
  59. MessageBoxButtons mb = MessageBoxButtons.YesNo;
  60. String message = "Вы действительно хотите удалить данные?";
  61. String caption = "Выход";
  62. if (MessageBox.Show(message, caption, mb) == DialogResult.Yes)
  63. productBindingSource.RemoveCurrent();
  64. }
  65. private void addButton_Click(object sender, EventArgs e)
  66. {
  67. productBindingSource.AddNew();
  68. }
  69. private void exitButton_Click(object sender, EventArgs e)
  70. {
  71. this.Close();
  72. editTovarForm form = new editTovarForm();
  73. form.Show();
  74. }
  75. }
  76. }