Esempio n. 1
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     docHead.DocType      = TENDER; //Заявка
     docHead.DocumentDate = dtpDateDoc.Value;
     if (chkParentDocument.Checked)
     {
         docHead.DocumentParent = int.Parse(txtParentDocNum.Text);
     }
     docHead.RPInfo = (int)cmbRP.SelectedValue;
     if (docHead.DocumentNumber == 0)
     {
         MessageBox.Show("Возникла ошибка при создании документа.\nНеверный номер документа.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     try
     {
         IForecastDocument document = ForecastDocumentFactory.CreateDocument(docHead, Data);
         if (document == null)
         {
             throw new Exception();
         }
         Doc = document as ForecastDocument;
         string message = "Документ № " + document.Head.DocumentNumber.ToString() + " успешно создан.\nПерейти к редактированию?";
         if (MessageBox.Show(message, "Информация", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
             this.DialogResult = DialogResult.Yes;
         }
     }
     catch (Exception exception)
     {
         ErrorMsgBox.Show("Ошибка", "Возникла ошибка при создании документа.\n" + exception.Message, exception.ToString());
     }
     this.Dispose();
 }
Esempio n. 2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (gridForecastDocuments.SelectedRows.Count > 0)
     {
         try
         {
             int docid = (int)gridForecastDocuments.SelectedRows[0].Cells["DocumentID"].Value;
             ForecastDocument document = ForecastDocumentFactory.LoadDocument(docid, GlobalValues.Instance);
             FormTender       edit     = new FormTender(document, GlobalValues.Instance);
             edit.Show();
         }
         catch (Exception exc)
         {
             ErrorMsgBox.Show("Ошибка", "Ошибка редактирования документа\r\n" + exc.Message, exc.ToString());
             return;
         }
     }
 }
Esempio n. 3
0
 private void btnDeleteTender_Click(object sender, EventArgs e)
 {
     if (gridForecastDocuments.SelectedRows.Count > 0)
     {
         try
         {
             int docid = (int)gridForecastDocuments.SelectedRows[0].Cells["DocumentID"].Value;
             ForecastDocument document = ForecastDocumentFactory.LoadDocument(docid, GlobalValues.Instance);
             if (MessageBox.Show("Вы хотите удалить документ № " + docid.ToString(), "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
             {
                 if (document.DeleteDocument())
                 {
                     MessageBox.Show("Документ № " + docid.ToString() + " удалён.");
                 }
             }
         }
         catch (Exception exc)
         {
             ErrorMsgBox.Show("Ошибка", "Ошибка удаления документа\r\n" + exc.Message, exc.ToString());
             return;
         }
     }
 }