Пример #1
0
        public void EditLocation(LocationClass chrOld, LocationClass chrUpdate, Image Picture, frmListLocations FLL)
        {
            bool Found = false;
            if (chrOld != null)
            {
                foreach (LocationClass CC in CBC[0].Locations)
                {
                    if (!Found)
                    {
                        if (CC.Name == chrOld.Name)
                        {
                            CC.Name = chrUpdate.Name;
                            CC.Type = chrUpdate.Type;
                            CC.Address = chrUpdate.Address;
                            CC.Population = chrUpdate.Population;
                            CC.Description = chrUpdate.Description;
                            CC.SavePicture = ImageToString(Picture);
                            Found = true;
                            blDataSaved = false;
                        }
                    }
                }
            }
            if (Found)
                MessageBox.Show("Location edit successful!", "Editing...");
            else
                MessageBox.Show("Failed to edit location!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

        }
Пример #2
0
        private void listToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            if (CBC[0].Locations.Count > 0)
            {
                this.Enabled = false;
                frmListLocations F = new frmListLocations();
                F.Show();
                F.MainForm = this;

                F.PopulateLocations(CBC[0].Locations);
            }
            else
            {
                MessageBox.Show("There are no locations. Please add locations so you can list them.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
 public void DeleteLocation(LocationClass locDel, frmListLocations FLL)
 {
     bool Found = false;
     if (locDel != null)
     {
         foreach (LocationClass CC in CBC[0].Locations)
         {
             if (!Found)
             {
                 if (CC == locDel)
                     Found = true;
             }
         }
     }
     if (Found)
     {
         CBC[0].Locations.Remove(locDel);
         MessageBox.Show("Location has been deleted.", "Success");
     }
     else
         MessageBox.Show("Couldn't delete location.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     FLL.PopulateLocations(CBC[0].Locations);
     blDataSaved = false;
     CheckStatus();
 }