示例#1
0
        private void EditAccount()
        {
            Account account = (Account)tlvAccounts.SelectedObject;

            if (account != null && account.Id != -1)
            {
                FrmAccount frmEditAccount = new FrmAccount(false)
                {
                    Account = account
                };
                if (frmEditAccount.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        Account modifiedAccount = frmEditAccount.Account;
                        modifiedAccount.Id       = account.Id;
                        modifiedAccount.TypeCode = account.TypeCode;
                        ServicesProvider.GetInstance().GetChartOfAccountsServices().UpdateAccount(modifiedAccount);

                        IntializeTreeViewChartOfAccounts();
                    }
                    catch (Exception ex)
                    {
                        frmEditAccount.Show(this);
                        new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                        frmEditAccount.Hide();
                    }
                }
            }
        }
示例#2
0
        private void AddAccount()
        {
            FrmAccount frmAddAccount = new FrmAccount(true);

            if (frmAddAccount.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    if (frmAddAccount.Mode == 0)
                    {
                        Account account = frmAddAccount.Account;
                        ServicesProvider.GetInstance().GetChartOfAccountsServices().Insert(account);
                        IntializeTreeViewChartOfAccounts();
                    }
                    else if (frmAddAccount.Mode == 1)
                    {
                        AccountCategory accountCategory = frmAddAccount.AccountCategory;
                        ServicesProvider.GetInstance().GetChartOfAccountsServices().InsertAccountCategory(accountCategory);
                        IntializeTreeViewChartOfAccounts();
                    }
                }
                catch (Exception ex)
                {
                    frmAddAccount.Show(this);
                    new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                    frmAddAccount.Hide();
                }
            }
        }
示例#3
0
 private void EditAccount()
 {
     Account account = (Account)tlvAccounts.SelectedObject;
     if (account != null && account.Id != -1)
     {
         FrmAccount frmEditAccount = new FrmAccount (false) {Account = account};
         if (frmEditAccount.ShowDialog(this) == DialogResult.OK)
         {
             try
             {
                 Account modifiedAccount = frmEditAccount.Account;
                 modifiedAccount.Id = account.Id;
                 modifiedAccount.TypeCode = account.TypeCode;
                 ServicesProvider.GetInstance().GetChartOfAccountsServices().UpdateAccount(modifiedAccount);
                 
                 IntializeTreeViewChartOfAccounts();
             }
             catch (Exception ex)
             {
                 frmEditAccount.Show(this);
                 new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                 frmEditAccount.Hide();
             }
         }
     }
 }
示例#4
0
 private void AddAccount()
 {
     FrmAccount frmAddAccount = new FrmAccount(true);
     if (frmAddAccount.ShowDialog(this) == DialogResult.OK)
     {
         try
         {
             if (frmAddAccount.Mode == 0)
             {
                 Account account = frmAddAccount.Account;
                 ServicesProvider.GetInstance().GetChartOfAccountsServices().Insert(account);
                 IntializeTreeViewChartOfAccounts();
             }
             else if(frmAddAccount.Mode == 1)
             {
                 AccountCategory accountCategory = frmAddAccount.AccountCategory;
                 ServicesProvider.GetInstance().GetChartOfAccountsServices().InsertAccountCategory(accountCategory);
                 IntializeTreeViewChartOfAccounts();
             }
         }
         catch (Exception ex)
         {
             frmAddAccount.Show(this);
             new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
             frmAddAccount.Hide();
         }
     }
 }