Esempio n. 1
0
        private void buttonAddContract_Click(object sender, EventArgs e)
        {
            if (this.textBoxТNumberContract.Text == "" || this.comboBoxContragents.SelectedIndex == -1 ||
                this.comboBoxOwners.SelectedIndex == -1)
            {
                return;
            }
            int  idContr = (this.comboBoxContragents.SelectedItem as Contragents).ID;
            int  idOwner = (this.comboBoxOwners.SelectedItem as owners).ID;
            bool b       = service.AddContract(textBoxТNumberContract.Text, idContr, dtFromContr.Value.Date,
                                               dtDeadLine.Value.Date, idOwner, tbCommContract.Text);

            if (b == true)
            {
                MessageBox.Show("Договор добавлен");
                this.textBoxТNumberContract.Text       = "";
                this.tbCommContract.Text               = "";
                this.comboBoxContragents.SelectedIndex = -1;
                this.comboBoxOwners.SelectedIndex      = -1;
            }
            else
            {
                MessageBox.Show("Возможно такой номер дрговора уже существуетЭ.Попробуйте еще");
            }
        }