Ejemplo n.º 1
0
 public void OnNewPeriodName(object sender, RoutedEventArgs e)
 {
     Kernel.Domain.PeriodName periodName = AddNode();
     if (Changed != null)
     {
         Changed();
     }
     this.DisplayRoot(this.Root, periodName.position);
     setSelectedItem(periodName.position);
 }
Ejemplo n.º 2
0
        public void setPeriodName(Kernel.Domain.PeriodName PeriodName)
        {
            this.getActiveWriteOffField().setPeriodName(PeriodName);
            if (ItemChanged != null)
            {
                ItemChanged(this.writeOffField);
            }

            display();
        }
Ejemplo n.º 3
0
 public void DisplayPeriods(Kernel.Domain.PeriodName root)
 {
     if (root == null)
     {
         this.periodNameTreeview.ItemsSource = null;
     }
     else
     {
         DisplayPeriods(root.childrenListChangeHandler.getItems().ToList());
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public IHierarchyObject GetChildByName(string name, Kernel.Domain.PeriodName periodName)
 {
     foreach (PeriodInterval periodInterval in periodName.intervalListChangeHandler.Items)
     {
         if (periodInterval.name.ToUpper().Equals(name.ToUpper()))
         {
             return(periodInterval);
         }
     }
     return(null);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Supprime un noeud et ses fils.
 /// </summary>
 /// <param name="model">Le noeud à supprimer</param>
 public void DeleteNode(Kernel.Domain.PeriodName item)
 {
     if (item != null && item.parent != null)
     {
         int index = item.GetPosition();
         item.GetParent().RemoveChild(item);
         if (Changed != null)
         {
             Changed();
         }
     }
 }
Ejemplo n.º 6
0
        protected override void OnContextMenuOpening(ContextMenuEventArgs e)
        {
            bool enabled = false;

            Kernel.Domain.PeriodName selecteItem = GetSelectedPeriodName();
            int size = this.periodNameList.Items.Count - 1;

            enabled = selecteItem != null;

            this.moveUpMenuItem.IsEnabled   = enabled && selecteItem.position != 0;
            this.moveDownMenuItem.IsEnabled = enabled && selecteItem.position < size;
            this.deleteMenuItem.IsEnabled   = enabled && !selecteItem.iDateDefault;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initialize chidren's parent
 /// </summary>
 /// <param name="item"></param>
 private void RefreshParent(Kernel.Domain.PeriodName item, bool addToSource = true)
 {
     if (item != null)
     {
         foreach (Domain.PeriodName child in item.childrenListChangeHandler.Items)
         {
             if (addToSource)
             {
                 Source.Add(child);
             }
             child.SetParent(item);
             RefreshParent(child);
         }
     }
 }
Ejemplo n.º 8
0
        public virtual Kernel.Domain.PeriodName AddNode(string name = "")
        {
            Kernel.Domain.PeriodName child = GetNewPeriodName();

            if (name != "")
            {
                child.name = name;
            }
            this.Root.AddChild(child);
            if (Changed != null)
            {
                Changed();
            }
            return(child);
        }
Ejemplo n.º 9
0
        private void OnMoveDownPeriodName(object sender, RoutedEventArgs e)
        {
            Kernel.Domain.PeriodName selecteItem = GetSelectedPeriodName();
            if (selecteItem == null)
            {
                return;
            }
            List <Kernel.Domain.PeriodName> listeToDelete = this.periodNameList.SelectedItems.Cast <Kernel.Domain.PeriodName>().ToList();

            listeToDelete.BubbleSort();
            int firstIndex = listeToDelete[0].position;

            MoveNode(selecteItem, false);
            setSelectedItem(selecteItem.position);
        }
Ejemplo n.º 10
0
 public Kernel.Domain.PeriodName getRootPeriodNameForSidebar()
 {
     try
     {
         var                      request     = new RestRequest(ResourcePath + "/root-for-sidebar", Method.GET);
         RestResponse             queryResult = (RestResponse)RestClient.Execute(request);
         Kernel.Domain.PeriodName root        = RestSharp.SimpleJson.DeserializeObject <Kernel.Domain.PeriodName>(queryResult.Content);
         return(root);
     }
     catch (Exception e)
     {
         logger.Error("Unable to Return PeriodName.", e);
         throw new ServiceExecption("Unable to Return PeriodName.", e);
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="attribute"></param>
        /// <param name="name"></param>
        /// <returns>La attribute à copier</returns>
        private bool ValidateName(Kernel.Domain.PeriodName value, string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                Kernel.Util.MessageDisplayer.DisplayError("Empty Period name", "Name can't be empty! ");
                return(false);
            }
            Domain.PeriodName found = getPeriodByName(this.Root, name);
            if (found == null || found.Equals(value))
            {
                return(true);
            }

            Kernel.Util.MessageDisplayer.DisplayError("Duplicate Period", "There is another Period named : '" + name + "'!");
            return(false);
        }
Ejemplo n.º 12
0
 protected Domain.PeriodName GetNewPeriod()
 {
     Domain.PeriodName attribute = new Domain.PeriodName();
     attribute.name = "Period";
     if (Root != null)
     {
         Kernel.Domain.PeriodName m = null;
         int i = 1;
         do
         {
             attribute.name = "Period" + i++;
             m = (Domain.PeriodName)Root.GetChildByName(attribute.name);
         }while (m != null);
     }
     return(attribute);
 }
Ejemplo n.º 13
0
 protected Kernel.Domain.PeriodName GetNewPeriodName(Domain.PeriodName value = null)
 {
     Kernel.Domain.PeriodName periodname = new Kernel.Domain.PeriodName();
     periodname.name = "Period1";
     if (Root != null)
     {
         Kernel.Domain.PeriodName m = null;
         int i = 1;
         do
         {
             periodname.name = "Period" + i++;
             m = (Kernel.Domain.PeriodName)Root.GetChildByName(periodname.name);
         }while (m != null);
     }
     return(periodname);
 }
Ejemplo n.º 14
0
 public void MoveNode(Kernel.Domain.PeriodName item, bool up)
 {
     if (item.parent != null)
     {
         int position           = item.position + (up ? -1 : 1);
         IHierarchyObject child = item.parent.GetChildByPosition(position);
         if (child != null)
         {
             child.SetPosition(item.position);
             item.parent.UpdateChild(child);
             item.SetPosition(position);
             item.parent.UpdateChild(item);
             if (Changed != null)
             {
                 Changed();
             }
         }
     }
 }
Ejemplo n.º 15
0
 protected String GetNewPeriodName(string name)
 {
     Domain.PeriodName measure = new Domain.PeriodName();
     measure.name = name;
     if (Root != null)
     {
         Kernel.Domain.PeriodName m = (Domain.PeriodName)Root.GetChildByName(measure.name);
         int i = 1;
         while (m != null)
         {
             ;
         }
         {
             measure.name = name + i++;
             m            = (Domain.PeriodName)Root.GetChildByName(measure.name);
         }
     }
     return(measure.name);
 }
Ejemplo n.º 16
0
 public void DisplayRoot(Domain.PeriodName root, int?selectedIndex = null)
 {
     this.Root = root;
     if (this.Root == null)
     {
         this.periodNameList.ItemsSource = null;
     }
     else
     {
         RefreshParent(this.Root);
         this.periodNameList.ItemsSource = null;
         this.periodNameList.ItemsSource = this.Root.listePeriodNames.Items;
         int countItems = this.Root.listePeriodNames.Items.Count;
         selectedIndex = selectedIndex >= 0 ? selectedIndex : 0;
         if (countItems > 0 && selectedIndex != null)
         {
             this.periodNameList.SelectedItem = this.periodNameList.Items.GetItemAt(selectedIndex.Value);
         }
     }
 }
Ejemplo n.º 17
0
        public Kernel.Domain.PeriodName BuildNewPeriodName()
        {
            Kernel.Domain.PeriodName periodName = new Kernel.Domain.PeriodName();
            periodName.name = "Period";
            List <Kernel.Domain.PeriodName> periodNames = this.periodNameList.Items.Cast <Kernel.Domain.PeriodName>().ToList();

            if (periodNames != null)
            {
                Kernel.Domain.PeriodName p = null;
                int i = 1;
                do
                {
                    periodName.name = "Period" + i++;
                    p = getPeriodByName(periodName.name);
                }while (p != null);
            }
            else
            {
                periodName.name = "Period1";
            }
            return(periodName);
        }
Ejemplo n.º 18
0
 public void setPeriodName(Kernel.Domain.PeriodName periodName)
 {
     this.WriteOffConfigPanel.ActiveFieldPanel.setPeriodName(periodName);
 }