private void ShowLetters()
        {
            singleDataItem = null;
            var selectedDatas = DataTreeArea.GetSelectedDataItems();

            if (selectedDatas.Count == 0 || selectedDatas.Count > 1)
            {
                LetterView.EnableAdd = false;
            }
            else
            {
                var permissions = AgentUICoreMediator.GetAgentUICoreMediator.tableDrivedEntityManagerService.GetEntityAssignedPermissions(AgentUICoreMediator.GetAgentUICoreMediator.GetRequester(), selectedDatas.First().TargetEntityID, false);
                if (permissions.GrantedActions.Any(x => x == SecurityAction.LetterEdit))
                {
                    singleDataItem       = selectedDatas.First();
                    LetterView.EnableAdd = true;
                }
                else
                {
                    LetterView.EnableAdd = false;
                }
            }
            Letters = AgentUICoreMediator.GetAgentUICoreMediator.LetterManager.GetLetters(AgentUICoreMediator.GetAgentUICoreMediator.GetRequester(), GetDataItemIds());
            LetterView.ShowList(Letters);
        }
        //public List<DP_DataView> SearchDataForViewFromExternalSource(int entityID, List<DP_DataRepository> searchViewData, I_EditEntityArea editEntityArea)
        //{
        //    //اوکی نشده
        //    DP_SearchRepository SearchDataItem = new DP_SearchRepository(entityID);
        //    List<DP_DataView> result = new List<DP_DataView>();
        //    foreach (var item in searchViewData)
        //    {
        //        foreach (var col in item.KeyProperties)
        //        {
        //            SearchDataItem.Phrases.Add(new SearchProperty() { ColumnID = col.ColumnID, Value = col.Value });
        //        }

        //        var requester = AgentUICoreMediator.GetAgentUICoreMediator.GetRequester();
        //        var requestSearchView = new DR_SearchViewRequest(requester, SearchDataItem);
        //        var foundItem = AgentUICoreMediator.GetAgentUICoreMediator.SendSearchViewRequest(requestSearchView).ResultDataItems;
        //        if (foundItem.Any())
        //            result.Add(foundItem[0]);
        //        else
        //            AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowInfo("عدم دسترسی به داده", item.ProperyValues, Temp.InfoColor.Red);

        //    }
        //    return result;
        //}
        public DP_DataRepository GetFullDataFromDataViewSearch(int entityID, DP_DataView searchViewData, I_EditEntityArea editEntityArea)
        {
            //سکوریتی داده اعمال میشود
            DP_SearchRepository SearchDataItem = new DP_SearchRepository(entityID);

            foreach (var col in searchViewData.Properties.Where(x => x.IsKey))
            {
                SearchDataItem.Phrases.Add(new SearchProperty()
                {
                    ColumnID = col.ColumnID, Value = col.Value
                });
            }
            var requester = AgentUICoreMediator.GetAgentUICoreMediator.GetRequester();
            // var requestSearchEdit = new DR_SearchEditRequest(requester, SearchDataItem, editEntityArea.AreaInitializer.SecurityReadOnly, false);
            var requestSearchEdit = new DR_SearchEditRequest(requester, SearchDataItem);
            var res = AgentUICoreMediator.GetAgentUICoreMediator.requestRegistration.SendSearchEditRequest(requestSearchEdit).ResultDataItems;

            if (res.Any())
            {
                var froundItem = res[0];
                froundItem.DataView = searchViewData;
                return(froundItem);
            }

            else
            {
                return(null);
            }
        }
Exemple #3
0
        private void GenerateFieleds(Document doc, DP_DataView dataItem, LetterTemplateDTO letterTemplete, DR_Requester requester)
        {
            var fileds = GetFields(doc);

            //ParagraphFormat paragraphFormat = null;
            GenerateValues(doc, dataItem, letterTemplete, fileds.Item1, fileds.Item2, requester, "main", null);
            //PrepareDocForGenerate(null, fileds.Item1, fileds.Item2);
            //GenerateValues(null, fileds.Item1, fileds.Item2, dataItem, requester);

            //foreach (var relationshipField in fileds.Item2)
            //{
            //    var bizField = letterTemplete.RelationshipFields.FirstOrDefault(x => x.FieldName == relationshipField.FieldName);
            //    if (bizField != null)
            //    {
            //        if (bizField.RelationshipID != 0)
            //        {
            //            var searchRepository = relationshipDataManager.GetSearchDataItemByRelationship(dataItem, bizField.RelationshipID, requester);
            //            var relatedDataItems = searchProcessor.GetDataItemsByListOFSearchProperties(requester, searchRepository);
            //            if (relatedDataItems.Any())
            //            {
            //                foreach (var item in relatedDataItems)
            //                {
            //                    CopyRange(relationshipField, item);
            //                }
            //            }
            //            RemoveRange(relationshipField);
            //        }
            //    }
            //}
        }
Exemple #4
0
        private void ShowTypePropertyData(DP_DataView dataRepository)
        {
            //foreach (var viewItem in dataRepository.DataViewItems)
            //{
            foreach (var property in dataRepository.Properties)
            {
                var columnControl = ViewColumnControls.FirstOrDefault(x => x.RelativeColumnName == property.RelativeName);
                if (columnControl != null)
                {
                    columnControl.ControlManager.SetValue(dataRepository, property.Value);
                }
            }
            //}
            //else if (property.Name.Contains("#"))
            //{
            //    foreach (var typePropertyControl in ViewColumnControls.Where(x => x.RelationshipColumnName == property.Name))
            //        if (typePropertyControl != null)
            //        {
            //            //if (!typePropertyControl.ControlPackage.IsDataDependentControl)

            //            ShowTypePropertyControlValue(dataRepository, typePropertyControl, property.Value);

            //        }
            //}
        }
        private void CommandManager_Clicked(object sender, EventArgs e)
        {
            DP_DataRepository dataInstance = null;

            if (EditArea.AreaInitializer.DataMode != DataMode.Multiple)
            {
                dataInstance = EditArea.GetDataList().FirstOrDefault();
            }
            else
            {
                dataInstance = (EditArea as EditEntityAreaMultipleData).GetSelectedData().FirstOrDefault();
            }
            DP_DataView dataView = null;

            if (dataInstance != null)
            {
                if (dataInstance.DataView != null && !dataInstance.IsNewItem)
                {
                    dataView = dataInstance.DataView;
                    //AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowInfo("عملیات آرشیو تنها بروی داده های ثبت شده امکان پذیر است");
                    //return;
                }
            }
            AgentUICoreMediator.GetAgentUICoreMediator.ShowArchiveArea(EditArea.AreaInitializer.EntityID, EditArea.SimpleEntity.Alias, true, dataView);
        }
 private void ShowDataViewItemInfo(DP_DataView found)
 {
     View.ClearDataViewItemInfo();
     foreach (var prop in found.Properties)
     {
         View.AddDataViewItemInfo(prop.Column.Alias, prop.Value);
     }
     View.ShowDataViewItemInfo();
 }
        public void Select(DP_DataView dataInstance)
        {
            DataTreeItem item = GetDataTreeItem(dataInstance);

            if (item != null)
            {
                item.ViewItem.IsSelected = true;
            }
        }
        private void AddNewLetter(DP_DataView dataItem)
        {
            var initializer = new LetterAreaInitializer();

            initializer.DataInstance = dataItem;
            var editLetterArea = new EditLetterArea(initializer);

            editLetterArea.LetterUpdated += EditLetterArea_LetterUpdated;
            AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GetDialogWindow().ShowDialog(editLetterArea.View, "نامه", Enum_WindowSize.Big);
        }
Exemple #9
0
        public void ShowDataFromExternalSource(DP_DataView dataRepository = null)
        {
            bool dataView = (AreaInitializer.IntracionMode == IntracionMode.CreateDirect ||
                             AreaInitializer.IntracionMode == IntracionMode.CreateSelectDirect);

            if (dataRepository != null)
            {
                if (!dataRepository.KeyProperties.Any())
                {
                    throw new Exception("asdad");
                }
                if (dataView)
                {
                    var result = AreaInitializer.EditAreaDataManager.SearchDataForEditFromExternalSource(AreaInitializer.EntityID, dataRepository, this);
                    if (result != null)
                    {
                        var addResult = AddData(result, true);
                        if (!addResult)
                        {
                            AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowInfo("عدم دسترسی به داده و یا داده های وابسته", dataRepository.ViewInfo, Temp.InfoColor.Red);
                        }
                    }
                    else
                    {
                        AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowInfo("عدم دسترسی به داده", dataRepository.ViewInfo, Temp.InfoColor.Red);
                    }
                }
                else
                {
                    var viewData = AreaInitializer.EditAreaDataManager.SearchDataForViewFromExternalSource(AreaInitializer.EntityID, dataRepository, this);
                    if (viewData != null)
                    {
                        var result    = AreaInitializer.EditAreaDataManager.ConvertDP_DataViewToDP_DataRepository(viewData, this);
                        var addResult = AddData(result, false);
                        if (!addResult)
                        {
                            AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowInfo("عدم دسترسی به داده و یا داده های وابسته", dataRepository.ViewInfo, Temp.InfoColor.Red);
                        }
                    }
                    else
                    {
                        AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowInfo("عدم دسترسی به داده", dataRepository.ViewInfo, Temp.InfoColor.Red);
                    }
                }
            }
            else
            {
                if (AreaInitializer.IntracionMode == IntracionMode.CreateDirect ||
                    AreaInitializer.IntracionMode == IntracionMode.CreateSelectDirect)
                {
                    CreateDefaultData();
                }
            }
        }
 private void ShowTypePropertyData(DP_DataView dataRepository)
 {
     foreach (var property in dataRepository.Properties)
     {
         var columnControl = ViewColumnControls.FirstOrDefault(x => x.RelativeColumnName == property.RelativeName);
         if (columnControl != null)
         {
             columnControl.ControlManager.SetValue(dataRepository, property.Value);
         }
     }
 }
 private DataTreeItem GetDataTreeItem(DP_DataView dataInstance)
 {
     foreach (var item in DataTreeItems)
     {
         if (item.ItemType == DataTreeItemType.DataItem && item.DataItem == dataInstance)
         {
             return(item);
         }
     }
     //درست شود بصورت درختی جستجو کند
     return(null);
 }
        //private void ViewMenu_Cliecked(object sender, EventArgs e, DynamicContextMenu menu)
        //{
        //    menu.OnClicked();
        //}
        private DataTreeItem ToRelationItemNode(DataTreeItem parentItem, DP_DataView relatedItem, EntityRelationshipTailDTO relation, bool selectable, bool tempChild)
        {
            DataTreeItem item = new DataTreeItem();

            item.DataItem = relatedItem;
            item.Relation = relation;
            item.ItemType = DataTreeItemType.Relation;
            item.ViewItem = parentItem.ViewItem.AddNode(relation.EntityPath, selectable, tempChild);
            //item.ViewItem.ContextMenuLoaded += (sender, e) => ViewItem_ContextMenuLoaded(sender, e, item);
            DataTreeItems.Add(item);
            return(item);
        }
        public DP_DataRepository ConvertDP_DataViewToDP_DataRepository(DP_DataView item, I_EditEntityArea editEntityArea)
        {
            DP_DataRepository dataRepository = new DP_DataRepository(item.TargetEntityID, item.TargetEntityAlias);

            if (dataRepository.EntityListView == null)
            {
                dataRepository.EntityListView = editEntityArea.DefaultEntityListViewDTO;
            }
            dataRepository.DataView = item;
            foreach (var key in item.Properties.Where(x => x.IsKey))
            {
                dataRepository.AddProperty(editEntityArea.EntityWithSimpleColumns.Columns.First(x => x.ID == key.ColumnID), key.Value);
            }
            return(dataRepository);
        }
Exemple #14
0
 private bool ChildItemExistInTree(DP_DataRepository treeItem, DP_DataView childItem)
 {
     //برای برابری یه چیز کاملتو عمومی نوشته شود
     if (treeItem.TargetEntityID == childItem.TargetEntityID && treeItem.KeyProperties.All(x => childItem.Properties.Any(y => y.IsKey && x.ColumnID == y.ColumnID && x.Value == y.Value)))
     {
         return(true);
     }
     foreach (var childInfo in treeItem.ChildRelationshipInfos.Where(x => x.RelatedData.Any(y => y.TargetEntityID == childItem.TargetEntityID)))
     {
         foreach (var item in childInfo.RelatedData)
         {
             return(ChildItemExistInTree(item, childItem));
         }
     }
     return(false);
 }
        public DP_DataView ToDataViewDTO(DR_Requester requester, MyDataItem dbDataItem, bool lastInfo)
        {
            DP_DataView result = null;
            bool        error  = false;

            if (lastInfo)
            {
                DP_SearchRepository searchDataItem = new DP_SearchRepository(dbDataItem.TableDrivedEntityID);
                foreach (var property in dbDataItem.MyDataItemKeyColumns)
                {
                    searchDataItem.Phrases.Add(new SearchProperty()
                    {
                        ColumnID = property.ColumnID, Value = property.Value
                    });
                }
                DR_SearchViewRequest request = new DR_SearchViewRequest(requester, searchDataItem);
                var searchResult             = searchRequestManager.Process(request);
                if (searchResult.Result == Enum_DR_ResultType.SeccessfullyDone)
                {
                    result = searchResult.ResultDataItems.FirstOrDefault();
                }
                else if (searchResult.Result == Enum_DR_ResultType.ExceptionThrown)
                {
                    error = true;
                }
            }

            if (!lastInfo || error)
            {
                result            = new DP_DataView(dbDataItem.TableDrivedEntityID, "");
                result.DataItemID = dbDataItem.ID;
                //result.TargetEntityID = dbDataItem.TableDrivedEntityID;
                //   List<EntityInstanceProperty> listProperties = new List<EntityInstanceProperty>();
                BizColumn bizColumn = new BizColumn();

                foreach (var property in dbDataItem.MyDataItemKeyColumns)
                {
                    result.Properties.Add(new EntityInstanceProperty(bizColumn.GetColumn(property.ColumnID, true))
                    {
                        Value = property.Value
                    });
                }
            }
            return(result);
            //result.SetProperties(listProperties);
        }
        private DataTreeItem ToDataItemNode(DataTreeItem parentItem, DP_DataView relatedItem, bool selectable, bool tempChild)
        {
            DataTreeItem item = new DataTreeItem();

            item.DataItem = relatedItem;
            item.ItemType = DataTreeItemType.DataItem;
            if (parentItem == null)
            {
                item.ViewItem = View.AddRootNode(item.DataItem.ViewInfo, selectable, tempChild);
            }
            else
            {
                item.ViewItem = parentItem.ViewItem.AddNode(item.DataItem.ViewInfo, selectable, tempChild);
            }

            DataTreeItems.Add(item);
            return(item);
        }
Exemple #17
0
        DP_DataView CreateDataView(DR_Requester requester, DP_DataView sourceDataItem, RelationshipDTO relationsip)
        {
            var entity   = bizTableDrivedEntity.GetTableDrivedEntity(requester, relationsip.EntityID2, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithoutRelationships);
            var dataView = new DP_DataView(relationsip.EntityID2, relationsip.Entity2);

            foreach (var relCol in relationsip.RelationshipColumns)
            {
                var property = sourceDataItem.GetProperty(relCol.FirstSideColumnID);
                if (property == null)
                {
                    return(null);
                }
                dataView.Properties.Add(new EntityInstanceProperty(relCol.SecondSideColumn)
                {
                    Value = sourceDataItem.GetProperty(relCol.FirstSideColumnID).Value
                });
            }
            return(dataView);
        }
        //private Tuple<List<DataLinkItem>, List<DataLinkRelation>> RemoveRepeatedItems(List<DataLinkItem> items, List<DataLinkRelation> relations)
        //{
        //    List<DataLinkItem> allItems = new List<DataLinkItem>();
        //    foreach (var item in items.Where(x => x.IsFixed == true))
        //    {
        //        allItems.Add(item);
        //    }

        //    List<DataLinkItem> bodyItems = new List<DataLinkItem>();
        //    foreach (var item in items.Where(x => x.IsFixed == false))
        //    {
        //        bodyItems.Add(item);
        //    }
        //    List<Tuple<DataLinkItem, List<DataLinkItem>>> groupItems = new List<Tuple<DataLinkItem, List<DataLinkItem>>>();
        //    foreach (var item in bodyItems)
        //    {
        //        if (!groupItems.Any(x => x.Item2.Contains(item)))
        //        {

        //            var sameOtherItems = bodyItems.Where(x => x != item && AgentHelper.DataItemsAreEqual(item.DataItem, x.DataItem));
        //            List<DataLinkItem> removes = new List<DataLinkItem>();
        //            foreach (var otheritem in sameOtherItems)
        //            {
        //                removes.Add(otheritem);
        //            }
        //            if (removes.Any())
        //                groupItems.Add(new Tuple<DataLinkItem, List<DataLinkItem>>(item, removes));
        //        }
        //    }
        //    foreach (var item in groupItems)
        //    {
        //        allItems.Add(item.Item1);
        //        foreach (var removes in item.Item2)
        //        {
        //            foreach (var relation in relations)
        //            {
        //                if (relation.Item1 == item.Item1)
        //                    relation.Item1 = item.Item1;
        //                if (relation.Item2 == item.Item1)
        //                    relation.Item2 = item.Item1;
        //            }
        //        }
        //    }
        //    return new Tuple<List<DataLinkItem>, List<DataLinkRelation>>(allItems, relations);
        //}
        //private void CheckDependentItems(List<DataLinkItem> tail, DataLinkItem parentItem)
        //{
        //    //   return;
        //    foreach (var item in tail.Where(x => x.ParentDataLinkItem == parentItem))
        //    {
        //        View.AddLink(parentItem.View, item.View);
        //        CheckDependentItems(tail, item);
        //    }
        //}

        private I_DataViewItem GetDataViewItem(DP_DataView item, int dataMenuID)
        {
            I_DataViewItem dataViewItem = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GetDataViewItem();

            //     درست شود
            dataViewItem.DataView     = item;
            dataViewItem.InfoClicked += (sender, e) => DataViewItem_InfoClicked(sender, e, dataMenuID);
            //dataViewItem.Selected += DataViewItem_Selected;
            //foreach (var column in item.Properties.Take(3))
            //{
            //    dataViewItem.AddTitleRow(column.Name, column.Value);
            //}
            if (!string.IsNullOrEmpty(item.TargetEntityAlias))
            {
                dataViewItem.Title = item.TargetEntityAlias;
            }
            dataViewItem.Body = item.ViewInfo;
            return(dataViewItem);
        }
        public void SelectData(DP_DataView dataInstance)
        {
            //DP_SearchRepository searchItems = new DP_SearchRepository(dataInstance.TargetEntityID);
            //foreach (var item in dataInstance.KeyProperties)
            //{
            //    searchItems.Phrases.Add(new SearchProperty() { ColumnID = item.ColumnID, Value = item.Value });
            //}

            //var requester = AgentUICoreMediator.GetAgentUICoreMediator.GetRequester();
            //DR_SearchViewRequest request = new DR_SearchViewRequest(requester, searchItems);
            //var childViewData = AgentUICoreMediator.GetAgentUICoreMediator.SendSearchViewRequest(request);
            //if (childViewData.Result == Enum_DR_ResultType.SeccessfullyDone)
            //{
            //    if (childViewData.ResultDataItems.Count == 1)
            //    {

            SelectDataArea.ClearData(false);
            SelectDataArea.ShowDataFromExternalSource(dataInstance);
            //    }
            //}
        }
        private void CommandManager_Clicked(object sender, EventArgs e)
        {
            if (EditArea.SearchViewEntityArea != null)
            {
                var searchDP = EditArea.SearchViewEntityArea.SearchEntityArea.LastSearch;
                DP_DataRepository dataInstance = null;
                if (EditArea.AreaInitializer.DataMode != DataMode.Multiple)
                {
                    dataInstance = EditArea.GetDataList().FirstOrDefault();
                }
                else
                {
                    dataInstance = (EditArea as EditEntityAreaMultipleData).GetSelectedData().FirstOrDefault();
                }
                DP_DataView dataView = null;
                if (dataInstance != null)
                {
                    if (dataInstance.DataView != null && !dataInstance.IsNewItem)
                    {
                        dataView = dataInstance.DataView;
                    }
                }
                //if (searchDP != null)
                //{
                //if (packageArea.GraphArea == null)
                //{



                //}
                //else
                //{

                //}
                AgentUICoreMediator.GetAgentUICoreMediator.ShowGraphArea(EditArea.AreaInitializer.EntityID, 0, false, "لینک داده ", dataView);
                //}
            }
        }
 public DataMenuResult GetDataMenu(DR_Requester requester, DP_DataView dataItem, int dataMenuSettingID)
 {
     return(bizDataMenuSetting.GetDataMenu(requester, dataItem, dataMenuSettingID));
 }
 private void AddMenu_Clicked(object sender, EventArgs e, DP_DataView dataItem)
 {
     AddNewLetter(dataItem);
 }
Exemple #23
0
        private void View_WorkflowRequestCreate(object sender, EventArgs e)
        {
            CreateRequestDTO requestMessage = new CreateRequestDTO();

            if (string.IsNullOrEmpty(View.Title))
            {
                AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowMessage("عنوان مشخص نشده است");
                return;
            }
            if (SearchEditEntityArea != null)
            {
                DP_DataView dataItem = SearchEditEntityArea.GetDataList().FirstOrDefault()?.DataView;
                if (dataItem == null)
                {
                    AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowMessage("موجودیتی انتخاب نشده است");
                    return;
                }
                else
                {
                    requestMessage.DatItem = dataItem;
                }
            }
            if (!ValidateTargetSelection())
            {
                return;
            }
            string confirmMessage = "در مرحله بعد اقدامات توسط این اشخاص امکانپذیر است";

            foreach (var item in ViewTargetSelection.OutgoingTransitoinActions)
            {
                confirmMessage += (Environment.NewLine) + "اقدام" + " : " + item.Title;
                foreach (var post in item.OrganizationPosts.Where(x => x.Selected))
                {
                    confirmMessage += (Environment.NewLine) + "    " + post.OrganizationPost.Name;
                }
            }

            if (AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowConfirm("تایید مرحله بعد", confirmMessage, UserPromptMode.YesNo) == Temp.ConfirmResul.No)
            {
                return;
            }
            requestMessage.OutgoingTransitoinActions = ViewTargetSelection.OutgoingTransitoinActions;
            requestMessage.Title = View.Title;
            //requestMessage.Desc = View.Description;
            requestMessage.ProcessID      = View.SelectedProcess.ID;
            requestMessage.CurrentStateID = View.SelectedStateID;
            //requestMessage.RequestFiles = View.RequestFiles;
            requestMessage.RequestNotes = View.RequestNotes;

            //if (view.ProcessAdmins != null)
            //    e.Request.AdminPostIDs = view.ProcessAdmins.Select(x => x.ID).ToList();
            //if (view.ProcessStackholders != null)
            //    e.Request.StackHolderPostIDs = view.ProcessStackholders.Select(x => x.ID).ToList();

            var requester = AgentUICoreMediator.GetAgentUICoreMediator.GetRequester();

            var result = AgentUICoreMediator.GetAgentUICoreMediator.workflowService.CreateWorkflowRequest(requestMessage, requester);

            if (result.Result == Enum_DR_ResultType.SeccessfullyDone)
            {
                AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowMessage("جریان کار ایجاد شد");
                if (SearchEditEntityArea != null)
                {
                    SearchEditEntityArea.ClearData(false);
                }
                View.Title = "";
            }
            else
            {
                AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowMessage("جریان کار ایجاد نشد" + Environment.NewLine + result.Message);
            }
        }
Exemple #24
0
        private void GenerateValues(Document doc, DP_DataView dataviewItem, LetterTemplateDTO letterTemplete, List <LetterTemplatePlainFieldDTO> plainFields, List <LetterTemplateRelationshipFieldDTO> relationshipFields, DR_Requester requester, string parentTail, ParagraphFormat paragraphFormat)
        {
            //int start;
            //int end;
            //if (parentTail == "")
            //{
            //    start = 0;
            //    end = 1000000;
            //}
            //else
            //{
            //    start = parentRange.Item1;
            //    end = parentRange.Item2;
            //}
            foreach (var plainField in plainFields)
            {
                if (plainField.tmpParentTail == parentTail)
                {
                    var bizField = letterTemplete.PlainFields.FirstOrDefault(x => x.FieldName.ToLower() == plainField.FieldName.ToLower());
                    if (bizField != null)
                    {
                        if (bizField.EntityListViewColumnsID != 0)
                        {
                            //درست شود
                            var property = dataviewItem.Properties.FirstOrDefault(x => x.RelativeName == bizField.EntityListViewColumns.RelativeColumnName);
                            if (property != null)
                            {
                                (plainField.LetterField as Field).Result.Text = property.Value == null ? "" : property.Value.ToString();
                            }
                        }
                        else if (bizField.FormulaID != 0)
                        {
                            DP_DataRepository dataRepository = new DP_DataRepository(dataviewItem.TargetEntityID, dataviewItem.TargetEntityAlias);
                            dataRepository.DataView = dataviewItem;
                            foreach (var key in dataviewItem.Properties.Where(x => x.IsKey))
                            {
                                dataRepository.AddProperty(new ColumnDTO()
                                {
                                    ID = key.ColumnID
                                }, key.Value);
                            }
                            var parameterValue = formulaHandler.CalculateFormula(bizField.FormulaID, dataRepository, requester);
                            if (parameterValue.Result != null)
                            {
                                (plainField.LetterField as Field).Result.Text = parameterValue.Result.ToString();
                            }
                        }
                    }
                }
            }

            foreach (var relationshipField in relationshipFields)
            {
                var bizField = letterTemplete.RelationshipFields.FirstOrDefault(x => x.FieldName.ToLower() == relationshipField.FieldName.ToLower());
                if (bizField != null)
                {
                    //List<EntityInstanceProperty> columnValues = new List<EntityInstanceProperty>();
                    //foreach (var property in dataviewItem.KeyProperties)
                    //    columnValues.Add(property);
                    //var searchRepository = relationshipDataManager.GetSearchDataItemByRelationship(dataItem, bizField.RelationshipID, requester);
                    //var relatedDataItems = searchProcessor.GetDataItemsByListOFSearchProperties(requester, searchRepository);
                    List <DP_DataView> relatedDataItems = null;
                    //سکوریتی داده اعمال میشود
                    RelationshipTailDataManager relationshipTailDataManager = new RelationshipTailDataManager();
                    var searchDataItem = relationshipTailDataManager.GetTargetSearchItemFromRelationshipTail(dataviewItem, bizField.RelationshipTail);

                    DR_SearchViewRequest request = new DR_SearchViewRequest(requester, searchDataItem);
                    request.EntityViewID = bizField.PartialLetterTemplate.EntityListViewID;
                    var searchResult = searchProcessor.Process(request);
                    if (searchResult.Result == Enum_DR_ResultType.SeccessfullyDone)
                    {
                        relatedDataItems = searchResult.ResultDataItems;
                    }
                    else if (searchResult.Result == Enum_DR_ResultType.ExceptionThrown)
                    {
                        throw (new Exception(searchResult.Message));
                    }

                    //DR_SearchByRelationshipTailRequest request = new DR_SearchByRelationshipTailRequest(requester);
                    //request.FirstRelationshipFirstSideKeyColumns = columnValues;
                    //request.RelationshipTail = bizField.RelationshipTail;
                    //var process = searchProcessor.Process(request);
                    //if (process.Result == Enum_DR_ResultType.SeccessfullyDone)
                    //    relatedDataItems = process.ResultDataItems;
                    //else if (process.Result == Enum_DR_ResultType.ExceptionThrown)
                    //    throw (new Exception(process.Message));
                    if (relatedDataItems.Any())
                    {
                        int itemIndex = 0;
                        foreach (var item in relatedDataItems)
                        {
                            itemIndex++;

                            var copyItem = Copy(doc, relationshipField.StartLetterField as Field, relationshipField.EndLetterField as Field, bizField.IsRow, ref paragraphFormat);;
                            if (copyItem != null)
                            {
                                var tail   = (parentTail == "" ? "" : parentTail + ",") + relationshipField.FieldName;
                                var fields = GetFields(doc, copyItem, tail);
                                GenerateValues(doc, item, bizField.PartialLetterTemplate, fields.Item1, fields.Item2, requester, tail, paragraphFormat);
                            }
                        }
                    }
                    ClearItem(doc, relationshipField.StartLetterField as Field, relationshipField.EndLetterField as Field, bizField.IsRow);
                }
            }
        }
Exemple #25
0
        public byte[] GenerateLetter(int letterTemplateID, List <EntityInstanceProperty> keyProperties, DR_Requester requester)
        {
            var letterTemplete = bizLetterTemplate.GetMainLetterTepmplate(requester, letterTemplateID);
            DP_SearchRepository searchDataItem = new DP_SearchRepository(letterTemplete.TableDrivedEntityID);

            foreach (var property in keyProperties)
            {
                searchDataItem.Phrases.Add(new SearchProperty()
                {
                    ColumnID = property.ColumnID, Value = property.Value
                });
            }

            DP_DataView dataviewItem = null;
            //سکوریتی داده اعمال میشود
            //////DR_SearchFullDataRequest request = new DR_SearchFullDataRequest(requester,searchDataItem);
            //////var searchResult = searchProcessor.Process(request);
            //////if (searchResult.Result == Enum_DR_ResultType.SeccessfullyDone)
            //////    dataItem = searchResult.ResultDataItems.FirstOrDefault();
            //////else if (searchResult.Result == Enum_DR_ResultType.ExceptionThrown)
            //////    throw (new Exception(searchResult.Message));

            DR_SearchViewRequest request = new DR_SearchViewRequest(requester, searchDataItem);

            request.EntityViewID = letterTemplete.EntityListViewID;
            var searchResult = searchProcessor.Process(request);

            if (searchResult.Result == Enum_DR_ResultType.SeccessfullyDone)
            {
                dataviewItem = searchResult.ResultDataItems.FirstOrDefault();
            }
            else if (searchResult.Result == Enum_DR_ResultType.ExceptionThrown)
            {
                throw (new Exception(searchResult.Message));
            }


            //var dataItem = searchProcessor.GetDataItemsByListOFSearchProperties(requester, searchDataItem).FirstOrDefault();


            string path     = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var    fileName = Guid.NewGuid() + "." + letterTemplete.FileExtension;
            string filePath = path + @"\\" + fileName;

            System.IO.File.WriteAllBytes(filePath, letterTemplete.Content);

            Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
            Microsoft.Office.Interop.Word.Document    doc  = new Microsoft.Office.Interop.Word.Document();

            doc = word.Documents.Open(filePath);
            doc.Activate();
            word.Visible = true;
            //foreach (Microsoft.Office.Interop.Word.ContentControl cc in doc.ContentControls)
            //{
            //    //cc.
            //    //MessageBox.Show(cc.Tag);
            //    //MessageBox.Show(cc.Title);
            //}
            //List<Microsoft.Office.Interop.Word.Field> letterFields = new List<Microsoft.Office.Interop.Word.Field>();
            //foreach (Microsoft.Office.Interop.Word.Field field in doc.Fields)
            //    letterFields.Add(field);

            GenerateFieleds(doc, dataviewItem, letterTemplete, requester);


            //   doc.SaveAs2(@"N:\mehler\Ausgefuellt.docx");
            doc.Save();
            doc.Close();
            word.Quit();

            return(System.IO.File.ReadAllBytes(filePath));
        }
Exemple #26
0
        private DataMenu AddMenu(List <DataMenu> result, string title, string tooltip, DataMenuType type, DP_DataView dataItem)
        {
            var dataMenu = new DataMenu();

            dataMenu.Title    = title;
            dataMenu.Tooltip  = tooltip;
            dataMenu.Type     = type;
            dataMenu.DataItem = dataItem;
            result.Add(dataMenu);
            return(dataMenu);
        }
        private void View_DataLinkConfirmed(object sender, EventArgs e)
        {
            if (SelectedDataLink == null ||
                FirstSideEditEntityArea.AreaInitializer.Datas.Count == 0 ||
                SecondSideEditEntityArea.AreaInitializer.Datas.Count == 0)
            {
                return;
            }
            FirstData = FirstSideEditEntityArea.AreaInitializer.Datas[0].DataView;
            OtherData = SecondSideEditEntityArea.AreaInitializer.Datas[0].DataView;
            List <DataLinkItem> dataLinkItems = new List <DataLinkItem>();

            var fItems = new List <DataLinkItemGroup>();

            //البته از هر دو طرف میشه به طرف دیگر رسید
            //بهتره همین طور باشه چون برای لینک سرورها کافیه سرورهای طرف اول به طرف دوم لینک داشته باشد
            //اینطوری مفهوم تر است
            foreach (var tail in SelectedDataLink.RelationshipsTails)
            {
                //     tail.EntityRelationshipTailDataMenu

                var searchDataTuple = AgentUICoreMediator.GetAgentUICoreMediator.RelationshipTailDataManager.GetTargetSearchItemFromRelationshipTail(OtherData, tail.RelationshipTail.ReverseRelationshipTail);
                foreach (var item in FirstData.KeyProperties)
                {
                    searchDataTuple.Phrases.Add(new SearchProperty()
                    {
                        ColumnID = item.ColumnID, Value = item.Value
                    });
                }
                var requester = AgentUICoreMediator.GetAgentUICoreMediator.GetRequester();
                //سکوریتی داده اعمال میشود
                var existsRequest = new DR_SearchExistsRequest(requester);
                existsRequest.EntityID        = SecondSideEditEntityArea.AreaInitializer.EntityID;
                existsRequest.SearchDataItems = searchDataTuple;
                var exists = AgentUICoreMediator.GetAgentUICoreMediator.requestRegistration.SendSearchExistsRequest(existsRequest);
                if (exists.Result == Enum_DR_ResultType.SeccessfullyDone)
                {
                    if (exists.ExistsResult)
                    {
                        //البته از هر دو طرف میشه به طرف دیگر رسید
                        //بهتره همین طور باشه چون برای لینک سرورها کافیه  در تیل سرورهای طرف اول هر رابطه به طرف دوم رابطه لینک داشته باشد
                        //اینطوری مفهوم تر است
                        fItems.Add(GetIncludedDataLinkItems(tail.RelationshipTail, SelectedDataLink, FirstData, OtherData, 0, tail.EntityRelationshipTailDataMenu));
                    }
                }
                else
                {
                    AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowInfo(exists.Message, exists.Details, MyUILibrary.Temp.InfoColor.Red);
                }
            }

            var tail1 = SelectedDataLink.RelationshipsTails.First();
            //    tail1.EntityRelationshipTailListView.FirstSideListViewID
            var firstSidelinkItem = new MyUILibrary.DataLinkArea.DataLinkItem();

            firstSidelinkItem.DataItem    = FirstData;
            firstSidelinkItem.View        = GetDataViewItem(firstSidelinkItem.DataItem, SelectedDataLink.FirstSideDataMenuID);
            firstSidelinkItem.View.IsRoot = true;
            firstSidelinkItem.IsFixed     = true;


            var secondSidelinkItem = new MyUILibrary.DataLinkArea.DataLinkItem();

            secondSidelinkItem.DataItem    = OtherData;
            secondSidelinkItem.View        = GetDataViewItem(secondSidelinkItem.DataItem, SelectedDataLink.SecondSideDataMenuID);
            secondSidelinkItem.View.IsRoot = true;
            secondSidelinkItem.IsFixed     = true;

            foreach (var pitem in fItems)
            {
                foreach (var item in pitem.Items)
                {
                    item.View = GetDataViewItem(item.DataItem, item.DataMenuID);
                }
            }

            //////List<DataLinkRelation> allRelations = new List<DataLinkRelation>();
            //////List<DataLinkItem> allItems = new List<DataLinkItem>();
            //////allItems.Add(firstSidelinkItem);
            //////allItems.Add(secondSidelinkItem);
            //////foreach (var pitem in fItems)
            //////{
            //////    allRelations.AddRange(pitem.Relations);
            //////    allItems.AddRange(pitem.Items);
            //////}
            //////foreach (var item in allItems.Where(x => x.IsFixed == false && x.Level == 0))
            //////{
            //////    allRelations.Add(new DataLinkRelation(firstSidelinkItem, item));
            //////}
            //////var maxLevel = allItems.Where(x => x.IsFixed == false).Max(x => x.Level);
            //////foreach (var item in allItems.Where(x => x.IsFixed == false && x.Level == maxLevel))
            //////{
            //////    allRelations.Add(new DataLinkRelation(item, secondSidelinkItem));
            //////}
            /////////
            //////var result = RemoveRepeatedItems(allItems, allRelations);
            //بعدا تست شود ظاهر فرم
            Diagram.ClearItems();
            //////foreach (var item in result.Item1)
            //////{
            //////    Diagram.AddView(item.View);
            //////}

            //////foreach (var item in result.Item2)
            //////{
            //////    if (!result.Item1.Any(x => x == item.Item1))
            //////    {

            //////    }
            //////    if (!result.Item1.Any(x => x == item.Item2))
            //////    {

            //////    }
            //////    Diagram.AddRelation(item.Item1.View, item.Item2.View);
            //////}


            Diagram.AddView(firstSidelinkItem.View);
            Diagram.AddView(secondSidelinkItem.View);
            foreach (var pitem in fItems)
            {
                foreach (var item in pitem.Items)
                {
                    Diagram.AddView(item.View);
                }
                foreach (var item in pitem.Relations)
                {
                    Diagram.AddRelation(item.Item1.View, item.Item2.View);
                }

                foreach (var item in pitem.Items.Where(x => x.Level == 0))
                {
                    Diagram.AddRelation(firstSidelinkItem.View, item.View);
                }
                var maxLevel = pitem.Items.Max(x => x.Level);
                foreach (var item in pitem.Items.Where(x => x.Level == maxLevel))
                {
                    Diagram.AddRelation(item.View, secondSidelinkItem.View);
                }
            }

            Diagram.RefreshDiagram();



            //foreach (var item in fItems.Where(x => x != secondSidelinkItem && !fItems.Any(y => y.ParentDataLinkItem == x)))
            //{
            //    //   View.AddLink(item.View, secondSidelinkItem.View);
            //}

            //var groupedList = fItems.GroupBy(x => x.RelationshipTail);
            //foreach (var tail in groupedList)
            //{
            //    //object panel = View.GenerateTailPanel();
            //    foreach (var item in tail.Where(x => x.Level == 0))
            //    {
            //        View.AddFirstLevelDataLinkItem(item.View);
            //        CheckDependentItems(tail, item);
            //    }
            //}
            //List<DataLinkItemViewGroups> viewGroups = new List<DataLinkItemViewGroups>();
            ////var listViewGroups = fItems.Select(x => x.Items.Select(y => y.View).ToList()).ToList();
            ////var listViewRelations = fItems.Select(x => x.Relations.Select(y => new Tuple<I_DataViewItem, I_DataViewItem>(y.Item1.View, y.Item2.View)).ToList()).ToList();
            //foreach (var pitem in fItems)
            //{
            //    DataLinkItemViewGroups viewGroup = new DataLinkItemViewGroups();
            //    viewGroup.Views.AddRange(pitem.Items.Select(x => x.View).ToList());
            //    viewGroup.ViewRelations.AddRange(pitem.Relations.Select(x => new Tuple<I_DataViewItem, I_DataViewItem>(x.Item1.View, x.Item2.View)).ToList());
            //    viewGroups.Add(viewGroup);
            //}

            //   View.ShowDiagram(viewGroups, firstSidelinkItem.View, secondSidelinkItem.View);
        }
Exemple #28
0
        public DataMenuResult GetDataMenu(DR_Requester requester, DP_DataView dataItem, int dataMenuSettingID)
        {
            DataMenuResult  result      = new DataMenuResult();
            List <DataMenu> resultMenus = new List <DataMenu>();

            result.DataMenus = resultMenus;
            var entityID     = dataItem.TargetEntityID;
            var simpleEntity = bizTableDrivedEntity.GetSimpleEntity(requester, entityID);

            if (simpleEntity == null)
            {
                return(null);
            }
            DataMenuSettingDTO dataMenuSetting = null;

            if (dataMenuSettingID != 0)
            {
                dataMenuSetting = GetDataMenuSetting(requester, dataMenuSettingID, true);
            }
            else
            {
                dataMenuSetting = GetDefaultDataMenuSetting(requester, entityID, true);
            }

            if (dataMenuSetting != null)
            {
                result.DataMenuSettingName = dataMenuSetting.Name;
            }

            if (simpleEntity.IsView)
            {
                if (dataMenuSetting != null)
                {
                    if (dataMenuSetting.RelationshipID != 0 && dataMenuSetting.TargetDataMenuSettingID != 0)
                    {
                        var relationship = bizRelationship.GetRelationship(dataMenuSetting.RelationshipID);
                        var dataView     = CreateDataView(requester, dataItem, relationship);
                        return(GetDataMenu(requester, dataView, dataMenuSetting.TargetDataMenuSettingID));
                    }
                }
                //var fullEntity = bizTableDrivedEntity.GetTableDrivedEntity(requester, entityID, EntityColumnInfoType.WithSimpleColumns, EntityRelationshipInfoType.WithRelationships);
                //if (fullEntity.Relationships.Any())
                //{
                //    foreach (var relationsip in fullEntity.Relationships)
                //    {
                //        var dataView = CreateDataView(dataItem, relationsip);
                //        var menu = AddMenu(result, relationsip.Alias, "", DataMenuType.ViewRel);
                //        menu.ViewRelTargetDataItem = dataView;
                //    }
                //}
            }
            else
            {
                var dataEntryRootMenu = AddMenu(resultMenus, "نمایش/اصلاح داده", "", DataMenuType.Form, dataItem);
                //آرشیو داده
                // BizArchive bizArchive = new BizArchive();
                if (bizTableDrivedEntity.DataIsAccessable(requester, entityID, new List <SecurityAction>()
                {
                    SecurityAction.ArchiveView, SecurityAction.ArchiveEdit
                }))
                {
                    var archiveRootMenu = AddMenu(resultMenus, "آرشیو", "", DataMenuType.Archive, dataItem);
                }


                //نامه های داده
                //  BizLetterTemplate bizLetterTemplate = new BizLetterTemplate();
                if (bizTableDrivedEntity.DataIsAccessable(requester, entityID, new List <SecurityAction>()
                {
                    SecurityAction.LetterView, SecurityAction.LetterEdit
                }))
                {
                    var letterRootMenu = AddMenu(resultMenus, "نامه ها", "", DataMenuType.Letter, dataItem);
                }
                //جریان کارهای مرتبط
                if (bizProcess.EntityHasAnyProcess(entityID))
                {
                    var workflowRootMenu = AddMenu(resultMenus, "جریان کار", "", DataMenuType.Workflow, dataItem);
                }



                ////لینک های داده
                //BizDataLink bizDataLink = new MyModelManager.BizDataLink();
                //var datalinks = bizDataLink.GetDataLinkByEntitiyID(requester, entityID);
                //if (datalinks.Any())
                //{
                //    var dataViewRootMenu = AddMenu(resultMenus, "لینک داده", "", DataMenuType.Folder,null);
                //    foreach (var datalink in datalinks)
                //    {
                //        var datalinkMenu = AddMenu(dataViewRootMenu.SubMenus, datalink.ReportTitle, "", DataMenuType.DataLink, dataItem);
                //        datalinkMenu.Datalink = datalink;
                //    }
                //}

                //گزارشهای داده های مرتبط

                if (dataMenuSetting != null)
                {
                    if (dataMenuSetting.SearchableReportRelationships.Any())
                    {
                        var relationshipReportRootMenu = AddMenu(resultMenus, "گزارش داده های مرتبط", "", DataMenuType.Folder, null);
                        foreach (var group in dataMenuSetting.SearchableReportRelationships.GroupBy(x => x.Group1 ?? ""))
                        {
                            DataMenu parentGroupMenu = GetGroupMenu(relationshipReportRootMenu, group.Key);
                            foreach (var rel in group)
                            {
                                var menu = AddMenu(parentGroupMenu.SubMenus, rel.SearchableReportReport.ReportTitle, "", DataMenuType.RelationshipTailSearchableReport, dataItem);
                                menu.SearchableReportRelationshipTail = rel;
                            }
                        }
                    }
                    //نمای داده های مرتبط
                    if (dataMenuSetting.DataViewRelationships.Any())
                    {
                        var dataViewRootMenu = AddMenu(resultMenus, "نمایش داده های مرتبط", "", DataMenuType.Folder, null);
                        foreach (var group in dataMenuSetting.DataViewRelationships.GroupBy(x => x.Group1 ?? ""))
                        {
                            DataMenu parentGroupMenu = GetGroupMenu(dataViewRootMenu, group.Key);
                            foreach (var rel in group)
                            {
                                var dataViewRelMenu = AddMenu(parentGroupMenu.SubMenus, rel.RelationshipTail.TargetEntityAlias, rel.RelationshipTail.EntityPath, DataMenuType.RelationshipTailDataView, dataItem);
                                dataViewRelMenu.DataviewRelationshipTail = rel.RelationshipTail;
                                dataViewRelMenu.TargetDataMenuSettingID  = rel.TargetDataMenuSettingID;
                            }
                        }
                    }
                    if (dataMenuSetting.GridViewRelationships.Any())
                    {
                        var gridViewRootMenu = AddMenu(resultMenus, "گرید داده های مرتبط", "", DataMenuType.Folder, null);
                        foreach (var group in dataMenuSetting.GridViewRelationships.GroupBy(x => x.Group1 ?? ""))
                        {
                            DataMenu parentGroupMenu = GetGroupMenu(gridViewRootMenu, group.Key);
                            foreach (var rel in group)
                            {
                                var gridViewRelMenu = AddMenu(parentGroupMenu.SubMenus, rel.RelationshipTail.TargetEntityAlias, rel.RelationshipTail.EntityPath, DataMenuType.RelationshipTailDataGrid, dataItem);
                                gridViewRelMenu.GridviewRelationshipTail = rel.RelationshipTail;
                                gridViewRelMenu.TargetDataMenuSettingID  = rel.TargetDataMenuSettingID;
                            }
                        }
                    }
                    if (dataMenuSetting.DataItemReports.Any())
                    {
                        var gridViewRootMenu = AddMenu(resultMenus, "گزارشات مورد داده", "", DataMenuType.Folder, null);
                        foreach (var group in dataMenuSetting.DataItemReports.GroupBy(x => x.Group1 ?? ""))
                        {
                            DataMenu parentGroupMenu = GetGroupMenu(gridViewRootMenu, group.Key);
                            foreach (var rel in group)
                            {
                                var gridViewRelMenu = AddMenu(parentGroupMenu.SubMenus, rel.EntityDataItemReport.ReportTitle, "", DataMenuType.DataItemReport, dataItem);
                                gridViewRelMenu.DataItemReport = rel.EntityDataItemReport;
                            }
                        }
                    }
                }
            }
            return(result);
        }
        public DataLinkArea(DataLinkAreaInitializer initParam)
        {
            AreaInitializer = initParam;
            View            = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateViewOfDataLinkArea();
            Diagram         = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateViewOfDiagram();

            List <DiagramTypes> diagramTypes = new List <DiagramTypes>();

            diagramTypes.Add(new DiagramTypes()
            {
                Title = "سلسله مراتبی", DiagramType = EnumDiagramTypes.Sugiyama
            });
            diagramTypes.Add(new DiagramTypes()
            {
                Title = "درخت", DiagramType = EnumDiagramTypes.TreeUndefined
            });
            diagramTypes.Add(new DiagramTypes()
            {
                Title = "درخت افقی", DiagramType = EnumDiagramTypes.TreeHorizontal
            });
            diagramTypes.Add(new DiagramTypes()
            {
                Title = "درخت عمودی", DiagramType = EnumDiagramTypes.TreeVertical
            });
            diagramTypes.Add(new DiagramTypes()
            {
                Title = "درخت گردشی", DiagramType = EnumDiagramTypes.TreeRadial
            });
            diagramTypes.Add(new DiagramTypes()
            {
                Title = "درخت Tip Over", DiagramType = EnumDiagramTypes.TreeTipOver
            });
            diagramTypes.Add(new DiagramTypes()
            {
                Title = "درخت MindmapHorizontal", DiagramType = EnumDiagramTypes.MindmapHorizontal
            });
            diagramTypes.Add(new DiagramTypes()
            {
                Title = "درخت MindmapVertical", DiagramType = EnumDiagramTypes.MindmapVertical
            });
            Diagram.SetDiagramTypes(diagramTypes);
            View.AddDiagramView(Diagram);
            View.DataLinkConfirmed += View_DataLinkConfirmed;
            //     View.DataLinkChanged += View_DataLinkChanged;

            dataLinkSearchLookup = new MySearchLookup();
            dataLinkSearchLookup.DisplayMember        = "ReportTitle";
            dataLinkSearchLookup.SelectedValueMember  = "ID";
            dataLinkSearchLookup.SearchFilterChanged += dataLinkSearchLookup_SearchFilterChanged;
            dataLinkSearchLookup.SelectionChanged    += dataLinkSearchLookup_SelectionChanged;
            View.AddDataLinkSelector(dataLinkSearchLookup);
            FirstData = AreaInitializer.FirstDataItem;
            //OtherData = AreaInitializer.OtherDataItem;
            if (AreaInitializer.DataLinkID != 0)
            {
                dataLinkSearchLookup.SelectedValue   = AreaInitializer.DataLinkID;
                dataLinkSearchLookup.IsEnabledLookup = false;
            }
            else if (AreaInitializer.EntityID != 0)
            {
                DataLinks = AgentUICoreMediator.GetAgentUICoreMediator.DataLinkManager.GetDataLinks(AgentUICoreMediator.GetAgentUICoreMediator.GetRequester(), AreaInitializer.EntityID);
                dataLinkSearchLookup.ItemsSource     = DataLinks;
                dataLinkSearchLookup.SearchIsEnabled = false;
                if (DataLinks.Count == 1)
                {
                    dataLinkSearchLookup.SelectedItem = DataLinks[0];
                }
            }


            //ManageSecurity();
        }
        private DataLinkItemGroup GetIncludedDataLinkItems(EntityRelationshipTailDTO relationshipTail, DataLinkDTO selectedDataLink, DP_DataView relationshipFirstData, DP_DataView targetData, int level
                                                           , EntityRelationshipTailDataMenuDTO relationshipTailDataMenuDTO, DataLinkItem parentDataLinkItem = null, DataLinkItemGroup result = null, List <DataLinkItem> allItems = null)
        {
            if (result == null)
            {
                result = new DataLinkItemGroup();
            }
            if (relationshipTail != null && relationshipTail.ChildTail != null)
            {
                RelationshipTailDataManager relationshipTailDataManager = new RelationshipTailDataManager();

                //var firstData = new DP_DataRepository();
                //firstData.TargetEntityID = FirstData.TargetEntityID;
                //firstData.DataView = FirstData;
                //foreach (var key in FirstData.KeyProperties)
                //{
                //    firstData.AddProperty(new ColumnDTO() { ID = key.ColumnID }, key.Value);
                //}
                var searchDataTuple         = AgentUICoreMediator.GetAgentUICoreMediator.RelationshipDataManager.GetSecondSideSearchDataItemByRelationship(relationshipFirstData, relationshipTail.Relationship.ID);
                var searchPhraseToOtherData = relationshipTailDataManager.GetTargetSearchItemFromRelationshipTail(targetData, relationshipTail.ChildTail.ReverseRelationshipTail);
                searchDataTuple.Phrases.AddRange(searchPhraseToOtherData.Phrases);
                var requester = AgentUICoreMediator.GetAgentUICoreMediator.GetRequester();
                //سکوریتی داده اعمال میشود
                var searchRequest = new DR_SearchViewRequest(requester, searchDataTuple);
                //searchRequest.EntityID = parentTail.RelationshipTargetEntityID;
                var searchResult = AgentUICoreMediator.GetAgentUICoreMediator.requestRegistration.SendSearchViewRequest(searchRequest);

                if (parentDataLinkItem != null)
                {
                    parentDataLinkItem.TailPath = relationshipTail.RelationshipIDPath;
                    if (relationshipTailDataMenuDTO != null)
                    {
                        if (relationshipTailDataMenuDTO.Items.Any(x => x.Path == parentDataLinkItem.TailPath))
                        {
                            parentDataLinkItem.DataMenuID = relationshipTailDataMenuDTO.Items.First(x => x.Path == parentDataLinkItem.TailPath).DataMenuSettingID;
                        }
                    }
                }
                if (searchResult.Result == Enum_DR_ResultType.SeccessfullyDone)
                {
                    foreach (var item in searchResult.ResultDataItems)
                    {
                        DataLinkItem found = null;
                        if (allItems == null)
                        {
                            allItems = new List <DataLinkItem>();
                        }
                        else
                        {
                            if (selectedDataLink.NotJointEntities == true)
                            {
                                if (allItems.Any(x => AgentHelper.DataItemsAreEqual(item, x.DataItem)))
                                {
                                    var fItem = allItems.First(x => AgentHelper.DataItemsAreEqual(item, x.DataItem));
                                    found = fItem;
                                }
                            }
                        }
                        if (found == null)
                        {
                            found          = new DataLinkItem();
                            found.DataItem = item;
                            found.Level    = level;

                            result.Items.Add(found);
                            allItems.Add(found);
                        }
                        if (parentDataLinkItem != null)
                        {
                            result.Relations.Add(new DataLinkRelation(parentDataLinkItem, found));
                        }

                        GetIncludedDataLinkItems(relationshipTail.ChildTail, selectedDataLink, item, targetData, level + 1, relationshipTailDataMenuDTO, found, result);
                    }
                }
                else
                {
                    AgentUICoreMediator.GetAgentUICoreMediator.UIManager.ShowInfo(searchResult.Message, searchResult.Details, MyUILibrary.Temp.InfoColor.Red);
                }
            }
            return(result);
        }