/// <summary> /// редактировать задание /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditProject_Click(object sender, EventArgs e) { if (treeViewWorks.SelectedNode != null) { Work work = treeViewWorks.SelectedNode.Tag as Work; if (work != null) { InsertNewWorkForm frm = new InsertNewWorkForm(); frm.Text = "Редактирование задания"; frm.SelectedField = work.Field; frm.SelectedBush = work.Bush; frm.SelectedWell = work.Well; frm.SelectedDescription = work.Description; frm.SelectedDept = work.StartingDepth; if (frm.ShowDialog(this) == DialogResult.OK) { work.Field = frm.SelectedField; work.Bush = frm.SelectedBush; work.Well = frm.SelectedWell; work.Description = frm.SelectedDescription; work.StartingDepth = frm.SelectedDept; treeViewWorks.Nodes.Clear(); WorksForm_Load(this, EventArgs.Empty); } } else { MessageBox.Show(this, "Выберите задание для редактирования.", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show(this, "Выберите задание для редактирования.", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// добавляем новое задание /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InsertNewProject_Click(object sender, EventArgs e) { InsertNewWorkForm frm = new InsertNewWorkForm(); if (frm.ShowDialog(this) == DialogResult.OK) { Work work = new Work(); work.Field = frm.SelectedField; work.Bush = frm.SelectedBush; work.Well = frm.SelectedWell; work.Description = frm.SelectedDescription; work.StartingDepth = frm.SelectedDept; _app.Works.Add(work); InsertWorkToTree(work); } }
/// <summary> /// редактировать задание /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditProject_Click(object sender, EventArgs e) { if (treeViewWorks.SelectedNode != null) { Work work = treeViewWorks.SelectedNode.Tag as Work; if (work != null) { InsertNewWorkForm frm = new InsertNewWorkForm(); frm.Text = "Редактирование задания"; frm.SelectedField = work.Field; frm.SelectedBush = work.Bush; frm.SelectedWell = work.Well; frm.SelectedDescription = work.Description; frm.SelectedDept = work.StartingDepth; if (frm.ShowDialog(this) == DialogResult.OK) { work.Field = frm.SelectedField; work.Bush = frm.SelectedBush; work.Well = frm.SelectedWell; work.Description = frm.SelectedDescription; work.StartingDepth = frm.SelectedDept; treeViewWorks.Nodes.Clear(); WorksForm_Load(this, EventArgs.Empty); } } else MessageBox.Show(this, "Выберите задание для редактирования.", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); } else MessageBox.Show(this, "Выберите задание для редактирования.", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); }