Beispiel #1
0
 private void EditArea_DataItemLoaded(object sender, EditAreaDataItemLoadedArg e)
 {
     if (e.InEditMode)
     {
         foreach (var columnControl in FormulaColumns)
         {
             string generalKey = "formulaColumn" + AgentHelper.GetUniqueDataPostfix(e.DataItem);
             string usageKey   = columnControl.Column.ID.ToString();
             if (e.DataItem.ChangeMonitorExists(generalKey, usageKey))
             {
                 return;
             }
             var fullFormula = AgentUICoreMediator.GetAgentUICoreMediator.formulaManager.GetFormula(AgentUICoreMediator.GetAgentUICoreMediator.GetRequester(), columnControl.Column.ColumnCustomFormula.FormulaID);
             if (fullFormula.FormulaItems.Any(x => x.ItemType == FormuaItemType.Column || !string.IsNullOrEmpty(x.RelationshipIDTail)))
             {
                 e.DataItem.RelatedDataTailOrColumnChanged += DataItem_RelatedDataTailOrColumnChanged;
             }
             var columnItems = fullFormula.FormulaItems.Where(x => x.ItemType == FormuaItemType.Column);
             if (columnItems.Any())
             {
                 foreach (var item in columnItems)
                 {
                     e.DataItem.AddChangeMonitor(generalKey, usageKey, item.RelationshipIDTail, item.ItemID);
                 }
             }
             var relationshipItems = fullFormula.FormulaItems.Where(x => !string.IsNullOrEmpty(x.RelationshipIDTail)).GroupBy(x => x.RelationshipIDTail);
             if (relationshipItems.Any())
             {
                 foreach (var item in relationshipItems)
                 {
                     e.DataItem.AddChangeMonitor(generalKey, usageKey, item.Key, 0);
                 }
             }
         }
     }
 }
        private void EditArea_DataItemLoaded(object sender, EditAreaDataItemLoadedArg e)
        {
            //////if (SearchInitialyAreas == null)
            //////    GetInitialySearchEditAreas();

            //////if (SearchInitialyAreas == null || SearchInitialyAreas.Count == 0)
            //////{
            //////    EditArea.DataItemShown -= EditArea_DataItemShown;
            //////    return;
            //////}

            //////foreach (var item in SearchInitialyAreas.Where(x => !x.Item2.Any()))
            //////{
            //////    if (!item.Item1.SearchViewEntityArea.SearchInitialyDone)
            //////        item.Item1.SearchViewEntityArea.SearchInitialy();
            //////}

            //////if (!SearchInitialyAreas.Any(x => x.Item2.Any()))
            //////{
            //////    EditArea.DataItemShown -= EditArea_DataItemShown;
            //////    return;
            //////}

            //////if (sender is I_EditEntityAreaOneData)
            //////{
            //////    foreach (var item in ListRelationshipsFilters.ToList())
            //////    {
            //////        if (item.SourceEditArea == sender && e.DataItem != item.DataItem)
            //////            RemoveRelationshipsFilters(item);
            //////    }
            //////}

            //////var relFilter = new RelationshipFilterSource()
            //////{
            //////    SourceEditArea = (sender as I_EditEntityArea),
            //////    DataItem = e.DataItem
            //////};


            //////if (ListRelationshipsFilters.Any(x => x.DataItem == e.DataItem))
            //////{
            //////    //              throw new Exception("Asdasd");

            //////}
            //////ListRelationshipsFilters.Add(relFilter);

            //////CheckRelationships(relFilter);
            ////////if (testedDataItems.Any(x => x == e.DataItem))
            ////////    return;
            ////////testedDataItems.Add(e.DataItem);
            //////var dataItem = e.DataItem;
            //////List<Tuple<string, int>> relColumns = GetDependentColumns();
            //////if (relColumns.Any())
            //////{
            //////    relFilter.RegisterEvent();
            //////    relFilter.RelatedDataChanged += DataItem_RelatedDataChanged;
            //////    foreach (var column in relColumns)
            //////    {
            //////        dataItem.AddDataObserverForColumn("relfilter", column.Item1, column.Item2);

            //////    }
            //////}
        }