private void ApplyFilter_Click(object sender, EventArgs e) { ArrayRequests result = RequestDB.GetInstance().GetRequests(); if (checkBox1.Checked) { result = result.GetRequestsCreateBetweenDate(dateTimePicker1.Value); } else if (comboBox1.SelectedIndex != -1) { result = result.GetRequestsByStatus((RequestStatus)comboBox1.SelectedItem); } else if (Priority.SelectedIndex != -1) { result = result.GetRequestsByPriority((RequestPriority)Priority.SelectedItem); } else if (worker.SelectedIndex != -1) { result = result.GetRequestsByWorker((Worker)worker.SelectedItem); } else if (client.SelectedIndex != -1) { result = result.GetRequestsByClient((Client)client.SelectedItem); } ShowRequests(result.requests); }
public static RequestDB GetInstance() { if (instance == null) { instance = new RequestDB(); } return(instance); }
private static void Application_ApplicationExit( object sender, EventArgs e) { ClientDB.GetInstance().Save(); WorkerDB.GetInstance().Save(); RequestDB.GetInstance().Save(); RequestStatusDB.GetInstance().Save(); }
private void butttonSaveRequest_Click(object sender, EventArgs e) { if (request == null) { request = RequestDB.GetInstance(). CreateRequest(textBox1.Text, dateTimePicker1.Value); } SaveRequestChanges(); Close(); }
private void Remove_Click(object sender, EventArgs e) { if (listView1.SelectedIndices.Count == 0) { return; } Request request = (Request)listView1.SelectedItems[0].Tag; RequestDB.GetInstance().RemoveRequest(request); FillFilters(); }
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex == -1) { return; } RequestStatus requestStatus = (RequestStatus)listBox1.SelectedItem; var requests = RequestDB.GetInstance(). GetRequests() .GetRequestsByStatus(requestStatus); if (requests.requests.Count == 0) { RequestStatusDB.GetInstance(). RemoveRequestStatus(requestStatus); FillListStatuses(); } else { MessageBox.Show("Невозможно удалить статус, " + "Существуют заявки с таким статусом"); } }