private void miAddTask_Click(object sender, EventArgs e) { if (SharedAppData.IsAccesible(TaskEditor.ObjectAccessId)) { TaskEditor taskEditor = new TaskEditor(_dataContexts,TaskEditor.FormState.FormNew) {Text = @"Добавление работы"}; if (taskEditor.ShowDialog(this) == DialogResult.OK) { RefreshCurrentPage(); _clientProcessor.SendEventNotify(Guid.NewGuid()); FocusChangedWork(taskEditor.EditedWorkId); } } else { MessageBox.Show(@"Отсутсвуют права на использование [" + TaskEditor.ObjectAccessId.Description + @"]!"); } }
private void miChangeTask_Click(object sender, EventArgs e) { if (SharedAppData.IsAccesible(TaskEditor.ObjectAccessId)) { if (gvWorkTasks.SelectedRows.Count != 1) return; WorkInfo selectedWork = gvWorkTasks.SelectedRows[0].DataBoundItem as WorkInfo; if (selectedWork == null) throw new InvalidCastException(); TaskEditor.FormState state = SharedAppData.IsFlagSet(ObjectAccessId, RightsFlags.Change) ? TaskEditor.FormState.FormEdit : TaskEditor.FormState.FormView; TaskEditor taskEditor = new TaskEditor(_dataContexts, state,selectedWork.WorkId); if (taskEditor.ShowDialog(this) == DialogResult.OK) { RefreshCurrentPage(); _clientProcessor.SendEventNotify(Guid.NewGuid()); FocusChangedWork(taskEditor.EditedWorkId); } } else { MessageBox.Show(@"Отсутсвуют права на использование [" + TaskEditor.ObjectAccessId.Description + @"]!"); } }