示例#1
0
        private void TransTypeComboBox_Loaded(object sender, RoutedEventArgs e)
        {
            List <string> data = new List <string>();

            using (var db = new FrameworkDBEntities())
            {
                var comboBox = sender as ComboBox;
                data = (from g in db.tblTransactionTypes select g.TransactionTypeName).ToList();
                comboBox.ItemsSource   = data;
                comboBox.SelectedIndex = 0;
                db.Dispose();
            }
        }
示例#2
0
        private void AccountNameCombo_OnLoaded(object sender, RoutedEventArgs e)
        {
            List <string> data = new List <string>();

            using (var db = new FrameworkDBEntities())
            {
                var comboBox = sender as ComboBox;
                data = (from g in db.tblAccountNames select g.ACname).ToList();
                comboBox.ItemsSource   = data;
                comboBox.SelectedIndex = 0;
                db.Dispose();
            }
        }
示例#3
0
        public void FinanceListComboBox_Loaded(object sender, RoutedEventArgs e)
        {
            List <string> data = new List <string>();

            using (var db = new FrameworkDBEntities())
            {
                var comboBox = sender as ComboBox;
                data = (from g in db.tblBanks select g.BankName).ToList();
                comboBox.ItemsSource   = data;
                comboBox.SelectedIndex = 0;
                db.Dispose();
            }
        }
示例#4
0
 public bool UpdateTblEntity(tblEachEntityTran entityTran)
 {
     try
     {
         using (var db = new FrameworkDBEntities())
         {
             db.tblEachEntityTrans.Add(entityTran);
             db.Entry(entityTran).State = EntityState.Added;
             db.SaveChanges();
             db.Dispose();
             return(true);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(false);
     }
 }
示例#5
0
        public bool UpdateTblTransaction(tblTransaction transaction)
        {
            try
            {
                using (var db = new FrameworkDBEntities())
                {
                    db.tblTransactions.Add(transaction);
                    db.Entry(transaction).State = EntityState.Added;
                    db.SaveChanges();
                    db.Dispose();

                    //  var id = (from w in db.tblTransactions orderby w select w.TransID).FirstOrDefault();
                    return(true);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }