Пример #1
0
 private void bt_Cr_n_Close_Click(object sender, EventArgs e)        // создать и закрыть
 {
     if (String.IsNullOrWhiteSpace(tbAuditor.Text) || String.IsNullOrWhiteSpace(tbKaf.Text) || String.IsNullOrWhiteSpace(tbCorpus.Text) || !byte.TryParse(tbCorpus.Text, out a) || String.IsNullOrWhiteSpace(nuPlaces.Text))
     {
         MessageBox.Show("Заполните все поля корректно");
     }
     else
     {
         MAuditor Auditor = new MAuditor(tbAuditor.Text, tbKaf.Text, (ushort)nuPlaces.Value, Convert.ToByte(tbCorpus.Text));
         try
         {
             if (!itsupdate)
             {
                 Controllers.CAuditor.Insert(Auditor);
             }
             else
             {
                 Controllers.CAuditor.Update(Auditor);
             }
             Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Пример #2
0
 private void bt_Cr_n_Close_Click(object sender, EventArgs e)// создать и закрыть
 {
     if (String.IsNullOrWhiteSpace(tbAuditor.Text) || String.IsNullOrWhiteSpace(tbKaf.Text) || String.IsNullOrWhiteSpace(tbCorpus.Text) || String.IsNullOrWhiteSpace(tbCorpus.Text) || String.IsNullOrWhiteSpace(nuPlaces.Text) || nuPlaces.Value == 0)
     {
         MessageBox.Show("Заполните все поля корректно");
     }
     else
     {
         MAuditor Auditor = new MAuditor(tbAuditor.Text, tbKaf.Text, (ushort)nuPlaces.Value, tbCorpus.Text);
         try
         {
             if (!itsupdate)
             {
                 if (!Program.refData.CAuditor.Insert(Auditor))
                 {
                     MessageBox.Show("Невозможно добавить аудиторию");
                     return;
                 }
             }
             else
             {
                 Program.refData.CAuditor.Update(Auditor);
             }
             Close();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Пример #3
0
        private void btDelAuditor_Click(object sender, EventArgs e)
        {
            string SelectedName = "";

            foreach (DataGridViewRow row in DataGridAuditor.SelectedRows)
            {
                DataRow Row = ((DataRowView)row.DataBoundItem).Row;
                SelectedName += (string)Row["NameOfAuditor"] + ", ";
            }
            if (SelectedName.Length > 2)
            {
                SelectedName = SelectedName.Remove(SelectedName.Length - 2);
            }
            DialogResult dr = MessageBox.Show("Удалить аудиторию - " + SelectedName + "?", "Подтверждение", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (DataGridAuditor.SelectedRows.Count > 0 && dr == DialogResult.OK)
            {
                int countSelected = DataGridAuditor.SelectedRows.Count;

                MAuditor mAuditor;
                foreach (DataGridViewRow row in DataGridAuditor.SelectedRows)
                {
                    DataRow Row = ((DataRowView)row.DataBoundItem).Row;
                    mAuditor = new MAuditor((string)Row["NameOfAuditor"], (string)Row["Cafedra"], (ushort)Row["Spacious"], (byte)Row["Building"]);
                    Controllers.CAuditor.Delete(mAuditor);
                }
            }
        }
Пример #4
0
 public AddAuditor(MAuditor mAuditor)
 {
     InitializeComponent();
     this.Text          = "Изменение дисциплины";
     bt_Cr_n_Cl.Visible = false;
     bt_Cr_n_Close.Text = "Сохранить";
     tbAuditor.Text     = mAuditor.NameOfAuditor;
     tbAuditor.Enabled  = false;
     tbKaf.Text         = mAuditor.Cafedra;
     tbCorpus.Text      = Convert.ToString(mAuditor.Building);
     tbCorpus.Enabled   = false;
     nuPlaces.Value     = mAuditor.Spacious;
     itsupdate          = true;
 }
Пример #5
0
 private void btChange_Click(object sender, EventArgs e)
 {
     if (DataGridAuditor.SelectedRows.Count == 1)
     {
         DataRow    Row      = ((DataRowView)DataGridAuditor.SelectedRows[0].DataBoundItem).Row;
         MAuditor   mAuditor = new MAuditor((string)Row["NameOfAuditor"], (string)Row["Cafedra"], (ushort)Row["Spacious"], (byte)Row["Building"]);
         AddAuditor add      = new AddAuditor(mAuditor);
         add.Owner = this;
         add.ShowDialog();
     }
     else
     {
         MessageBox.Show("Для изменения выделите только одну строку!");
     }
 }