예제 #1
0
        /// <summary>
        /// Устанавливает свойства модели, которые не могут быть установлены автоматически
        /// </summary>
        public override void DoCustomBinding()
        {
            base.DoCustomBinding();

            SelectedGroups = SelectedGroups?.Where(n => n != null).ToArray() ?? new QPCheckedItem[] { };
            Data.Groups    = SelectedGroups.Any() ? Service.GetUserGroups(Converter.ToInt32Collection(SelectedGroups.Select(g => g.Value).ToArray())) : Enumerable.Empty <BLL.UserGroup>();
        }
예제 #2
0
        public override bool CheckSettings()
        {
            if (CreateReport)
            {
                if (ExportToAnotherWbk)
                {
                    if (string.IsNullOrWhiteSpace(XlsPath) ||
                        !Directory.Exists(System.IO.Path.GetDirectoryName(XlsPath)) ||
                        System.IO.Path.GetExtension(XlsPath) != GlobalDefines.XLSX_EXTENSION)
                    {
                        MessageBox.Show(m_ParentWnd,
                                        Properties.Resources.resInvalidXlsxPath,
                                        (Parent as TabItem).Header.ToString(),
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                        return(false);
                    }

                    if (File.Exists(XlsPath))
                    {   // Перезаписывать файлы нельзя
                        MessageBox.Show(m_ParentWnd,
                                        Properties.Resources.resXlsxFileAlreadyExists,
                                        (Parent as TabItem).Header.ToString(),
                                        MessageBoxButton.OK,
                                        MessageBoxImage.Error);
                        return(false);
                    }
                }

                if (SelectedGroups.Count == 0)
                {       // Ничего не выделено
                    MessageBox.Show(m_ParentWnd,
                                    Properties.Resources.resNoGroupsToExport,
                                    (Parent as TabItem).Header.ToString(),
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    return(false);
                }

                if (SelectedGroups.Where(arg => arg.StartYearIndToExport > arg.EndYearIndToExport && arg.CanSelectYears).Count() > 0)
                {       // Есть ошибки в задании годов
                    MessageBox.Show(m_ParentWnd,
                                    Properties.Resources.resInvalidYearsToExport,
                                    (Parent as TabItem).Header.ToString(),
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    return(false);
                }
            }

            return(true);
        }