示例#1
0
        private bool Save(int type, string desc, DateTime startDate, float balance)
        {
            try
            {
                if (db == null)
                {
                    db = new MainDBEntities2();
                }

                var Account = new Account()
                {
                    Type = type, Description = desc, DateTime = startDate, Balance = balance
                };
                db.Accounts.Add(Account);
                db.SaveChanges();

                MessageBox.Show("Account \"" + desc + "\" successfully added!");

                BindDGView(db.Accounts.ToList());

                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(false);
            }
        }
示例#2
0
 public AccountsSetup()
 {
     InitializeComponent();
     db = new MainDBEntities2();
     BindDGView(db.Accounts.ToList());
 }