| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.ComponentModel;
 
- using System.Data;
 
- using System.Drawing;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows.Forms;
 
- namespace СУБД_Альфапол
 
- {
 
-     public partial class FormAddEdit : Form
 
-     {
 
-         public FormAddEdit()
 
-         {
 
-             InitializeComponent();
 
-         }
 
-         private void FormAddEdit_Load(object sender, EventArgs e)
 
-         {
 
-             // TODO: This line of code loads data into the 'dbAlphapolAGDataSet.Street' table. You can move, or remove it, as needed.
 
-             this.streetTableAdapter.Fill(this.dbAlphapolAGDataSet.Street);
 
-             // TODO: This line of code loads data into the 'dbAlphapolAGDataSet.IndexPartner' table. You can move, or remove it, as needed.
 
-             this.indexPartnerTableAdapter.Fill(this.dbAlphapolAGDataSet.IndexPartner);
 
-             // TODO: This line of code loads data into the 'dbAlphapolAGDataSet.City' table. You can move, or remove it, as needed.
 
-             this.cityTableAdapter.Fill(this.dbAlphapolAGDataSet.City);
 
-             // TODO: This line of code loads data into the 'dbAlphapolAGDataSet.Region' table. You can move, or remove it, as needed.
 
-             this.regionTableAdapter.Fill(this.dbAlphapolAGDataSet.Region);
 
-             // TODO: This line of code loads data into the 'dbAlphapolAGDataSet.TypePartner' table. You can move, or remove it, as needed.
 
-             this.typePartnerTableAdapter.Fill(this.dbAlphapolAGDataSet.TypePartner);
 
-             // TODO: This line of code loads data into the 'dbAlphapolAGDataSet.Partner' table. You can move, or remove it, as needed.
 
-             this.partnerTableAdapter.Fill(this.dbAlphapolAGDataSet.Partner);
 
-             if(lblTitle.Text == "Добавление партнера")
 
-             {
 
-                 bsPartner.AddNew();
 
-             }
 
-         }
 
-         private void btnSave_Click(object sender, EventArgs e)
 
-         {
 
-             if(tbxNamePartner.Text == "" || tbxEmail.Text == "" || tbxHouse.Text == "" || tbxName.Text == "" || tbxPatronymic.Text == "" || tbxPhone.Text == "" || tbxRating.Text == "" || tbxSurname.Text == "" || cbxCity.SelectedIndex == -1 || cbxIndex.SelectedIndex == -1 || cbxRegion.SelectedIndex == -1 || cbxStreet.SelectedIndex == -1 || cbxTypePartner.SelectedIndex == -1)
 
-             {
 
-                 MessageBox.Show("Поля не должны быть пустыми!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
-                 return;
 
-             }
 
-             if (int.Parse(tbxRating.Text) < 0)
 
-             {
 
-                 MessageBox.Show("Рейтинг не может быть отрицательным!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
-                 return;
 
-             }
 
-             bsPartner.EndEdit();
 
-             this.partnerTableAdapter.Update(this.dbAlphapolAGDataSet.Partner);
 
-             Close();
 
-         }
 
-         // если текстовое поле связано с БД, то при попытке сохранить изменения наступает событие Validating, в обработчике этого события можно выводить сообщения об ошибке
 
-         private void tbxRating_Validating(object sender, CancelEventArgs e)
 
-         {
 
-             try
 
-             {
 
-                 int r = int.Parse(tbxRating.Text);
 
-             }
 
-             catch 
 
-             {
 
-                 MessageBox.Show("Рейтинг должен быть целым не отрицательным числом!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |