Exemple #1
0
        /// <summary>
        /// Обновление табличной части
        /// </summary>
        private void FilterUpdate()
        {
            DateTime fromDate = fieldDateFrom.Value;
            DateTime toDate   = fieldDateTo.Value;

            RepositoryRecords filterRecords = new RepositoryRecords();

            foreach (Record record in this.RR.Records())
            {
                if (fieldIsDateCreated.Checked)
                {
                    //Если выбрано по дате создания записи
                    if (record.CreateDate >= fromDate && record.CreateDate <= toDate)
                    {
                        filterRecords.Add(record);
                    }
                }
                else
                {
                    //Если выбрано по дате события
                    if (record.EventDate >= fromDate && record.EventDate <= toDate)
                    {
                        filterRecords.Add(record);
                    }
                }
            }

            GridRecords.Grid.DataSource = filterRecords.Records();

            if (fieldExportPatch.Text != "" && filterRecords.Records().Length > 0)
            {
                buttonExport.Enabled = true;
                RepositoryAgents filterAgents = new RepositoryAgents();
                foreach (Record record in filterRecords.Records())
                {
                    if (record.Agents != null)
                    {
                        foreach (Agent agent in record.Agents)
                        {
                            filterAgents.Add(agent);
                        }
                    }
                }

                // Репозитории подготовленые к экспорту
                this.ExportRA = filterAgents;
                this.ExportRR = filterRecords;
            }
            else
            {
                buttonExport.Enabled = false;
                this.ExportRA        = null;
                this.ExportRR        = null;
            }
        }
Exemple #2
0
        /// <summary>
        /// Обновление табличной части, делает загрузку данных согласно фильтрации
        /// </summary>
        private void FilterUpdate()
        {
            DateTime fromDate = fieldDateFrom.Value;
            DateTime toDate   = fieldDateTo.Value;

            // Загружаем данные из файлов
            if (fieldImportPath.Text != "")
            {
                RepositoryAgents FileAgents = new RepositoryAgents();
                FileAgents.Load(fieldImportPath.Text);

                RepositoryRecords FileRecords = new RepositoryRecords();
                FileRecords.Load(FileAgents, fieldImportPath.Text);

                RepositoryRecords filterRecords = new RepositoryRecords();

                foreach (Record record in FileRecords.Records())
                {
                    if (fieldIsDateCreated.Checked)
                    {
                        //Если выбрано по дате создания записи
                        if (record.CreateDate >= fromDate && record.CreateDate <= toDate)
                        {
                            filterRecords.Add(record);
                        }
                    }
                    else
                    {
                        //Если выбрано по дате события
                        if (record.EventDate >= fromDate && record.EventDate <= toDate)
                        {
                            filterRecords.Add(record);
                        }
                    }
                }

                GridRecords.Grid.DataSource = filterRecords.Records();

                if (filterRecords.Count > 0)
                {
                    buttonImport.Enabled = true;

                    RepositoryAgents filterAgents = new RepositoryAgents();
                    foreach (Record record in filterRecords.Records())
                    {
                        if (record.Agents != null)
                        {
                            foreach (Agent agent in record.Agents)
                            {
                                filterAgents.Add(agent);
                            }
                        }
                    }

                    this.ImportRA = filterAgents;
                    this.ImportRR = filterRecords;
                }
                else
                {
                    buttonImport.Enabled = false;
                    this.ImportRA        = null;
                    this.ImportRR        = null;
                }
            }
        }