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(); } }
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(); } }
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(); } }
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); } }
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); } }