Beispiel #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            specificationWork specWork = new specificationWork(maskedTbNumber.Text.Replace(',', '.'));

            specWork.MdiParent = this.Owner;
            specWork.Show();
        }
Beispiel #2
0
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex == -1)
         {
         }
         else
         {
             foreach (Form o in this.MdiParent.MdiChildren)
             {
                 if (o.Text == dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString())
                 {
                     o.Activate();
                     return;
                 }
             }
             specificationWork specWork = new specificationWork(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
             specWork.MdiParent   = this.ParentForm;
             specWork.WindowState = FormWindowState.Maximized;
             specWork.Show();
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.ToString());
     }
 }
Beispiel #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string addNumber = maskedTbNumber.Text.Replace(',', '.');

            add.Количество = (int)numericUpDown1.Value;
            PelengEntities pe         = new PelengEntities();
            var            assemblies = (from m in pe.Сборки
                                         where m.НомерСборки == addNumber
                                         select m);
            List <string> inAssemblies = new List <string>();

            listAssembly(add.НомерСборки, inAssemblies);
            if (assemblies.Count() != 0)
            {
                if (addNumber == add.НомерСборки)
                {
                    string message = "Сборка " + addNumber + " не может входить сама в себя!";
                    MessageBox.Show(message, "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.DialogResult = DialogResult.None;
                }
                else if (!inAssemblies.Contains(addNumber))
                {
                    add.НомерВхСборки = addNumber;
                }
                else
                {
                    string message = "Сборка " + addNumber + " не может входить в сборку " + add.НомерСборки + " !";
                    MessageBox.Show(message, "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.DialogResult = DialogResult.None;
                }
            }
            else
            {
                if (MessageBox.Show("Спецификация с таким номером не существует.\nСоздать данную спецификацию?", "Внимание!",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    specificationWork specWork = new specificationWork(addNumber);
                    if (specWork.ShowDialog(this.ParentForm) == DialogResult.OK)
                    {
                        add.НомерВхСборки = addNumber;
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        this.DialogResult = DialogResult.Cancel;
                    }
                }
                else
                {
                    this.DialogResult = DialogResult.None;
                }
            }
        }