Пример #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)
            {
            }
        }
        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);
        }
Пример #6
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;
        }