private void EntitySearchLookup_SelectionChanged(object sender, SelectionChangedArg e)
 {
     if (e.SelectedItem != null)
     {
         var entity = e.SelectedItem as TableDrivedEntityDTO;
         EditEntityAreaInitializer editEntityAreaInitializer1 = new EditEntityAreaInitializer();
         editEntityAreaInitializer1.EntityID      = entity.ID;
         editEntityAreaInitializer1.IntracionMode = CommonDefinitions.UISettings.IntracionMode.Select;
         editEntityAreaInitializer1.DataMode      = CommonDefinitions.UISettings.DataMode.One;
         var FirstSideEditEntityAreaResult = EditEntityAreaConstructor.GetEditEntityArea(editEntityAreaInitializer1);
         if (FirstSideEditEntityAreaResult.Item1 != null && FirstSideEditEntityAreaResult.Item1 is I_EditEntityAreaOneData)
         {
             EditEntityArea = FirstSideEditEntityAreaResult.Item1 as I_EditEntityAreaOneData;
             EditEntityArea.SetAreaInitializer(editEntityAreaInitializer1);
             View.AddDataSelector(EditEntityArea.TemporaryDisplayView);
         }
     }
     else
     {
         View.RemoveDataSelector();
     }
 }
        private void ManageSimpleSearchView()
        {
            foreach (var searchcolumn in EntitySearch.EntitySearchAllColumns.OrderBy(x => x.OrderID))
            {
                if (searchcolumn.Column == null)
                {
                    if (searchcolumn.RelationshipTail != null)
                    {
                        var propertyControl = new RelationshipSearchColumnControl();
                        propertyControl.RelationshipTail   = searchcolumn.RelationshipTail;
                        propertyControl.EntitySearchColumn = searchcolumn;

                        EditEntityAreaInitializer editEntityAreaInitializer1 = new EditEntityAreaInitializer();
                        editEntityAreaInitializer1.EntityID      = searchcolumn.RelationshipTail.TargetEntityID;
                        editEntityAreaInitializer1.IntracionMode = CommonDefinitions.UISettings.IntracionMode.Select;

                        editEntityAreaInitializer1.DataMode = CommonDefinitions.UISettings.DataMode.One;
                        var FirstSideEditEntityAreaResult = EditEntityAreaConstructor.GetEditEntityArea(editEntityAreaInitializer1);
                        if (FirstSideEditEntityAreaResult.Item1 != null)
                        {
                            propertyControl.EditNdTypeArea = FirstSideEditEntityAreaResult.Item1 as I_EditEntityAreaOneData;
                            propertyControl.EditNdTypeArea.SetAreaInitializer(editEntityAreaInitializer1);
                            //         propertyControl.ControlPackage = new UIControlPackageForRelationshipColumn();
                            propertyControl.ControlManager = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateRelationshipControlManagerForOneDataForm(propertyControl.EditNdTypeArea.TemporaryDisplayView, GetRelationshipUISetting(), true, propertyControl.EntitySearchColumn.Alias);
                            if (!string.IsNullOrEmpty(propertyControl.EntitySearchColumn.Tooltip))
                            {
                                propertyControl.ControlManager.LabelControlManager.SetTooltip(null, propertyControl.EntitySearchColumn.Tooltip);
                            }
                        }
                        RelationshipColumnControls.Add(propertyControl);

                        ////اینجا چیه بررسی شود چرا اینجا؟
                        //if (propertyControl.EditNdTypeArea.SimpleEntity.SearchInitially == true)
                        //    propertyControl.EditNdTypeArea.SearchViewEntityArea.SearchInitialy();
                    }
                }
                else
                {
                    var propertyControl = new SimpleSearchColumnControl();
                    propertyControl.Column             = searchcolumn.Column;
                    propertyControl.EntitySearchColumn = searchcolumn;
                    propertyControl.Operators          = GetSimpleColumnOperators(propertyControl.Column);
                    //        propertyControl.ControlPackage = new UIControlPackageForSimpleColumn();
                    propertyControl.ControlManager = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateSimpleControlManagerForOneDataForm(propertyControl.Column, GetColumnUISetting(propertyControl.Column), false, propertyControl.Operators, true, propertyControl.EntitySearchColumn.Alias);
                    if (!string.IsNullOrEmpty(propertyControl.EntitySearchColumn.Tooltip))
                    {
                        propertyControl.ControlManager.LabelControlManager.SetTooltip(null, propertyControl.EntitySearchColumn.Tooltip);
                    }

                    if (propertyControl.Operators.Any())
                    {
                        propertyControl.ControlManager.SetOperator(propertyControl.Operators.First(x => x.Operator == GetDefaultOperator(propertyControl.Column)).Operator);
                    }
                    SimpleColumnControls.Add(propertyControl);
                }
            }

            foreach (var searchcolumn in EntitySearch.EntitySearchAllColumns.OrderBy(x => x.OrderID))
            {
                if (searchcolumn.Column == null)
                {
                    if (searchcolumn.RelationshipTail != null)
                    {
                        var relControl = RelationshipColumnControls.First(x => x.EntitySearchColumn == searchcolumn);
                        SimpleSearchView.AddView(relControl.ControlManager, relControl.ControlManager.LabelControlManager);
                    }
                }
                else
                {
                    var simpleControl = SimpleColumnControls.First(x => x.EntitySearchColumn == searchcolumn);
                    SimpleSearchView.AddUIControlPackage(simpleControl.ControlManager, simpleControl.ControlManager.LabelControlManager);
                }
            }
        }