public List <ChartOfAccounts> GetAllChartOfAccounts(string type)
 {
     return(_chartOfAccountsRepository.GetAllChartOfAccounts(type));
 }
        /// <summary>
        /// To validate Each row and then returns error rows with the corresponding error if erorr exists
        /// </summary>
        /// <param name="importOtherExpenseList">List of datas from excel</param>
        /// <param name="flag"> if flag=true then validates and inserts else, only validates </param>
        /// <returns></returns>
        public List <ImportOtherExpenses> InsertValidateExpenseData(List <ImportOtherExpenses> importOtherExpenseList, bool flag)
        {
            List <ChartOfAccounts> chartOfAccountsList = _chartOfAccountsRepository.GetAllChartOfAccounts("OE");
            List <Companies>       companiesList       = _companiesRepository.GetAllCompanies();
            List <Employee>        employeeList        = _employeeRepository.GetAllEmployees(null);

            try
            {
                List <ImportOtherExpenses> removedDataList = new List <ImportOtherExpenses>();
                string[] AccountList   = (from i in chartOfAccountsList where i.Type == "OE" select i.Code).ToArray();
                string[] CompanyNames  = (from i in companiesList select i.Name).ToArray();
                string[] EmployeeCodes = (from i in employeeList select i.Code).ToArray();
                //string[] EmployeeNames  = (from i in employeeList select i.Name).ToArray();
                foreach (ImportOtherExpenses anImportOtherExpense in importOtherExpenseList)
                {
                    if (AccountList.Contains(anImportOtherExpense.AccountCode))
                    {
                        if (CompanyNames.Contains(anImportOtherExpense.Company))
                        {
                            if (/*(anImportOtherExpense.EmpName.Equals("-") || anImportOtherExpense.EmpName.Equals("") || EmployeeNames.Contains(anImportOtherExpense.EmpName)) &&*/ (anImportOtherExpense.EmpCode.Equals("-") || anImportOtherExpense.EmpCode.Equals("") || EmployeeCodes.Contains(anImportOtherExpense.EmpCode)))
                            {
                                ImportOtherExpenses importExpenseReturn = new ImportOtherExpenses();
                                try
                                {
                                    importExpenseReturn = ModifyRow(anImportOtherExpense, companiesList, employeeList);
                                }
                                catch (Exception ex)
                                {
                                    if (ex.Message.Equals("Sequence contains no elements"))
                                    {
                                        anImportOtherExpense.Error       = "Invalid Employee";
                                        anImportOtherExpense.ExpenseDate = DateTime.Parse(anImportOtherExpense.ExpenseDate).ToString(settings.dateformat);
                                        removedDataList.Add(anImportOtherExpense);
                                    }
                                    else
                                    {
                                        throw ex;
                                    }
                                }
                                if (flag == true)
                                {
                                    InsertInToOtherExpenses(importExpenseReturn);
                                }
                            }
                            else
                            {
                                anImportOtherExpense.Error       = "Invalid Employee";
                                anImportOtherExpense.ExpenseDate = DateTime.Parse(anImportOtherExpense.ExpenseDate).ToString(settings.dateformat);
                                removedDataList.Add(anImportOtherExpense);
                            }
                        }
                        else
                        {
                            anImportOtherExpense.Error       = "Invalid Company";
                            anImportOtherExpense.ExpenseDate = DateTime.Parse(anImportOtherExpense.ExpenseDate).ToString(settings.dateformat);
                            removedDataList.Add(anImportOtherExpense);
                        }
                    }
                    else
                    {
                        anImportOtherExpense.Error       = "Invalid Account Code";
                        anImportOtherExpense.ExpenseDate = DateTime.Parse(anImportOtherExpense.ExpenseDate).ToString(settings.dateformat);
                        removedDataList.Add(anImportOtherExpense);
                    }
                }

                return(removedDataList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }