Пример #1
0
 private void BtnForAction_Click(object sender, EventArgs e)
 {
     if (TxtSurname.Text != string.Empty && TxtName.Text != string.Empty && TxtInn.Text != string.Empty && TxtAdress.Text != string.Empty && TxtPhone.Text != string.Empty)
     {
         if (Action == 1)
         {
             EntityCounteragent counteragent = new EntityCounteragent();
             counteragent.AddCounteragent(TxtSurname.Text, TxtName.Text, TxtMiddleName.Text, TxtInn.Text, TxtAdress.Text, TxtPhone.Text, RoleId);
             this.Close();
         }
         else
         {
             EntityCounteragent counteragent = new EntityCounteragent();
             counteragent.ChangeCounteragent(TxtSurname.Text, TxtName.Text, TxtMiddleName.Text, TxtInn.Text, TxtAdress.Text, TxtPhone.Text, IdCounterAgent);
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("Заполните все необходимые поля!");
     }
 }
Пример #2
0
 private void BtnForAction_Click(object sender, EventArgs e)
 {
     if (TxtSurname.Text != string.Empty && TxtName.Text != string.Empty && TxtInn.Text != string.Empty && TxtAdress.Text != string.Empty && TxtPhone.Text != string.Empty)
     {
         if (Action == 1) //Добавление пользователя
         {
             EntityCounteragent counteragent = new EntityCounteragent();
             counteragent.AddCounteragent(TxtSurname.Text, TxtName.Text, TxtMiddleName.Text, TxtInn.Text, TxtAdress.Text, TxtPhone.Text, RoleId);
             this.Close();
         }
         else //Редактирование пользователя
         {
             EntityCounteragent counteragent = new EntityCounteragent();
             counteragent.ChangeCounteragent(TxtSurname.Text, TxtName.Text, TxtMiddleName.Text, TxtInn.Text, TxtAdress.Text, TxtPhone.Text, IdCounterAgent);
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("Введите данные!");
     }
 }