Esempio n. 1
0
        private void OnDeleted(object item)
        {
            PeriodItemPanel panel = (PeriodItemPanel)item;

            if (this.Period == null)
            {
                this.Period = GetNewPeriod();
            }
            if (panel.PeriodItem == null)
            {
                return;
            }
            panel.PeriodItem.period = this.Period;
            this.panel.Children.Remove(panel);
            if (this.ActiveItemPanel != null && this.ActiveItemPanel == panel && this.panel.Children.Count > 0)
            {
                this.ActiveItemPanel = (PeriodItemPanel)this.panel.Children[this.panel.Children.Count - 1];
            }
            int index = 1;

            foreach (object pan in this.panel.Children)
            {
                ((PeriodItemPanel)pan).Index = index++;
            }
            OnChanged(null);
            if (ItemDeleted != null && panel.PeriodItem != null)
            {
                ItemDeleted(panel.PeriodItem);
            }
        }
Esempio n. 2
0
 protected void AddItemPanel(PeriodItemPanel itemPanel)
 {
     //itemPanel.Changed += OnChanged;
     itemPanel.Added           += OnAdded;
     itemPanel.Updated         += OnUpdated;
     itemPanel.Deleted         += OnDeleted;
     itemPanel.Activated       += OnActivated;
     itemPanel.ValidateFormula += OnValidateFormula;
     this.panel.Children.Add(itemPanel);
 }
Esempio n. 3
0
        private void OnUpdated(object item)
        {
            PeriodItemPanel panel = (PeriodItemPanel)item;

            if (this.Period == null)
            {
                this.Period = GetNewPeriod();
            }
            this.Period.UpdatePeriodItem(panel.PeriodItem);
            OnChanged(panel.PeriodItem);
        }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public PeriodItemPanel GetPeriodItemPanel(string name)
 {
     foreach (object item in this.panel.Children)
     {
         PeriodItemPanel panel = (PeriodItemPanel)item;
         if (panel.NameTextBox.Text != null && panel.NameTextBox.Text.Trim().ToUpper().Equals(name.ToUpper()) &&
             !name.ToUpper().Equals(PeriodName.DEFAULT_DATE_NAME.ToUpper()))
         {
             return(panel);
         }
     }
     return(null);
 }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        public void DisplayPeriod(Period period, bool isTableView = false, bool readOnly = false)
        {
            this.Period = period;
            this.panel.Children.Clear();
            if (forAutomaticSourcing)
            {
                this.tagFormula.Visibility = System.Windows.Visibility.Collapsed;
            }
            if (this.IsReadOnly)
            {
                this.NewPeriodTextBlock.Visibility = System.Windows.Visibility.Collapsed;
            }
            int index = 1;

            if (period == null || period.itemListChangeHandler.Items.Count == 0)
            {
                if (!this.IsReadOnly)
                {
                    this.ActiveItemPanel = new PeriodItemPanel(index, forReport, forAutomaticSourcing, isTableView);
                    this.ActiveItemPanel.NameTextBox.Text = PeriodName.DEFAULT_DATE_NAME;
                    this.ActiveItemPanel.SetReadOnly(readOnly);
                    AddItemPanel(this.ActiveItemPanel);
                }
                return;
            }
            bool isDefaultDate = false;

            foreach (PeriodItem item in period.itemListChangeHandler.Items)
            {
                isDefaultDate = item.name.Equals(PeriodName.DEFAULT_DATE_NAME, StringComparison.OrdinalIgnoreCase);
                isDefaultDate = isDefaultDate && String.IsNullOrEmpty(item.value);
                PeriodItemPanel itemPanel = new PeriodItemPanel(item, forReport, forAutomaticSourcing, isTableView);
                if (this.IsReadOnly)
                {
                    itemPanel.SetReadOnly(this.IsReadOnly);
                }
                AddItemPanel(itemPanel);
                index++;
            }

            /*if (!isDefaultDate && this.panel.Children.Count > 1)
             * {
             *  this.ActiveItemPanel = new PeriodItemPanel(index, forReport, forAutomaticSourcing,isTableView);
             *  AddItemPanel(this.ActiveItemPanel);
             * }*/
        }
Esempio n. 6
0
 public PeriodItemPanel GetPeriodItemPanelForInterval(string name)
 {
     foreach (object item in this.panel.Children)
     {
         PeriodItemPanel panel = (PeriodItemPanel)item;
         if (panel.NameTextBox.Text != null && panel.NameTextBox.Text.ToUpper().Equals(name.ToUpper()))
         {
             if (panel.PeriodItem == null)
             {
                 return(null);
             }
             if (name.ToUpper().Equals(PeriodName.DEFAULT_DATE_NAME.ToUpper()) || String.IsNullOrEmpty(panel.PeriodItem.value))
             {
                 this.ActiveItemPanel = panel;
             }
             else
             {
                 return(panel);
             }
         }
     }
     return(null);
 }
Esempio n. 7
0
        private void OnActivated(object item)
        {
            PeriodItemPanel panel = (PeriodItemPanel)item;

            this.ActiveItemPanel = panel;
        }
Esempio n. 8
0
        private void OnValidateFormula(object item)
        {
            PeriodItemPanel panel = (PeriodItemPanel)item;

            OnChanged(panel.PeriodItem);
        }