Пример #1
0
        void SaveOptions(object param)
        {
            IAccountDetailsService AccountDetails = new AccountDetailsService();
            //UpdateBindingGroup.CommitEdit();
            int results         = 0;
            var cashbankDetails = SelectedAccount as AccountDetailEntity;

            if (cashbankDetails.AccountName == "Net GST/VAT")
            {
                this.Errors = "End Date should be greater than start date!";
            }
            else
            {
                MessageBoxResult result = System.Windows.MessageBox.Show("Do you want to save changes?", "Save Content", MessageBoxButton.YesNo);
                switch (result)
                {
                case MessageBoxResult.Yes:
                    results = AccountDetails.AddEditAccount(cashbankDetails);
                    break;

                case MessageBoxResult.No:
                    break;
                }

                if (results == 1)
                {
                    var result1        = AccountDetails.GetAccountDetails();
                    var cashbankentity = SelectedAccount as AccountDetailEntity;
                    cashbankentity.AccountDetails = result1;
                    //cashbankentity.AccountName = string.Empty;
                    //cashbankentity.AccountOpeningBal = string.Empty;
                    //cashbankentity.IsInActive = false;
                    if (result1.Count == 1)
                    {
                        cashbankentity.SeletedIndex = 0;
                    }
                    else if (result1.Count > 0)
                    {
                        cashbankentity.SeletedIndex = PrivateSeletedIndex;
                    }
                    if (cashbankentity.IsCashAccount == true)
                    {
                        cashbankentity.DeleteEnabled = false;
                    }
                    else
                    {
                        cashbankentity.DeleteEnabled = true;
                    }
                }
                else if (results == 2)
                {
                    System.Windows.MessageBox.Show("Account Name already Exits.Please choose a different account name");
                }
                else
                {
                    System.Windows.MessageBox.Show("There was some problem in updating the entries, kindly try again later!");
                }
            }
        }
Пример #2
0
        void OnPrev(object param)
        {
            IAccountDetailsService AccountDetails = new AccountDetailsService();
            var results     = SelectedAccount as AccountDetailEntity;
            var accountinfo = AccountDetails.GetAccountDetails();

            if (results != null)
            {
                results.AccountDetails = accountinfo;
                var current = results.AccountDetails.FirstOrDefault(x => x.AccountID == results.AccountID);

                int index = results.AccountDetails.ToList().IndexOf(current);

                if (index > 0)
                {
                    var selectedIndex = index - 1;
                    var next          = results.AccountDetails.ElementAt(index - 1);

                    results.AccountID = next.AccountID;
                    var nextvalue = AccountDetails.GetAccInfo(next.AccountID);
                    if (results != null)
                    {
                        var account = SelectedAccount as AccountDetailEntity;
                        account.DeleteEnabled       = true;
                        account.IsEnabled           = true;
                        account.ReadOnlyAccountName = false;
                        account.IsCashAccount       = false;
                        account.AccountID           = results.AccountID;
                        account.AccountOpeningBal   = results.AccountOpeningBal;
                        account.AccountName         = results.AccountName;
                        account.IsInActive          = results.IsInActive;
                        account.SeletedIndex        = selectedIndex;
                        PrivateSeletedIndex         = selectedIndex;
                        account.SeletedAccountType  = results.SeletedAccountType;
                        account.AccoutTypeCombo     = false;
                        if (selectedIndex == 0)
                        {
                            account.EnablePrevious = false;
                        }
                        else
                        {
                            account.EnablePrevious = true;
                        }
                        if (index < results.AccountDetails.ToList().Count)
                        {
                            account.EnableNext = true;
                        }
                        else
                        {
                            account.EnableNext = false;
                        }
                    }
                }
                else
                {
                }
            }
        }
Пример #3
0
        void DeleteCommand(object param)
        {
            bool?result1 = false;
            IAccountDetailsService AccountDetails = new AccountDetailsService();
            MessageBoxResult       result         = System.Windows.MessageBox.Show("Do you really want to delete the Cash and Bank Details?", "Confirmation", MessageBoxButton.YesNo);

            switch (result)
            {
            case MessageBoxResult.Yes:
                var cashbank          = SelectedAccount as AccountDetailEntity;
                var candeletecashbank = AccountDetails.CanDeleteAccount(cashbank.AccountID);
                if (candeletecashbank)
                {
                    result1 = AccountDetails.DeleteAccount(cashbank.AccountID);
                    var cashbankentity = SelectedAccount as AccountDetailEntity;
                    var results        = AccountDetails.GetAccountDetails();

                    cashbankentity.AccountDetails = results;
                    //cashbankentity.IsEnabled = true;
                    //cashbankentity.IsInActive = false;

                    if (result1 == true)
                    {
                        if (results.Count - 1 >= PrivateSeletedIndex)
                        {
                            cashbankentity.SeletedIndex = PrivateSeletedIndex;
                        }
                        else if (results.Count - 1 == PrivateSeletedIndex - 1 && results.Count != 0)
                        {
                            cashbankentity.SeletedIndex = PrivateSeletedIndex - 1;
                        }
                        else
                        {
                            cashbankentity.AccountName       = string.Empty;
                            cashbankentity.AccountOpeningBal = string.Empty;
                            cashbankentity.AccountID         = -1;
                            cashbankentity.IsEnabled         = true;
                            cashbankentity.IsInActive        = false;
                            cashbankentity.SeletedIndex      = 0;
                        }
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("There was some problem in deleting the entries, kindly try again later!");
                    }
                }
                else
                {
                    System.Windows.MessageBox.Show("You can delete this account!");
                }
                break;

            case MessageBoxResult.No:

                break;
            }
        }
Пример #4
0
        public void GetSelectedValue()
        {
            IAccountDetailsService AccountDetails = new AccountDetailsService();
            var accountinfo = AccountDetails.GetAccountDetails().ToList();

            foreach (var item in accountinfo)
            {
                if (item.AccountName == "" || item.AccountName == "" || item.AccountName == "")
                {
                }
            }
            if (MySelectedItem != null)
            {
            }
        }
Пример #5
0
        public void LoadAccInfo(int AccountId, int selectedIndex)
        {
            IAccountDetailsService AccountDetails = new AccountDetailsService();
            var results = AccountDetails.GetAccInfo(AccountId);

            if (results != null)
            {
                if (results.IsLinkedAccount == true)
                {
                    var accountinfo = SelectedAccount as AccountDetailEntity;
                    accountinfo.DeleteEnabled       = false;
                    accountinfo.IsEnabled           = false;
                    accountinfo.ReadOnlyAccountName = true;
                    accountinfo.IsCashAccount       = false;
                    accountinfo.AccountID           = results.AccountID;
                    accountinfo.AccountOpeningBal   = results.AccountOpeningBal;
                    accountinfo.AccountName         = results.AccountName;
                    accountinfo.IsInActive          = results.IsInActive;
                    accountinfo.HashSymbol          = (results.IsLinkedAccount == true ? "#" : "");
                    accountinfo.SeletedIndex        = selectedIndex;
                    PrivateSeletedIndex             = selectedIndex;
                    accountinfo.SeletedAccountType  = results.SeletedAccountType;
                    accountinfo.AccoutTypeCombo     = false;
                }
                else
                {
                    var accountinfo = SelectedAccount as AccountDetailEntity;
                    accountinfo.DeleteEnabled       = true;
                    accountinfo.IsEnabled           = true;
                    accountinfo.ReadOnlyAccountName = false;
                    accountinfo.IsCashAccount       = false;
                    accountinfo.AccountID           = results.AccountID;
                    accountinfo.AccountOpeningBal   = results.AccountOpeningBal;
                    accountinfo.AccountName         = results.AccountName;
                    accountinfo.IsInActive          = results.IsInActive;
                    accountinfo.HashSymbol          = (results.IsLinkedAccount == true ? "#" : "");
                    accountinfo.SeletedIndex        = selectedIndex;
                    PrivateSeletedIndex             = selectedIndex;
                    accountinfo.SeletedAccountType  = results.SeletedAccountType;
                    accountinfo.AccoutTypeCombo     = false;
                }
            }

            //OnPropertyChanged("Account");
        }
        public void RefreshPage()
        {
            SelectedAccount = null; // Unselects last selection. Essential, as assignment below won't clear other control's SelectedItems
            var Account = new AccountDetailEntity();

            IAccountDetailsService AccountDetails = new AccountDetailsService();
            var results     = AccountDetails.GetDefaultAccount();
            var accountinfo = AccountDetails.GetAccountDetails();

            if (results != null)
            {
                results.AccountDetails = accountinfo;
                results.SeletedIndex   = 0;
                results.EnablePrevious = false;


                int  minHeight   = 300;
                int  headerRows  = 380;//180+40+30+10;
                var  height      = System.Windows.SystemParameters.PrimaryScreenHeight - headerRows - 70;
                bool validHeight = int.TryParse(height.ToString(), out minHeight);
                results.AccountGridHeight = minHeight;


                SelectedAccount = results;

                ActiveAccounts   = Convert.ToString(accountinfo.Where(e => e.IsInactive == "Y").Count());
                InActiveAccounts = Convert.ToString(accountinfo.Where(e => e.IsInactive == "N").Count());
            }

            //this.AccountDetails = customerRepository.GetAllCustomers().ToList();
            //if (SearchCustomer.Count > 0)
            //{
            //    this.SelectedSearchCustmer = SearchCustomer[0].ID;
            //    custId = SearchCustomer[0].ID;
            //}
            //else
            //{
            //    this.SelectedSearchCustmer = custId;
            //}
            //this.GetData(this.SelectedSearchCustmer);
        }
Пример #7
0
        void NewCommand(object param)
        {
            var cashbank = SelectedAccount as AccountDetailEntity;
            IAccountDetailsService AccountDetails = new AccountDetailsService();
            var result1 = AccountDetails.GetAccountDetails();

            cashbank.AccountDetails = result1;
            if (result1.Count == 0)
            {
                PrivateSeletedIndex = 0;
            }
            else
            {
                PrivateSeletedIndex = result1.Count;
            }
            cashbank.AccountID           = -1;
            cashbank.AccountName         = string.Empty;
            cashbank.AccountOpeningBal   = string.Empty;
            cashbank.IsInActive          = false;
            cashbank.IsEnabled           = true;
            cashbank.DeleteEnabled       = false;
            cashbank.ReadOnlyAccountName = false;
            cashbank.AccoutTypeCombo     = true;
        }
Пример #8
0
        public void StartNewFinancial(object param)
        {
            IAccountDetailsService AccountDetails = new AccountDetailsService();
            string msg = "Simple will backup your Company file.\n"
                         + "Assets, Liabilities and Capital Accounts: Simple will transfer last year current balances to this year opening balances.Simple will put zeros in this year year-to - date and current balances.\n"
                         + "Income, Costs and Expenses Accounts: Simple will put zeros in this year opening balances, year - to - date and current balances.\n"
                         + "Income, Costs and Expenses Accounts do not have opening balances.\n" + "@ Simple Accounting Software Pte Ltd";

            //MessageBoxResult res = System.Windows.MessageBox.Show(msg);
            //if (res == MessageBoxResult.OK)
            //{

            //}

            System.Windows.Forms.MessageBoxManager.Yes = "FinancialYear";

            System.Windows.Forms.MessageBoxManager.No = "Cancel";
            System.Windows.Forms.MessageBoxManager.Register();
            System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show(msg, "", System.Windows.Forms.MessageBoxButtons.YesNo);
            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                System.Windows.Forms.DialogResult StartResult = System.Windows.Forms.MessageBox.Show("Are you sure you want to Start New Financial Year?\n" + "@ Simple Accounting Software Pte Ltd", "", System.Windows.Forms.MessageBoxButtons.OKCancel);
                //var x = System.Windows.Forms.MessageBox.Show("Are you sure you want to Start New Financial Year?", "", System.Windows.Forms.MessageBoxButtons.OKCancel);
                if (StartResult == System.Windows.Forms.DialogResult.OK)
                {
                    AccountDetails.StartNewFinancialYear(StartResult.ToString());
                }
                else
                {
                }
            }
            else
            {
            }
            System.Windows.Forms.MessageBoxManager.Unregister();
        }
Пример #9
0
    public AccountDetailsTest()
    {
        var httpService = HttpServiceBuilder.Build();

        _accountDetailsService = AccountDetailsServiceBuilder.Build(httpService);
    }
Пример #10
0
 public UpdatePasswordVM()
 {
     account = new clsUpdatePassword();
     accountDetailsService = new AccountDetailsService();
 }