Example #1
0
        private void addPackage()
        {
            Package newPackage = new Package((int)numericUpDownNumberPackage.Value, (PakageStatus)comboBoxStatus.SelectedItem, DateTime.Now, getClient());

            ManagePackage.AddPackage(newPackage, GlobalVar.pathPackagesFile);
            packageList.Add(newPackage);
            MessageBox.Show("Dodano paczkę");
            Close();
        }
        private void LoadDataAboutPackages()
        {
            Packages packs = ManagePackage.ReadListPackages(customerId, GlobalVar.pathPackagesFile);

            if (packs != null)
            {
                packages = packs.packages;
            }
            refreshDataGridView();
        }
 private void buttonChange_Click(object sender, EventArgs e)
 {
     if (status != package.status)
     {
         Package newPackage = new Package(package.number, status, DateTime.Now, package.owner);
         ManagePackage.ModifyPackage(package, newPackage, GlobalVar.pathPackagesFile);
         packageList[(int)findPosition(package)] = newPackage;
     }
     Close();
 }
        private void loadData()
        {
            Packages packs = ManagePackage.ReadListPackages(GlobalVar.pathPackagesFile);

            if (packs != null)
            {
                listPackages = packs.packages;
            }
            refreshDataGridView();
        }
Example #5
0
 private void modifyPackage()
 {
     if (dataWasChanged())
     {
         Package newPackage = new Package((int)numericUpDownNumberPackage.Value, (PakageStatus)comboBoxStatus.SelectedItem, DateTime.Now, getClient());
         ManagePackage.ModifyPackage(package, newPackage, GlobalVar.pathPackagesFile);
         packageList[packageList.FindIndex(x => ((x.number == package.number)))] = newPackage;
         MessageBox.Show("Zmieniono dane paczki");
     }
     Close();
 }
 private void buttonRemove_Click(object sender, EventArgs e)
 {
     if (dataGridViewPackages.SelectedRows.Count > 0)
     {
         ManagePackage.RemovePackage(getSelectedPackage(), GlobalVar.pathPackagesFile);
         listPackages.Remove(getSelectedPackage());
         refreshDataGridView();
     }
     else
     {
         MessageBox.Show("Najpierw musisz wybrać użytkownika którego chcesz usunąć.");
     }
 }
Example #7
0
 private void buttonRemove_Click(object sender, EventArgs e)
 {
     if (dataGridViewData.SelectedRows.Count > 0)
     {
         if (ManagePackage.ReadListPackages(getSelectedUser().id, GlobalVar.pathPackagesFile) == null)
         {
             ManageUsers.RemoveUser(getSelectedUser(), GlobalVar.pathUsersFile);
             userList.Remove(getSelectedUser());
             refreshDataGridView();
         }
         else
         {
             MessageBox.Show("Nie można usunąć użytkownika, który ma paczki w systemie.");
         }
     }
     else
     {
         MessageBox.Show("Najpierw musisz wybrać użytkownika którego chcesz usunąć.");
     }
 }