Пример #1
0
 private void AddNewBond()
 {
     var bond = new Bond
         {
             Serial = Convert.ToInt64(txtSerial.Text),
             Owner = txtOwner.Text,
             CreatedDate = DateTime.Now,
             ModifiedDate = DateTime.Now
         };
     var dal = new DAL();
     dal.AddBond(bond);
     this.Close();
 }
Пример #2
0
        public void LoadRule()
        {
            // Configure open file dialog box
            var dlg = new OpenFileDialog { FileName = "Prize Bond Manager",
                DefaultExt = ".pbm", Filter = @"Prize Bond Manager Files (.pbm)|*.pbm" };

            // Show open file dialog box
            var result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == DialogResult.OK)
            {
                // Open document
                var filename = dlg.FileName;
                var serializer = new Serializer();
                var deSerializeObject = serializer.DeSerializeObject(filename);
                var bonds = deSerializeObject.Bonds;
                var dal = new DAL();
                foreach (var bond in bonds)
                {
                    dal.AddBond(bond);
                }
            }
        }