Ejemplo n.º 1
0
        //
        // Button event handlers
        //
        void ButtonAddNewClick(object sender, EventArgs e)
        {
            SoldierRecord newSoldier = new SoldierRecord
            {
                CreationDate = DateTime.Now,
                LastUpdateDate = DateTime.Now,
                ImerominiaGenniseos = new DateTime(1900,1,1),
            };

            SoldierDetailsForm form = new SoldierDetailsForm(newSoldier, fixtures);
            form.ShowDialog(this);

            if (form.DialogResult== DialogResult.OK)
            {
                dataManager.Insert(newSoldier);
                bindingSource1.Add(newSoldier);
            }
        }
Ejemplo n.º 2
0
        void ButtonDiorthosiClick(object sender, EventArgs e)
        {
            if (personelGridView.SelectedRows.Count>0)
            {
                int idx = personelGridView.SelectedRows[0].Index;
                SoldierRecord soldier = (SoldierRecord) personelGridView.SelectedRows[0].DataBoundItem;
                SoldierRecord newSoldier = new SoldierRecord( soldier );

                SoldierDetailsForm form = new SoldierDetailsForm(newSoldier, fixtures);
                form.ShowDialog(this);

                if (form.DialogResult== DialogResult.OK)
                {
                    newSoldier.LastUpdateDate = DateTime.Now;

                    dataManager.Update( newSoldier as SoldierRecord);
                    soldier.CopyFrom(newSoldier);
                    soldiersBindingList.ResetItem(idx);
                }
            }
        }