Exemple #1
0
        private BaseDetailDirective GetDirectiveByTitle(string title)
        {
            DirectiveFilter directiveFilter;

            if (currentDirective.DirectiveType == DirectiveTypeCollection.Instance.SBDirectiveType)
            {
                directiveFilter = new SBStatusFilter();
            }
            else if (currentDirective.DirectiveType == DirectiveTypeCollection.Instance.ADDirectiveType)
            {
                directiveFilter = new ADStatusFilter();
            }
            else
            {
                return(null);
            }
            DirectiveCollectionFilter filter = new DirectiveCollectionFilter(((BaseDetail)currentDirective.Parent).ContainedDirectives, new DirectiveFilter[] { directiveFilter });

            BaseDetailDirective[] directives = filter.GatherDirectives();
            for (int i = 0; i < directives.Length; i++)
            {
                if (directives[i].Title == title)
                {
                    return(directives[i]);
                }
            }
            return(null);
        }
Exemple #2
0
        ///<summary>
        /// Подписывает и отписывает собития добавления, редактирования и удаления директив
        ///</summary>
        ///<param name="addTo"></param>
        public void PerformEvents(bool addTo)
        {
            if (addTo)
            {
                parentBaseDetail.DirectiveAdded   += parentBaseDetail_DirectiveAdded;
                parentBaseDetail.DirectiveRemoved += parentBaseDetail_DirectiveRemoved;
            }
            else
            {
                parentBaseDetail.DirectiveAdded   -= parentBaseDetail_DirectiveAdded;
                parentBaseDetail.DirectiveRemoved -= parentBaseDetail_DirectiveRemoved;
            }
            directiveFilter.InitialCollection = parentBaseDetail.ContainedDirectives;
            BaseDetailDirective[]            baseDetailDirectiveArray = directiveFilter.GatherDirectives();
            List <EngineeringOrderDirective> directives = new List <EngineeringOrderDirective>();

            for (int i = 0; i < baseDetailDirectiveArray.Length; i++)
            {
                directives.Add((EngineeringOrderDirective)baseDetailDirectiveArray[i]);
            }
            for (int i = 0; i < directives.Count; i++)
            {
                HookDirective(directives[i], addTo);
            }
        }
/*        #region public ListView ItemsListView
 *
 *      /// <summary>
 *      /// Возвращает ListView
 *      /// </summary>
 *      public ListView ItemsListView
 *      {
 *          get
 *          {
 *              return listViewDirectives;
 *          }
 *      }
 *
 #endregion
 *
 #region public EngineeringOrderDirective[] Directives
 *
 *      /// <summary>
 *      /// Возвращает или устанавливает отображаемые директивы
 *      /// </summary>
 *      public EngineeringOrderDirective[] Directives
 *      {
 *          get
 *          {
 *              return directives.ToArray();
 *          }
 *          set
 *          {
 *              directives.Clear();
 *              directives.AddRange(value);
 *              UpdateItems();
 *          }
 *      }
 *
 #endregion*/

        #endregion

        #region Methods

        #region public override void UpdateItems()

        /// <summary>
        /// Обновляет элементы ListView
        /// </summary>
        public override void UpdateItems()
        {
            directiveFilter.InitialCollection = parentBaseDetail.ContainedDirectives;
            BaseDetailDirective[]            baseDetailDirectiveArray = directiveFilter.GatherDirectives();
            List <EngineeringOrderDirective> directives = new List <EngineeringOrderDirective>();

            for (int i = 0; i < baseDetailDirectiveArray.Length; i++)
            {
                directives.Add((EngineeringOrderDirective)baseDetailDirectiveArray[i]);
            }
            SetItemsArray(directives.ToArray());
        }
Exemple #4
0
        private Directive[] GatherDirectives(DirectiveCollectionFilter additionalFilter)
        {
            List <DirectiveFilter> filters = new List <DirectiveFilter>(viewFilter.Filters);

            if (additionalFilter != null)
            {
                filters.AddRange(additionalFilter.Filters);
            }
            DirectiveCollectionFilter filter =
                new DirectiveCollectionFilter(DirectiveSource.Directives, filters.ToArray());

            return(filter.GatherDirectives());
        }
Exemple #5
0
        private Directive[] GatherDirectives(DirectiveCollectionFilter additionalFilter)
        {
            List <DirectiveFilter> filters = new List <DirectiveFilter>(viewFilter.Filters);

            if (additionalFilter != null)
            {
                filters.AddRange(additionalFilter.Filters);
            }
            DirectiveCollectionFilter filter =
                new DirectiveCollectionFilter(DirectiveSource.Directives, filters.ToArray());

            Directive[] directives = filter.GatherDirectives();
            headerControl1.ContextActionControl.PrintButton.Enabled = (directives.Length != 0);
            return(directives);
        }
Exemple #6
0
        private BaseDetailDirective[] GatherDirectives(DirectiveCollectionFilter _additionalFilter)
        {
            List <DirectiveFilter> filters = new List <DirectiveFilter>(directiveFilter.Filters);

            if (_additionalFilter != null)
            {
                filters.AddRange(_additionalFilter.Filters);
            }
            DirectiveCollectionFilter filter =
                new DirectiveCollectionFilter(parentBaseDetail.ContainedDirectives, filters.ToArray());

            BaseDetailDirective[] directives = filter.GatherDirectives();
            labelTitle.Status = GetStatus(directives);
            return(directives);
        }
Exemple #7
0
        /// <summary>
        /// Выборка всех подходящих директив
        /// </summary>
        /// <returns></returns>
        public BaseDetailDirective[] GatherDirectives()
        {
            List <DirectiveFilter> filters = new List <DirectiveFilter>();

            filters.Add(directiveSelectionFilter);
            filters.Add(discrepanciesFilter);
            if (additionalFilter != null)
            {
                filters.AddRange(additionalFilter.Filters);
            }
            if (directiveContainer != null)
            {
                DirectiveCollectionFilter filter     = new DirectiveCollectionFilter(directiveContainer.AllDirectives, filters.ToArray());
                BaseDetailDirective[]     directives = filter.GatherDirectives();
                count = directives.Length;
                return(directives);
            }
            count = 0;
            return(new BaseDetailDirective[0]);
        }