Exemplo n.º 1
0
        private void deletePerson_Click(object sender, System.EventArgs e)
        {
            ListViewItem lvi = _listView1.SelectedItems[0];
            Person       p   = (Person)lvi.Tag;

            PersonDataModel.getDataModel().removeFromModel(p);
        }
Exemplo n.º 2
0
        public AppForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            PersonDataModel pdm = new PersonDataModel();
        }
Exemplo n.º 3
0
        public ListViewForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            PersonDataModel.getDataModel().PersonModelChanged += new PersonModelChangedEventHandler(this.consumeChangeInPersonDataModel);
        }
Exemplo n.º 4
0
        private void SummaryForm_Load(object sender, EventArgs e)
        {
            ArrayList people = PersonDataModel.getDataModel().getAllPersons();

            foreach (Person person in people)
            {
                UpsertPeopleInCity(person.City);
            }
        }
Exemplo n.º 5
0
        private void updateForm()
        {
            String txt = "";

            foreach (var city in PersonDataModel.getCities())
            {
                txt += $"Persons from {city.Key}: {city.Value}{Environment.NewLine}";
            }
            label1.Text = txt;
        }
Exemplo n.º 6
0
 private void TreeViewForm_Load(object sender, System.EventArgs e)
 {
     foreach (Person p in PersonDataModel.getDataModel().getAllPersons())
     {
         TreeNode tn = new TreeNode(p.Name + " " + p.LastName + ", " + System.Convert.ToString(p.Age) + ", " + p.City);
         tn.Tag                = p;
         tn.ImageIndex         = 0;
         tn.SelectedImageIndex = 0;
         _root.Nodes.Add(tn);
     }
     _root.Expand();
 }
Exemplo n.º 7
0
 private void ListViewForm_Load(object sender, System.EventArgs e)
 {
     foreach (Person p in PersonDataModel.getDataModel().getAllPersons())
     {
         string[] str = new string[2] {
             p.Name, p.LastName
         };
         ListViewItem lvi = new ListViewItem(str);
         lvi.Tag = p;
         _listView1.Items.Add(lvi);
     }
 }
Exemplo n.º 8
0
        public TreeViewForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            _root                    = new TreeNode("Persons");
            _root.ImageIndex         = 1;
            _root.SelectedImageIndex = 1;
            _treeView1.Nodes.Add(_root);
            PersonDataModel.getDataModel().PersonModelChanged += new PersonModelChangedEventHandler(this.consumeChangeInPersonDataModel);
        }
Exemplo n.º 9
0
        public AppForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            PersonDataModel pdm = new PersonDataModel();

            SummaryForm summaryForm = new SummaryForm();

            summaryForm.Show(this);
            summaryForm.Location = new Point(800, 350);
        }
Exemplo n.º 10
0
        private void newPersonMenuItem_Click(object sender, System.EventArgs e)
        {
            PersonPropertiesForm ppf = new PersonPropertiesForm();

            ppf.ShowDialog(this);
            if (ppf.DialogResult == DialogResult.OK)
            {
                try
                {
                    string name     = ppf.getNameTextBoxText();
                    string lastName = ppf.getLastNameTextBoxText();
                    int    age      = System.Convert.ToInt32(ppf.getAgeTextBoxText());
                    string city     = ppf.getCityComboBoxText();
                    Person p        = new Person(name, lastName, age, city);

                    PersonDataModel.getDataModel().addNewPerson(p);
                }
                catch
                {
                }
            }

            ppf.Dispose();
        }
Exemplo n.º 11
0
        private void DisplaySummaryData()
        {
            int splitCount = 0, zagrebCount = 0, rijekaCount = 0;

            foreach (Person p in PersonDataModel.getDataModel().getAllPersons())
            {
                if (p.City == "Split")
                {
                    splitCount++;
                }
                else if (p.City == "Zagreb")
                {
                    zagrebCount++;
                }
                else
                {
                    rijekaCount++;
                }
            }

            splitCounter.Text  = splitCount.ToString();
            zagrebCounter.Text = zagrebCount.ToString();
            rijekaCounter.Text = rijekaCount.ToString();
        }
Exemplo n.º 12
0
 public PersonDataModel()
 {
     ALL_PERSONS       = new ArrayList();
     PERSON_DATA_MODEL = this;
 }
Exemplo n.º 13
0
        public SummaryForm()
        {
            InitializeComponent();

            PersonDataModel.getDataModel().PersonModelChanged += new PersonModelChangedEventHandler(this.consumeChangeInPersonDataModel);
        }
Exemplo n.º 14
0
 public SummaryForm()
 {
     InitializeComponent();
     PersonDataModel.getDataModel().PersonModelChanged += new PersonModelChangedEventHandler(this.PersonModelChanged);
     updateForm();
 }
Exemplo n.º 15
0
 public SummayForm()
 {
     InitializeComponent();
     PersonDataModel.getDataModel().PersonModelChanged += new PersonModelChangedEventHandler(this.RefreshSummaryData);
     DisplaySummaryData();
 }