Esempio n. 1
0
 public void SetValue(object value)
 {
     this.scope          = null;
     this.measure        = null;
     this.periodFrom     = null;
     this.periodTo       = null;
     this.periodInterval = null;
     this.periodName     = null;
     if (value != null && value is Target)
     {
         this.scope = (Target)value;
     }
     else if (value != null && value is Measure)
     {
         this.measure = (Measure)value;
     }
     else if (value != null && value is PeriodInterval)
     {
         PeriodInterval interval = (PeriodInterval)value;
         this.periodName                = interval.periodName;
         this.periodInterval            = new PeriodInterval(0, interval.name, interval.periodFromDateTime, interval.periodToDateTime);
         this.periodInterval.periodName = this.periodName;
         this.periodName                = this.periodInterval.periodName;
         this.periodFrom                = this.periodInterval.fromAsString;
         this.periodTo = this.periodInterval.toAsString;
     }
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="measure1"></param>
        /// <param name="measure2"></param>
        public void SwichtPosition(PeriodInterval periodInterval1, PeriodInterval periodInterval2)
        {
            int position = periodInterval1.position;

            periodInterval1.SetPosition(periodInterval2.position);
            periodInterval2.SetPosition(position);
            childrenListChangeHandler.AddUpdated(periodInterval1);
            childrenListChangeHandler.AddUpdated(periodInterval2);
            UpdateParents();
            OnPropertyChanged("childrenListChangeHandler.Items");
        }
Esempio n. 3
0
 /// <summary>
 /// Oublier un fils
 /// </summary>
 /// <param name="child"></param>
 public void ForgetPeriodInterval(PeriodInterval Root)
 {
     foreach (PeriodInterval item in intervalListChangeHandler.Items)
     {
         if (item.GetPosition() > Root.GetPosition())
         {
             item.SetPosition(item.GetPosition() - 1);
         }
     }
     Root.SetPosition(-1);
     intervalListChangeHandler.forget(Root);
 }
Esempio n. 4
0
        public IHierarchyObject CloneObject()
        {
            PeriodInterval periodInterval = new PeriodInterval();

            periodInterval.name     = this.name;
            periodInterval.position = this.position;
            periodInterval.childrenListChangeHandler = new PersistentListChangeHandler <PeriodInterval>();
            foreach (PeriodInterval interval in this.childrenListChangeHandler.Items)
            {
                PeriodInterval cloneInterval = (PeriodInterval)interval.CloneObject();
                periodInterval.childrenListChangeHandler.AddNew(cloneInterval);
            }
            return(periodInterval);
        }
Esempio n. 5
0
 public void RemovePeriodInterval(PeriodInterval interval)
 {
     foreach (PeriodInterval item in intervalListChangeHandler.Items)
     {
         if (item.GetPosition() > interval.GetPosition())
         {
             item.SetPosition(item.GetPosition() - 1);
             intervalListChangeHandler.AddUpdated(item);
         }
     }
     interval.SetPosition(-1);
     intervalListChangeHandler.AddDeleted(interval);
     UpdateParents();
 }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IHierarchyObject GetCopy()
        {
            PeriodInterval periodInterval = new PeriodInterval();

            periodInterval.name     = "Copy Of " + this.name;
            periodInterval.position = -1;
            periodInterval.parent   = null;

            foreach (PeriodInterval child in this.childrenListChangeHandler.Items)
            {
                IHierarchyObject copy = child.GetCopy();
                periodInterval.AddChild(copy);
            }
            return(periodInterval);
        }
Esempio n. 7
0
        public PeriodInterval GetRootPeriodInterval()
        {
            if (this.intervalListChangeHandler.Items.Count == 0)
            {
                this.root = null;
            }

            if (this.root == null)
            {
                root            = new PeriodInterval();
                root.name       = "Root PeriodInterval";
                root.periodFrom = this.periodFrom;
                root.periodTo   = this.periodTo;
                root.periodName = this;
            }
            root.childrenListChangeHandler = intervalListChangeHandler;
            return(root);
        }
Esempio n. 8
0
 /// <summary>
 /// return existing child with name: name and in not edition mode
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public IHierarchyObject GetNotEditedChildByName(PeriodInterval editedValue, string name)
 {
     if (editedValue.name.ToUpper().Equals(name.ToUpper()))
     {
         foreach (PeriodInterval periodInterval in childrenListChangeHandler.Items)
         {
             if (periodInterval.name.ToUpper().Equals(name.ToUpper()) && !periodInterval.Equals(editedValue))
             {
                 return(periodInterval);
             }
             IHierarchyObject ob = periodInterval.GetNotEditedChildByName(editedValue, name);
             if (ob != null)
             {
                 return(ob);
             }
         }
     }
     return(null);
 }
Esempio n. 9
0
        public void Update(PeriodName p)
        {
            this.curentIntervalGroupName = p.curentIntervalGroupName;
            this.periodFrom = p.periodFrom;
            this.periodTo   = p.periodTo;
            //this.position = p.position;
            this.showDay             = p.showDay;
            this.showMonth           = p.showMonth;
            this.showWeek            = p.showWeek;
            this.showYear            = p.showYear;
            this.typeName            = p.typeName;
            this.name                = p.name;
            this.incrementationCount = p.incrementationCount;
            this.granularity         = p.granularity;

            PeriodInterval group = new PeriodInterval(0, p.curentIntervalGroupName, p.periodFromTime, p.periodToTime);

            group.childrenListChangeHandler.AddNew(p.intervalListChangeHandler.Items);
            this.AddPeriodInterval(group);
        }
Esempio n. 10
0
 public void AddPeriodInterval(PeriodInterval interval)
 {
     interval.SetPosition(intervalListChangeHandler.Items.Count);
     intervalListChangeHandler.AddNew(interval);
     UpdateParents();
 }
Esempio n. 11
0
 public void setPeriodInterval(PeriodInterval interval)
 {
     this.attribute      = null;
     this.attributeValue = null;
     this.period         = interval;
 }