private static void Application_ApplicationExit(
     object sender, EventArgs e)
 {
     ClientDB.GetInstance().Save();
     WorkerDB.GetInstance().Save();
     RequestDB.GetInstance().Save();
     RequestStatusDB.GetInstance().Save();
 }
Esempio n. 2
0
 void FillFilters()
 {
     comboBox2.DataSource    = RequestStatusDB.GetInstance().GetRequestStatuses();
     comboBox2.DisplayMember = "Name";
     comboBox1.DataSource    = typeof(RequestPriority).GetEnumValues();
     comboBox3.DataSource    = WorkerDB.GetInstance().GetWorkers();
     comboBox3.DisplayMember = "LastName";
     comboBox4.DataSource    = ClientDB.GetInstance().GetClients();
     comboBox4.DisplayMember = "LastName";
 }
        private void RemoveWorker_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedIndices.Count == 0)
            {
                return;
            }
            Worker worker = (Worker)listView1.SelectedItems[0].Tag;

            WorkerDB.GetInstance().RemoveWorker(worker);
            ShowListWorkers();
        }
Esempio n. 4
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (worker == null)
     {
         worker = WorkerDB.GetInstance().
                  CreateWorker();
     }
     worker.FirstName = textBox1.Text;
     worker.LastName  = textBox2.Text;
     worker.Status    = (WorkerStatus)comboBox1.SelectedItem;
     Close();
 }
Esempio n. 5
0
 public FormRequestEdit(Request request)
 {
     InitializeComponent();
     FillFilters();
     this.request           = request;
     textBox1.Text          = request.Name;
     comboBox1.SelectedItem = request.Priority;
     comboBox2.SelectedItem = RequestStatusDB.GetInstance().GetRequestStatusByID(request.StatusID);
     comboBox3.SelectedItem = WorkerDB.GetInstance().GetWorkerByID(request.WorkerID);
     dateTimePicker1.Value  = request.DateCreate;
     comboBox4.SelectedItem = ClientDB.GetInstance().GetClientByID(request.ClientID);
 }
        void ShowListWorkers()
        {
            listView1.Items.Clear();
            var workers = WorkerDB.GetInstance().
                          GetWorkers();

            foreach (var worker in workers)
            {
                ListViewItem row = new ListViewItem(
                    worker.FirstName);
                row.SubItems.Add(worker.LastName);
                row.SubItems.Add(worker.Status.ToString());
                row.Tag = worker;
                listView1.Items.Add(row);
            }
        }
Esempio n. 7
0
        private void ShowRequests(List <Request> requests)
        {
            listView1.Items.Clear();
            RequestStatusDB statusDB = RequestStatusDB.GetInstance();
            WorkerDB        workerDB = WorkerDB.GetInstance();
            ClientDB        clientDB = ClientDB.GetInstance();

            foreach (var request in requests)
            {
                ListViewItem row = new ListViewItem(request.Name);
                row.SubItems.Add(request.DateCreate.ToString());
                if (request.Closed)
                {
                    row.SubItems.Add(" ");
                }
                row.SubItems.Add(statusDB.GetRequestStatusByID(request.StatusID).Name);
                row.SubItems.Add(request.Priority.ToString());
                row.SubItems.Add(workerDB.GetWorkerByID(request.WorkerID).LastName);
                row.SubItems.Add(clientDB.GetClientByID(request.ClientID).LastName);
                row.Tag = request;
                listView1.Items.Add(row);
            }
        }