private bool CheckSettings() { if (cmbComp.SelectedItem == null) { MessageBox.Show(this, Properties.Resources.resNoSelectedComp, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (CompGroups.Count == 0) { MessageBox.Show(this, Properties.Resources.resNoGroupsInComp, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if ((from gr in CompGroups group gr by gr.WorkbookName into groupNames where groupNames.Count() > 1 select groupNames.Key) .Any()) { MessageBox.Show(this, Properties.Resources.resDuplicateWorkbookNames, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (CompGroups.Any( arg => (string.IsNullOrWhiteSpace(arg.WorkbookName) || arg.WorkbookName.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) != -1))) { MessageBox.Show(this, string.Format(Properties.Resources.resfmtInvalidWorkbookNames, string.Join(", ", System.IO.Path.GetInvalidFileNameChars())), Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (!File.Exists(SelectedComp.SourceWorkbookName) && System.IO.Path.GetExtension(SelectedComp.SourceWorkbookName) != GlobalDefines.MAIN_WBK_EXTENSION && System.IO.Path.GetExtension(SelectedComp.SourceWorkbookName) != GlobalDefines.XLS_EXTENSION && System.IO.Path.GetExtension(SelectedComp.SourceWorkbookName) != GlobalDefines.XLSX_EXTENSION) { MessageBox.Show(this, Properties.Resources.resInvalidSourceWorkbookName, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (CompGroups.Any(arg => string.IsNullOrWhiteSpace(arg.SheetName) || string.IsNullOrWhiteSpace(arg.TLCell) || string.IsNullOrWhiteSpace(arg.BRCell) || arg.PersonalDataColumnIndex <= 0 || arg.TeamColumnIndex <= 0 || arg.YoBColumnIndex <= 0 || arg.GradeColumnIndex <= 0)) { MessageBox.Show(this, Properties.Resources.resInvalidSourceRangeForExporting, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (CompGroups.Any(arg => arg.EndYear.HasValue && arg.EndYear != (int)enEndYearSpecVals.AndElder && arg.EndYear != (int)enEndYearSpecVals.AndYounger && arg.StartYear >= arg.EndYear)) { MessageBox.Show(this, Properties.Resources.resInvalidGroupYears, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (CompGroups.Any(arg => arg.EndDate.HasValue && arg.StartDate != arg.EndDate)) { MessageBox.Show(this, Properties.Resources.resInvalidGroupDates, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (string.IsNullOrEmpty(SelectedComp.DestCompFolder) || (SelectedComp.DestCompFolder.IndexOfAny(System.IO.Path.GetInvalidPathChars()) != -1)) { MessageBox.Show(this, Properties.Resources.resInvalidDestCompFolder, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } if (!Directory.Exists(DBManagerApp.m_AppSettings.m_Settings.WorkbookTemplateFolder)) { MessageBox.Show(this, Properties.Resources.resInvalidWorkbookTemplateFolder, Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } string WorkbookTemplateFullPath = System.IO.Path.Combine(DBManagerApp.m_AppSettings.m_Settings.WorkbookTemplateFolder, DBManagerApp.m_AppSettings.m_Settings.WorkbookTemplateName); if (!File.Exists(WorkbookTemplateFullPath)) { MessageBox.Show(this, string.Format(Properties.Resources.resfmtInvalidWorkbookTemplateName, WorkbookTemplateFullPath), Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } return(true); }