private void copyAndPasteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (trvAccountTree.SelectedNode != null && trvAccountTree.SelectedNode.ToString() != "")
     {
         CrAccount = Account.FindByAccountID(trvAccountTree.SelectedNode.Tag.ToString());
         CrAccount.AccountID = Account.getNewId(CrAccount.ParentId,CrAccount.IsSubAccount);
         CrAccount.IsNew = true;
         CrAccount.IsCopy = true;
         ShowGUI();
         this.FormStatus = FormStatusEnum.Edit;
         cmbAccountType.Enabled = false;
         //trvAccountTree.Enabled = false;
     }
 }
 private void addToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CrAccount = new BackOfficeBL.Accounting.Account();
     CrAccounttype = new BackOfficeBL.Accounting.Accounttype();
     CrAccountCategory = new BackOfficeBL.Accounting.AccountCategory();
     CrAccount.AccountID = Account.getNewId(trvAccountTree.SelectedNode.Tag.ToString(),false);
     if (trvAccountTree.SelectedNode != null && trvAccountTree.SelectedNode.ToString() != "")
     {
         var parent = Account.FindByAccountID(trvAccountTree.SelectedNode.Tag.ToString());
         CrAccount.AccountTypeId = parent.AccountTypeId;
         CrAccount.ParentId = trvAccountTree.SelectedNode.ToString();
     }
     ShowGUI();
     this.FormStatus = FormStatusEnum.AddNew;
     //trvAccountTree.Enabled = false;
 }
Example #3
0
 public static List<Account> GetAllAccountTree()
 {
     List<Account> result = new List<Account>();
     NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
     var dbAccounts = from g in newAppsCnn.Acc_Accounts where g.AccountID != null || g.AccountID != "" select g;
     foreach (var dbAccount in dbAccounts)
     {
         Account account = new Account();
         account.FromDbAccount(dbAccount);
         result.Add(account);
     }
     return result;
 }
Example #4
0
 public static Account FindByAccountID(string _VaidationID)
 {
     NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
     var dbAccounts = from u in newAppsCnn.Acc_Accounts where u.AccountID == _VaidationID select u;
     if (dbAccounts.Count() > 0)
     {
         Acc_Accounts dbAccount = dbAccounts.First();
         Account account = new Account();
         account.FromDbAccount(dbAccount);
         account.IsNew = false;
         account.IsCopy = false;
         return account;
     }
     else
         return null;
 }
 private void frmAccountTree_Save(object sender, ref bool _status)
 {
     GetDataFromGUI();
     DataSaveResult saveResult = CrAccount.Save();
     if (saveResult.SaveStatus == false)
     {
         _status = false;
     }
     else
     {
         CrAccount = null;
         ShowGUI();
         //trvAccountTree.Enabled = true;
         cmbAccountType.Enabled = true;
     }
 }
 private void trvAccountTree_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (this.FormStatus == FormStatusEnum.Edit)
     {
         trvAccountTree.SelectedNode = trvAccountTree.Nodes.Find(trvAccountTree.SelectedNode.Tag.ToString(), true)[0];
         return;
     }
     string AccountNo = trvAccountTree.SelectedNode != null ? trvAccountTree.SelectedNode.Tag.ToString() : "";
     if (AccountNo != "")
     {
         CrAccount = Account.FindByAccountID(trvAccountTree.SelectedNode.Tag.ToString());
         ShowGUI();
     }
     trvAccountTree.Focus();
 }
 private void frmAccountTree_Edit(object sender, ref bool _status)
 {
     CrAccount = Account.FindByAccountID(trvAccountTree.SelectedNode.Tag.ToString());
     if (CrAccount == null)
     {
         _status = false;
     }
     else
     {
         if (CrAccount.IsNew == true)
         {
             _status = false;
         }
         else
         {
             ShowGUI();
         }
     }
 }
        private void frmAccountTree_Delete(object sender, ref bool _status)
        {
            CrAccount = Account.FindByAccountID(trvAccountTree.SelectedNode.Tag.ToString());
            DataDeleteResult result = CrAccount.Delete();

            _status = result.DeleteStatus;
            if (result.DeleteStatus == false)
            {
                MessageBox.Show(result.ErrorMessage);
            }
            else
            {
                CrAccount = null;
                ShowGUI();
            }
        }
 private void frmAccountTree_Cancel(object sender)
 {
     CrAccount = null;
     cmbAccountType.Enabled = true;
     ShowGUI();
 }
 private void frmAccountTree_AddNew(object sender, ref bool _status)
 {
     CrAccount = new BackOfficeBL.Accounting.Account();
     CrAccounttype = new BackOfficeBL.Accounting.Accounttype();
     CrAccountCategory = new BackOfficeBL.Accounting.AccountCategory();
     txtAccountNo.Text = Account.getNewId((trvAccountTree.SelectedNode != null ? trvAccountTree.SelectedNode.Tag.ToString() : ""),false);
 }
 private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (trvAccountTree.SelectedNode != null && trvAccountTree.SelectedNode.ToString() != "")
     {
         CrAccount = Account.FindByAccountID(trvAccountTree.SelectedNode.Tag.ToString());
         DataDeleteResult result = CrAccount.Delete();
         if (result.DeleteStatus == false)
         {
             MessageBox.Show(result.ErrorMessage);
         }
         else
         {
             CrAccount = null;
             ShowGUI();
             this.FormStatus = FormStatusEnum.DataPreview;
         }
     }
 }