private void btnEditPlan_Click(object sender, EventArgs e) { if (gridPlanDocuments.SelectedRows.Count > 0) { try { IInputDocument doc = InputDocFactory.LoadDocument((int)gridPlanDocuments.SelectedRows[0].Cells["DocumentID"].Value, GlobalValues.Instance); FormInputDoc edit = new FormInputDoc(doc, GlobalValues.Instance); edit.Show(); edit.Activate(); } catch (Exception exc) { ErrorMsgBox.Show("Ошибка", "Ошибка редактирования документа\r\n" + exc.Message, exc.ToString()); return; } } }
private void btnCreatePlan_Click(object sender, EventArgs e) { try { CreateInputDoc create = new CreateInputDoc(GlobalValues.Instance); create.ShowDialog(); if (create.DialogResult == DialogResult.Yes) { FormInputDoc edit = new FormInputDoc(create.Document, GlobalValues.Instance); edit.Show(); edit.Activate(); } } catch (Exception exc) { ErrorMsgBox.Show("Ошибка", "Ошибка создания документа\r\n" + exc.Message, exc.ToString()); return; } }