public frmAccountUpdate(string name) { _IsAdd = false; _name = name; InitializeComponent(); if (User.Current != null) { Account account = new Account(); var acc = account.GetBy(name); if (acc != null) { tbxName.Text = acc.Name; tbxUsername.Text = acc.Username; tbxPassword.Text = acc.Password; tbxDescription.Text = acc.Description; } } }
public void UpdateAccount(string name) { if (User.Current != null) { Account account = new Account(); var currentAccount = account.GetBy(name); if (currentAccount != null) { account.Name = tbxName.Text; account.Username = tbxUsername.Text; account.Password = tbxPassword.Text; account.Description = tbxDescription.Text; int result = account.Update(); if (result == 1) { frmManager manager = (frmManager)Application.OpenForms["frmManager"]; manager.SelectTab("tabAccounts"); this.Close(); } } } }