Esempio n. 1
0
        /// <summary>
        /// Liste les périodes liés à une périodicité donnée.
        /// </summary>
        /// <param name="periodName">La périodicité</param>
        /// <returns>Les périodes de cette périodicité</returns>
        public ObservableCollection <PeriodInterval> getHierarchicalPeriod(int show)
        {
            ObservableCollection <PeriodInterval> periods = new ObservableCollection <PeriodInterval>();

            foreach (PeriodInterval year in buildYearPeriods())
            {
                periods.Add(year);
                PeriodName yearPeriodName = new PeriodName();
                yearPeriodName.periodFromTime = periodFromTime > year.periodFromDateTime ? periodFromTime : year.periodFromDateTime;
                yearPeriodName.periodToTime   = periodToTime < year.periodToDateTime ? periodToTime : year.periodToDateTime;

                foreach (PeriodInterval month in yearPeriodName.buildMonthPeriods())
                {
                    year.childrens.Add(month);
                    PeriodName monthPeriodName = new PeriodName();
                    monthPeriodName.periodFromTime = periodFromTime > month.periodFromDateTime ? periodFromTime : month.periodFromDateTime;
                    monthPeriodName.periodToTime   = periodToTime < month.periodToDateTime ? periodToTime : month.periodToDateTime;
                    foreach (PeriodInterval week in monthPeriodName.buildWeekPeriods())
                    {
                        month.childrens.Add(week);
                        PeriodName weekPeriodName = new PeriodName();
                        weekPeriodName.periodFromTime = periodFromTime > month.periodFromDateTime ? periodFromTime : month.periodFromDateTime;
                        weekPeriodName.periodToTime   = periodToTime < month.periodToDateTime ? periodToTime : month.periodToDateTime;
                    }
                }
            }

            return(periods);
        }
Esempio n. 2
0
 public void setPeriodName(Kernel.Domain.PeriodName periodName)
 {
     this.measureField      = null;
     this.attributeField    = null;
     this.periodField       = periodName;
     this.writeOffFieldType = WriteOffFieldType.PERIOD;
 }
Esempio n. 3
0
 public void setAttribute(Kernel.Domain.Attribute attribute)
 {
     this.measureField      = null;
     this.attributeField    = attribute;
     this.periodField       = null;
     this.writeOffFieldType = WriteOffFieldType.ATTRIBUTE;
 }
Esempio n. 4
0
 public void setMeasure(Measure measure)
 {
     this.measureField      = measure;
     this.attributeField    = null;
     this.periodField       = null;
     this.writeOffFieldType = WriteOffFieldType.MEASURE;
 }
Esempio n. 5
0
 public void refreshPeriodInterval(PeriodName periodName)
 {
     foreach (PeriodInterval child in childrenListChangeHandler.Items)
     {
         child.periodName = periodName;
         child.refreshPeriodInterval(periodName);
     }
 }
Esempio n. 6
0
 public PeriodName GetChildByName(PeriodName periodName, string name)
 {
     foreach (PeriodName period in childrenListChangeHandler.Items)
     {
         if (period.name.ToUpper().Equals(name.ToUpper()) && !period.Equals(periodName))
         {
             return(periodName);
         }
     }
     return(null);
 }
Esempio n. 7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="measure1"></param>
        /// <param name="measure2"></param>
        public void SwichtPosition(PeriodName periodName1, PeriodName periodName2)
        {
            int position = periodName1.position;

            periodName1.SetPosition(periodName2.position);
            periodName2.SetPosition(position);
            childrenListChangeHandler.AddUpdated(periodName1);
            childrenListChangeHandler.AddUpdated(periodName2);
            UpdateParents();
            OnPropertyChanged("childrenListChangeHandler.Items");
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IHierarchyObject GetCopy()
        {
            PeriodName periodName = new PeriodName();

            periodName.name     = "Copy Of " + this.name;
            periodName.position = -1;
            periodName.parent   = null;
            foreach (PeriodName child in this.childrenListChangeHandler.Items)
            {
                IHierarchyObject copy = child.GetCopy();
                periodName.AddChild(copy);
            }
            return(periodName);
        }
Esempio n. 9
0
        /// <summary>
        /// Retire un fils
        /// </summary>
        /// <param name="child"></param>
        public void RemoveChild(IHierarchyObject child)
        {
            foreach (IHierarchyObject item in childrenListChangeHandler.Items)
            {
                if (item.GetPosition() > child.GetPosition())
                {
                    item.SetPosition(item.GetPosition() - 1);
                    childrenListChangeHandler.AddUpdated((PeriodName)item);
                }
            }
            child.SetPosition(-1);
            PeriodName Child = (PeriodName)child;

            childrenListChangeHandler.AddDeleted(Child);
            UpdateParents();
        }
Esempio n. 10
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. 11
0
 /// <summary>
 /// return existing child with name: name and in not edition mode
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public IHierarchyObject GetNotEditedChildByName(PeriodName periodName, string name)
 {
     if (periodName.name.ToUpper().Equals(name.ToUpper()))
     {
         foreach (PeriodName periodname in childrenListChangeHandler.Items)
         {
             if (periodName.name == null)
             {
                 continue;
             }
             if (periodname.name.ToUpper().Equals(name.ToUpper()) && !periodname.Equals(periodName))
             {
                 return(periodname);
             }
             IHierarchyObject ob = periodname.GetNotEditedChildByName(periodName, name);
             if (ob != null)
             {
                 return(ob);
             }
         }
     }
     return(null);
 }
Esempio n. 12
0
        /// <summary>
        /// Liste les périodes liés à une périodicité donnée.
        /// </summary>
        /// <param name="periodName">La périodicité</param>
        /// <returns>Les périodes de cette périodicité</returns>
        public List <PeriodInterval> getPeriod(PeriodName periodName)
        {
            List <PeriodInterval> periods = new List <PeriodInterval>(0);

            if (periodName.granularity == Granularity.YEAR.name)
            {
                return(buildYearPeriods());
            }
            if (periodName.granularity == Granularity.MONTH.name)
            {
                return(buildMonthPeriods());
            }
            if (periodName.granularity == Granularity.WEEK.name)
            {
                return(buildWeekPeriods());
            }
            if (periodName.granularity == Granularity.DAY.name)
            {
                return(buildDayPeriods());
            }

            return(periods);
        }
Esempio n. 13
0
        public IHierarchyObject CloneObject()
        {
            PeriodName periodName  = new PeriodName();
            string     stringValue = this.name;

            periodName.name = stringValue;
            int intValue = this.position;

            periodName.position = intValue;
            //periodName.parent = this.parent != null ? (PeriodName)this.parent.CloneObject() : null;
            stringValue     = this.show;
            periodName.show = stringValue;
            bool boolValue = this.showDay;

            periodName.showDay      = boolValue;
            boolValue               = this.showMonth;
            periodName.showMonth    = boolValue;
            boolValue               = this.showWeek;
            periodName.showWeek     = boolValue;
            boolValue               = this.showYear;
            periodName.showYear     = boolValue;
            stringValue             = this.granularity;
            periodName.granularity  = stringValue;
            boolValue               = this.iDateDefault;
            periodName.iDateDefault = boolValue;
            intValue = this.incrementationCount;
            periodName.incrementationCount = intValue;
            boolValue                   = this.isModified;
            periodName.isModified       = boolValue;
            stringValue                 = this.modificationDate;
            periodName.modificationDate = stringValue;
            stringValue                 = this.creationDate;
            periodName.creationDate     = stringValue;
            intValue = this.oid.HasValue ? this.oid.Value : 0;
            if (intValue != 0)
            {
                periodName.oid = intValue;
            }
            stringValue           = this.typeName;
            periodName.typeName   = stringValue;
            stringValue           = this.periodFrom;
            periodName.periodFrom = stringValue;
            stringValue           = this.periodTo;
            periodName.periodTo   = stringValue;
            periodName.root       = null;
            periodName.intervalListChangeHandler = new PersistentListChangeHandler <PeriodInterval>();
            foreach (PeriodInterval intervalle in this.intervalListChangeHandler.Items)
            {
                periodName.intervalListChangeHandler.AddNew((PeriodInterval)intervalle.CloneObject());
            }
            periodName.root                      = periodName.GetRootPeriodInterval();
            boolValue                            = this.isModified;
            periodName.isModified                = boolValue;
            boolValue                            = this.isCompleted;
            periodName.isCompleted               = boolValue;
            stringValue                          = this.DEFAULT_DATE_NAME1;
            periodName.DEFAULT_DATE_NAME1        = stringValue;
            periodName.childrenListChangeHandler = new PersistentListChangeHandler <PeriodName>();
            foreach (PeriodName periodname in this.childrenListChangeHandler.Items)
            {
                periodName.AddChild((PeriodName)periodname.CloneObject());
            }

            return(periodName);
        }