private void Button_Click(object sender, RoutedEventArgs e) { try { if (Item == null) { DataAccess da = new DataAccess(); bank_account ba = new bank_account(); ba.account = da.GetAccount(AccountID); int BankID = (edtBank.SelectedItem as bank).id; ba.bank = da.BankGet(BankID); ba.BankAccount = edtAccountNumber.Text; ba.Description = edtDescription.Text; AccountID = da.BankAccountCreate(ba).id; } else { DataAccess da = new DataAccess(); bank_account ba = da.bank_account_get(Item.id); int BankID = (edtBank.SelectedItem as bank).id; ba.bank = da.BankGet(BankID); ba.BankAccount = edtAccountNumber.Text; ba.Description = edtDescription.Text; da.BankAccountEdit(ba); } } catch (Exception) { } Close(); }
/// <summary> /// Deprecated Method for adding a new object to the bank_account EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTobank_account(bank_account bank_account) { base.AddObject("bank_account", bank_account); }
/// <summary> /// Create a new bank_account object. /// </summary> /// <param name="id">Initial value of the id property.</param> public static bank_account Createbank_account(global::System.Int32 id) { bank_account bank_account = new bank_account(); bank_account.id = id; return bank_account; }
public bank_account BankAccountEdit(bank_account x) { bank_account o = objDataContext.bank_account.FirstOrDefault(i => i.id == x.id); if (o != null) { //o.account = x.account; o.bank = x.bank; o.BankAccount = x.BankAccount; o.Description = x.Description; objDataContext.SaveChanges(); } return o; }
public bank_account BankAccountCreate(bank_account i) { objDataContext.AddTobank_account(i); objDataContext.SaveChanges(); return i; }