Example #1
0
 public void setAttribute(Kernel.Domain.Attribute attribute)
 {
     this.measureField      = null;
     this.attributeField    = attribute;
     this.periodField       = null;
     this.writeOffFieldType = WriteOffFieldType.ATTRIBUTE;
 }
 public void setAttribute(Kernel.Domain.Attribute attribute)
 {
     if (ActiveItem == null)
     {
         return;
     }
     if (canSetValue(ActiveItem) || cansetMeasure(ActiveItem))
     {
         return;
     }
     if (reconciliationContext == null)
     {
         reconciliationContext = new Kernel.Domain.ReconciliationContext();
     }
     if (ActiveItem == postingAttributePanel)
     {
         reconciliationContext.postingNbreAttribute = attribute;
     }
     else if (ActiveItem == dcAttributePanel)
     {
         reconciliationContext.dcNbreAttribute = attribute;
     }
     else if (ActiveItem == defaultRecoTypeAttributePanel)
     {
         reconciliationContext.defaultRecoTypeAttribute = attribute;
     }
     this.ActiveItem.setValue(attribute);
 }
Example #3
0
        public void SetTarget(Target target)
        {
            UIElement apanel = getActivePanel();

            if (apanel is WriteOffFieldPanel)
            {
                if (target is Kernel.Domain.Attribute)
                {
                    Kernel.Domain.Attribute attribute  = (Kernel.Domain.Attribute)target;
                    WriteOffFieldPanel      fieldPanel = (WriteOffFieldPanel)apanel;
                    bool isDuplicate = IsDuplicateLine(fieldPanel, SubjectType.ATTRIBUTE, attribute.name, fieldPanel.Index);
                    if (isDuplicate && ItemPresent != null)
                    {
                        ItemPresent(new object[] { SubjectType.ATTRIBUTE, attribute.name });
                    }
                    else
                    {
                        fieldPanel.setAttribute(attribute);
                    }
                }
            }
            else if (apanel is WriteOffFieldValuePanel)
            {
                if (target is Kernel.Domain.Attribute)
                {
                    ((WriteOffFieldValuePanel)apanel).setAttribute((Kernel.Domain.Attribute)target);
                }
                else if (target is Kernel.Domain.AttributeValue)
                {
                    ((WriteOffFieldValuePanel)apanel).setAttributeValue((Kernel.Domain.AttributeValue)target);
                }
            }
        }
        private void ComboboxActions(ComboBox combobox)
        {
            if (combobox == LeftMeasureComboBox)
            {
                if (combobox.SelectedItem is Kernel.Domain.Measure)
                {
                    Kernel.Domain.Measure measure = (Kernel.Domain.Measure)combobox.SelectedItem;
                    this.EditedObject.leftMeasure = measure;
                }
            }

            else if (combobox == RightMeasureComboBox)
            {
                if (combobox.SelectedItem is Kernel.Domain.Measure)
                {
                    Kernel.Domain.Measure measure = (Kernel.Domain.Measure)combobox.SelectedItem;
                    this.EditedObject.rightMeasure = measure;
                }
            }

            else if (combobox == RecoTypeComboBox)
            {
                if (combobox.SelectedItem is Kernel.Domain.Attribute)
                {
                    Kernel.Domain.Attribute attribut = (Kernel.Domain.Attribute)combobox.SelectedItem;
                    this.EditedObject.reconciliationType = attribut;
                }
            }
            else if (combobox == BalanceFormulaComboBox)
            {
                this.EditedObject.balanceFormulaEnum = (BalanceFormula)combobox.SelectedItem;
            }
        }
        public void AddDefaultAttributes(Domain.Attribute parent)
        {
            Domain.Attribute addNewAttribute = new Kernel.Domain.Attribute();
            addNewAttribute.IsAddNewItem = true;
            addNewAttribute.name         = "Add new attribute...";
            addNewAttribute.parent       = this.Root;
            this.Root.childrenListChangeHandler.Items.Add(addNewAttribute);

            if (parent.isCompleted && parent.HasMoreElements())
            {
                Domain.Attribute showModeAttributes = new Domain.Attribute();
                showModeAttributes.IsShowMoreItem = true;
                showModeAttributes.name           = "Show more attribute...";
                showModeAttributes.parent         = parent;
                parent.childrenListChangeHandler.Items.Add(showModeAttributes);
            }
            if (parent != this.Root && this.Root.isCompleted && this.Root.HasMoreElements())
            {
                Domain.Attribute showModeAttributes = new Domain.Attribute();
                showModeAttributes.IsShowMoreItem = true;
                showModeAttributes.name           = "Show more attribute...";
                showModeAttributes.parent         = this.Root;
                this.Root.childrenListChangeHandler.Items.Add(showModeAttributes);
            }
        }
 public void setAttribute(Kernel.Domain.Attribute attribute)
 {
     this.fieldsPanel.setAttribute(attribute);
     this.MandatoryValue.mandatoryValue = attribute.incremental;
     this.MandatoryValue.display();
     this.DefaultValueCombo.DefaultValuesCombobox.Visibility = attribute.incremental ? Visibility.Hidden : Visibility.Visible;
     this.FieldValuePanel.removeDateView(attribute.incremental);
 }
 private void RefreshAttribute(Kernel.Domain.Attribute attribute)
 {
     foreach (AttributeValue attributeValue in attribute.valueListChangeHandler.Items)
     {
         attributeValue.attribut = attribute;
         RefreshAttributeValue(attributeValue);
     }
 }
Example #8
0
        private bool IsFilterViewVisible(Kernel.Domain.Attribute attribute)
        {
            bool show = attribute != null;

            this.FilterComboBox.Visibility = show ? Visibility.Visible : Visibility.Collapsed;
            this.filterTextBox.Visibility  = System.Windows.Visibility.Collapsed;
            return(show);
        }
        public void DisplayAttributeWithValues(Kernel.Domain.Attribute attribute)
        {
            List <Kernel.Domain.Attribute> liste = new List <Kernel.Domain.Attribute>();

            RefreshAttribute(attribute);
            liste.Add(attribute);
            this.TreeViewModifications.ItemsSource = liste;
        }
Example #10
0
 public void setAttribute(Kernel.Domain.Attribute attribute)
 {
     this.getCurrentFieldValue().setAttribute(attribute);
     if (ItemChanged != null)
     {
         ItemChanged(this.WriteOffFieldValue);
     }
     display();
 }
Example #11
0
 public void setAttribute(Kernel.Domain.Attribute attribute)
 {
     this.getActiveWriteOffField().setAttribute(attribute);
     if (ItemChanged != null)
     {
         ItemChanged(this.writeOffField);
     }
     display();
 }
Example #12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public IHierarchyObject GetChildByName(string name, Kernel.Domain.Attribute Attribute)
 {
     foreach (AttributeValue value in Attribute.valueListChangeHandler.Items)
     {
         if (value.name.ToUpper().Equals(name.ToUpper()))
         {
             return(value);
         }
     }
     return(null);
 }
Example #13
0
 /// <summary>
 ///
 /// </summary>
 protected void onAttributeValueChange()
 {
     Kernel.Domain.Attribute attribute = attributeTreeList.GetSelectedValue();
     if (ActiveEntity != null && attribute != null)
     {
         attributeTreeList.ForgetDefaultAttributes(attribute);
         attribute.UpdateParents();
         ActiveEntity.UpdateParents();
         attributeTreeList.AddDefaultAttributes(attribute);
     }
     this.IsModify = true;
 }
Example #14
0
        public void setAttribute(Kernel.Domain.Attribute attribute)
        {
            UIElement apanel = getActivePanel();

            if (apanel is WriteOffFieldPanel)
            {
                ((WriteOffFieldPanel)apanel).setAttribute(attribute);
            }
            else if (apanel is WriteOffValueItem)
            {
                ((WriteOffValueItem)apanel).setAttribute(attribute);
            }
        }
Example #15
0
 public Kernel.Domain.Attribute getAttributeWithPaginateValues(int attributeOid, int currentPage, int attributePageSize)
 {
     try
     {
         var                     request     = new RestRequest(ResourcePath + "/attribute-page-values/" + attributeOid + "/" + currentPage + "/" + attributePageSize, Method.POST);
         RestResponse            queryResult = (RestResponse)RestClient.Execute(request);
         Kernel.Domain.Attribute model       = RestSharp.SimpleJson.DeserializeObject <Kernel.Domain.Attribute>(queryResult.Content);
         return(model);
     }
     catch (Exception e)
     {
         throw new BcephalException("Unable to Return attributeValues.", e);
     }
 }
Example #16
0
        private void OnExpanded(object sender, RoutedEventArgs e)
        {
            TreeViewItem treeviewItem = (TreeViewItem)sender;

            if (treeviewItem.Header != null && treeviewItem.Header is Kernel.Domain.Attribute)
            {
                Kernel.Domain.Attribute attribute = (Kernel.Domain.Attribute)treeviewItem.Header;
                if (ExpandAttribute != null && !attribute.LoadValues)
                {
                    ExpandAttribute(attribute);
                }
            }
            e.Handled = true;
        }
 /// <summary>
 /// Display entity attributes.
 /// Builds the root node and calls DisplayRoot()
 /// </summary>
 /// <param name="entity"> Entity to display </param>
 public void DisplayEntity(Kernel.Domain.Entity entity)
 {
     this.Entity = entity;
     if (entity != null)
     {
         Kernel.Domain.Attribute root = new Kernel.Domain.Attribute();
         root.childrenListChangeHandler = entity.attributeListChangeHandler;
         //root.entity = entity;
         this.DisplayRoot(root);
     }
     else
     {
         this.DisplayRoot(null);
     }
 }
 /// <summary>
 /// Initialize chidren's parent
 /// </summary>
 /// <param name="item"></param>
 private void RefreshParent(Kernel.Domain.Attribute item, bool addToSource = true)
 {
     if (item != null)
     {
         foreach (Domain.Attribute child in item.childrenListChangeHandler.Items)
         {
             if (addToSource)
             {
                 Source.Add(child);
             }
             child.SetParent(item);
             RefreshParent(child);
         }
     }
 }
Example #19
0
 protected override IHierarchyObject GetNewTreeViewModel()
 {
     Kernel.Domain.Attribute attribute = new Kernel.Domain.Attribute();
     attribute.name = "Attrinute1";
     if (Root != null)
     {
         Kernel.Domain.Attribute m = null;
         int i = 1;
         do
         {
             attribute.name = "Attrinute" + i++;
             m = (Kernel.Domain.Attribute)Root.GetChildByName(attribute.name);
         }while (m != null);
     }
     return(attribute);
 }
 protected Domain.Attribute GetNewAttribute()
 {
     Domain.Attribute attribute = new Domain.Attribute();
     attribute.name = "Attribute";
     if (Root != null)
     {
         Kernel.Domain.Attribute m = null;
         int i = 1;
         do
         {
             attribute.name = "Attribute" + i++;
             m = (Domain.Attribute)Root.GetChildByName(attribute.name);
         }while (m != null);
     }
     return(attribute);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="attribute"></param>
        /// <param name="name"></param>
        /// <returns>La attribute à copier</returns>
        private bool ValidateName(Kernel.Domain.Attribute value, string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                Kernel.Util.MessageDisplayer.DisplayError("Empty Attribute name", "Name can't be empty! ");
                return(false);
            }
            Domain.Attribute found = getAttributeByName(this.Root, name);
            if (found == null || found.Equals(value))
            {
                return(true);
            }

            Kernel.Util.MessageDisplayer.DisplayError("Duplicate Attribute", "There is another attribute named : '" + name + "'!");
            return(false);
        }
 protected String GetNewAttributeName(String name)
 {
     Domain.Attribute attribute = new Domain.Attribute();
     attribute.name = name;
     if (Root != null)
     {
         Kernel.Domain.Attribute m = (Domain.Attribute)Root.GetChildByName(attribute.name);
         int i = 1;
         while (m != null)
         {
             attribute.name = name + i++;
             m = (Domain.Attribute)Root.GetChildByName(attribute.name);
         }
     }
     return(attribute.name);
 }
Example #23
0
 protected void OnSelectedAttributeChange(object sender, DevExpress.Xpf.Grid.SelectedItemChangedEventArgs e)
 {
     Kernel.Domain.Attribute selection = attributeTreeList.GetSelectedValue();;
     if (selection != null && !selection.isCompleted && selection.oid.HasValue)
     {
         BrowserDataFilter filter = new BrowserDataFilter();
         filter.groupOid = selection.oid.Value;
         filter.page     = 1;
         filter.pageSize = 10;
         BrowserDataPage <Kernel.Domain.AttributeValue> page = ModelService.getRootAttributeValuesByAttribute(filter);
         selection.valueListChangeHandler.originalList = page.rows;
         selection.isCompleted = true;
         filter.page           = page.currentPage;
         filter.totalPages     = page.pageCount;
         selection.DataFilter  = filter;
     }
     attributeValueTreeList.DisplayAttribute(selection);
 }
 /// <summary>
 /// Cette méthode est exécutée lorsqu'on sélectionne une target sur la sidebar.
 /// Cette opération a pour but de rajouté la target sélectionnée au filtre de la table en édition,
 /// ou au scope des cellProperties correspondants à la sélection Excel.
 /// </summary>
 /// <param name="sender">La target sélectionné</param>
 protected void onSelectTargetFromSidebar(object sender)
 {
     if (sender != null && sender is Target)
     {
         object value = null;
         if (sender is Entity)
         {
             value = sender;
         }
         if (sender is AttributeValue)
         {
             value = sender;
         }
         if (sender is Kernel.Domain.Attribute)
         {
             Kernel.Domain.Attribute attribute = (Kernel.Domain.Attribute)sender;
             if (attribute.valueListChangeHandler.Items.Count <= 0)
             {
                 return;
             }
             if (!attribute.LoadValues)
             {
                 List <Kernel.Domain.AttributeValue> values = GetDesignService().ModelService.getAttributeValuesByAttribute(attribute.oid.Value);
                 attribute.valueListChangeHandler.Items.Clear();
                 foreach (Kernel.Domain.AttributeValue attrValue in values)
                 {
                     attribute.valueListChangeHandler.Items.Add(attrValue);
                 }
                 attribute.LoadValues = true;
             }
             value = attribute.valueListChangeHandler.Items;
         }
         else
         {
             value = sender;
         }
         DesignerEditorItem page = (DesignerEditorItem)getDesignerEditor().getActivePage();
         if (page == null)
         {
             return;
         }
         page.getDesignerForm().DesignerPropertiesPanel.SetValue(value);
     }
 }
Example #25
0
 public Misp.Kernel.Domain.Attribute getAttributeByValue(int oid)
 {
     try
     {
         var request = new RestRequest(ResourcePath + "/getAttributeByValue/", Method.POST);
         request.RequestFormat = DataFormat.Json;
         request.AddParameter("application/json", oid, ParameterType.RequestBody);
         RestResponse queryResult = (RestResponse)RestClient.Execute(request);
         try
         {
             Kernel.Domain.Attribute Attribute = RestSharp.SimpleJson.DeserializeObject <Kernel.Domain.Attribute>(queryResult.Content);
             return(Attribute);
         }
         catch (Exception)
         {
             return(null);
         }
     }
     catch (Exception e)
     {
         throw new BcephalException("Unable to Return targetAll.", e);
     }
 }
        private void OnNewClick(object sender, RoutedEventArgs e)
        {
            Domain.Attribute parent = GetSelectedValue();
            if (IsUsedToGenerateUniverse(parent))
            {
                return;
            }
            Kernel.Domain.Attribute attribute = GetNewAttribute();
            if (parent == null)
            {
                parent = this.Root;
            }
            if (parent != null)
            {
                ForgetDefaultAttributes(parent);
                parent.AddChild(attribute);
                parent.related = true;
                AddDefaultAttributes(parent);

                int row = Source.Count;
                Source.Remove(attribute);
                if (row - 2 >= 0)
                {
                    Source.Insert(row - 2, attribute);
                }
                else
                {
                    Source.Add(attribute);
                }
                SetSelectedValue(attribute);

                if (Changed != null)
                {
                    Changed();
                }
            }
        }
Example #27
0
 protected void onDoubleClickSelectTargetFromSidebar(object sender)
 {
     if (sender != null && sender is Target)
     {
         object value = null;
         if (sender is Entity)
         {
             value = sender;
         }
         else if (sender is Kernel.Domain.Attribute)
         {
             Kernel.Domain.Attribute attribute = (Kernel.Domain.Attribute)sender;
             if (attribute.valueListChangeHandler.Items.Count <= 0)
             {
                 value = attribute;
             }
             else
             {
                 value = TransformationTreeService.ModelService.getAttributeValuesByAttribute(attribute.oid.Value);
             }
         }
         else if (sender is AttributeValue)
         {
             AttributeValue attributeValue = (AttributeValue)sender;
             if (attributeValue.childrenListChangeHandler.Items.Count <= 0)
             {
                 value = attributeValue;
             }
             else
             {
                 value = attributeValue.childrenListChangeHandler.Items;
             }
         }
         SetValue(value);
     }
 }
Example #28
0
        public override bool Equals(object obj)
        {
            if (base.Equals(obj))
            {
                return(true);
            }

            if (obj is Kernel.Domain.Attribute)
            {
                Kernel.Domain.Attribute objm = (Kernel.Domain.Attribute)obj;
                if (objm.oid.HasValue && this.oid.HasValue)
                {
                    if (objm.oid == this.oid)
                    {
                        return(true);
                    }
                }
                if (objm.name != null && objm.name.Equals(this.name))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #29
0
 public void setAttribute(Kernel.Domain.Attribute attribute)
 {
     this.WriteOffConfigPanel.ActiveFieldPanel.setAttribute(attribute);
 }
Example #30
0
 public void setAttribute(Kernel.Domain.Attribute attribute)
 {
     this.ReconciliationContextPanel.setAttribute(attribute);
 }