//صدا زده میشود RelationData تنها بوسیله ShowData برای نمایش داده های اضافه شده در آن صدا زده میشود.در مابقی موارد ShowData که AddData فقط یکجا مشخص میشود و آنهم در specificDate public override bool ShowDataInDataView(DP_DataRepository specificDate) { if (!specificDate.IsFullData) { throw new Exception("asdasd"); } foreach (var propertyControl in SimpleColumnControls) { var property = specificDate.GetProperty(propertyControl.Column.ID); if (property != null) { //////ShowTypePropertyControlValue(specificDate, propertyControl, property.Value); //if (propertyControl.Column.ColumnValueRange != null && propertyControl.Column.ColumnValueRange.Details.Any()) //{ // var columnKeyValue = propertyControl.Column.ColumnValueRange; // CheckItemsSourceAndPropertyValue(propertyControl, specificDate); //} SetBinding(specificDate, propertyControl, property); } else { //???? } } bool result = true; //جدید--دقت شود که اگر نمایش مستقیم نیست داخل فرم رابطه ای نباید همه کنترلها مقداردهی شوند foreach (var relationshipControl in RelationshipColumnControls) { bool relationshipFirstSideHasValue = relationshipControl.Relationship.RelationshipColumns.Any() && relationshipControl.Relationship.RelationshipColumns.All(x => specificDate.GetProperties().Any(y => !AgentHelper.ValueIsEmpty(y) && y.ColumnID == x.FirstSideColumnID)); //relationshipControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelatedData = specificDate; //اینجا یکارایی بشه دسترسی موقت bool childLoadedBefore = specificDate.ChildRelationshipInfos.Any(x => x.Relationship.ID == relationshipControl.Relationship.ID); ChildRelationshipInfo childData = null; if (childLoadedBefore) { childData = specificDate.ChildRelationshipInfos.First(x => x.Relationship.ID == relationshipControl.Relationship.ID); } else { if (!relationshipFirstSideHasValue) { childData = specificDate.AddChildRelationshipInfo(relationshipControl.Relationship); } else { bool childIsDataView = (relationshipControl.EditNdTypeArea.AreaInitializer.IntracionMode == IntracionMode.CreateDirect || relationshipControl.EditNdTypeArea.AreaInitializer.IntracionMode == IntracionMode.CreateSelectDirect); if (childIsDataView) { childData = AreaInitializer.EditAreaDataManager.SerachDataFromParentRelationForChildDataView(relationshipControl.Relationship, this, relationshipControl.EditNdTypeArea, specificDate); } else { childData = AreaInitializer.EditAreaDataManager.SerachDataFromParentRelationForChildTempView(relationshipControl.Relationship, this, relationshipControl.EditNdTypeArea, specificDate); } } } if (childData.SecurityIssue == false) { // if (relationshipControl.EditNdTypeArea.AreaInitializer.IntracionMode == IntracionMode.CreateInDirect || //relationshipControl.EditNdTypeArea.AreaInitializer.IntracionMode == IntracionMode.CreateSelectInDirect) // { // if (relationshipControl.EditNdTypeArea.TemporaryDisplayView != null) // relationshipControl.EditNdTypeArea.TemporaryDisplayView.DisableEnable(TemporaryLinkType.DataView, true); // if (relationshipControl.EditNdTypeArea.TemporaryDisplayView != null) // { // if (relationshipControl.EditNdTypeArea.SecurityReadOnlyByParent|| relationshipControl.EditNdTypeArea.AreaInitializer.SecurityReadOnly ) // { // if (!childData.RelatedData.Any()) // { // //اگر مستقیم بود چی..اصن نباید دیتای دیفالت تولید بشه .درست شود // relationshipControl.EditNdTypeArea.TemporaryDisplayView.DisableEnable(TemporaryLinkType.DataView, false); // } // } // } // } var childResult = relationshipControl.EditNdTypeArea.SetChildRelationshipInfoAndShow(childData); if (!childResult) { result = false; } } else { result = false; } } if (result) { OnDataItemShown(new EditAreaDataItemLoadedArg() { DataItem = specificDate, InEditMode = true }); } // CheckRelationshipReadonlyEnablity(); DecideDataSectionEnablity(); return(result); //else }
private EditAreaDataActionLog ToDataLog(DP_DataRepository item) { EditAreaDataActionLog log = new EditAreaDataActionLog(); if (item.ParantChildRelationshipInfo != null && item.ParantChildRelationshipInfo.DataItemIsAdded(item)) { if (item.IsNewItem) { log.ActionType = LogAction.AddedToRelationshipNewData; } else { if (item.IsEdited) { log.ActionType = LogAction.AddedToRelationshipAndEdited; } else { log.ActionType = LogAction.AddedToRelationshipAndNotEdited; } } } else { if (item.IsNewItem) { log.ActionType = LogAction.NewData; } else { if (item.IsEdited) { log.ActionType = LogAction.EditData; } else { log.ActionType = LogAction.EditDataNotEdited; } } } log.EntityID = item.TargetEntityID; //log.EntityName = item.; log.DataInfo = item.ViewInfo; log.KeyProperties = item.KeyProperties; List <EntityInstanceProperty> changedPropeties = null; if (item.IsNewItem) { changedPropeties = item.GetProperties(); } else { changedPropeties = item.GetProperties().Where(x => x.ValueIsChanged).ToList(); } foreach (var property in changedPropeties) { var actionLogProperty = new ActionLogProperty(); actionLogProperty.ColumnaName = property.Column.Alias; actionLogProperty.ColumnID = property.ColumnID; actionLogProperty.InfoColor = InfoColor.Black; var stringvalue = property.Value == null ? "<Null>" : property.Value; if (property.FormulaID != 0) { if (string.IsNullOrEmpty(property.FormulaException)) { actionLogProperty.NewValue = stringvalue + " " + "محاسبه شده توسط فرمول" + " " + property.FormulaID; } else { actionLogProperty.NewValue = stringvalue + " " + property.FormulaException; actionLogProperty.InfoColor = InfoColor.Red; } } else { actionLogProperty.NewValue = stringvalue.ToString(); } if (item.IsNewItem) { if (property.Column.IsIdentity) { if (AgentHelper.ValueIsEmpty(property)) { actionLogProperty.NewValue = "<identity>"; } } } if (item.OriginalProperties.Any(x => x.ColumnID == property.ColumnID)) { var oldvalue = item.OriginalProperties.First(x => x.ColumnID == property.ColumnID).Value; actionLogProperty.OldValue = oldvalue == null ? "<Null>" : oldvalue.ToString(); } log.LogProperties.Add(actionLogProperty); } foreach (var child in item.ChildRelationshipInfos) { var relatedLog = new RelatedDataLog(); relatedLog.RelationshipID = child.Relationship.ID; relatedLog.RelationshipInfo = child.Relationship.Alias; foreach (var childData in child.RelatedData) { relatedLog.RelatedActions.Add(ToDataLog(childData)); } foreach (var childData in child.RemovedDataForUpdate) { relatedLog.RelatedActions.Add(ToRemovedDataLog(childData)); } log.RelatedLog.Add(relatedLog); } return(log); }