Exemple #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);
                 }
             }
         }
     }
 }