示例#1
0
        private void butSubmit_Click(object sender, EventArgs e)
        {
            int id;

            using (HomeTrackEntities context = new HomeTrackEntities())
            {
                Category cat = (new Category {
                    Name = cmbCategory.Text
                });
                context.Categories.Add(cat);

                context.SaveChanges();
                id = cat.Id;
            }

            MessageBox.Show(cmbAccount.Text + " " + cmbAccount.SelectedValue + " " + cmbCategory.Text + " " + cmbCategory.SelectedValue);
            string amount      = txtAmount.Text;
            string payee       = txtPayee.Text;
            int    categoryId  = id;
            bool   reconciled  = chkReconciled.Checked;
            string date        = monthCalendar1.SelectionRange.Start.ToShortDateString();
            string checkNumber = txtCheckNumber.Text;
            string memo        = txtMemo.Text;


            MessageBox.Show(amount + " " + payee + " " + categoryId + " " + reconciled + " " + date + " " + checkNumber + " " + memo);
        }
示例#2
0
        public List <Category> GetCategories()
        {
            List <Category> _list = new List <Category>();

            using (HomeTrackEntities context = new HomeTrackEntities())
            {
                _list = context.Categories.ToList();
                _list.Insert(0, new Category {
                    Name = "Please Select", Id = -1
                });
                return(_list);
            }
        }
示例#3
0
        public List <Account> GetAccounts()
        {
            List <Account> _list = new List <Account>();

            using (HomeTrackEntities context = new HomeTrackEntities())
            {
                _list = context.Accounts.ToList();
                _list.Insert(0, new Account {
                    NickName = "Please Select", Id = -1
                });
                return(_list);
            }
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (HomeTrackEntities context = new HomeTrackEntities())
            {
                //context.Accounts.Add(new Account { NickName = "todd", Type = "TYPE" });
                //context.SaveChanges();
                //Account account = context.Accounts.FirstOrDefault(r => r.Id == 2);
                //MessageBox.Show(account.NickName);
                //List<Account> AccountList = new List<Account>();
                //AccountList = context.Accounts.ToList();
                //string j= string.Empty;
                //foreach (var item in AccountList)
                //{
                //    j = j + item.NickName + "\n";
                //}
                //MessageBox.Show(j);

                context.Accounts.Add(new Account {
                    NickName = txtNickname.Text, Type = (string)cmbType.SelectedItem, StartingBalance = Convert.ToDecimal(txtStartingBalance.Text)
                });
                context.SaveChanges();
            }
        }