public void SetAreaInitializer(SearchEntityAreaInitializer newAreaInitializer)
        {
            SearchInitializer = newAreaInitializer;

            SearchView                        = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GenerateViewOfSearchEntityArea();
            SimpleSearchEntityArea            = new SimpleSearchEntityArea();
            newAreaInitializer.SearchEntityID = newAreaInitializer.SearchEntityID;
            SimpleSearchEntityArea.SetAreaInitializer(newAreaInitializer);
            SimpleSearchEntityArea.SearchDataDefined += SimpleSearchEntityArea_SearchDataDefined;
            SearchView.AddSimpleSearchView(SimpleSearchEntityArea.SimpleSearchView);

            AdvancedSearchEntityAre = new AdvancedSearchEntityArea();
            AdvancedSearchEntityAre.SetAreaInitializer(newAreaInitializer);
            AdvancedSearchEntityAre.SearchDataDefined += SimpleSearchEntityArea_SearchDataDefined;
            SearchView.AddAdvancedSearchView(AdvancedSearchEntityAre.AdvancedSearchView);
            //if (newAreaInitializer.PreDefinedSearch != null && newAreaInitializer.EditSearchRepository != null)
            //    throw new Exception("sdfsbvxzcv");

            //بررسی شود دوتاشون میتونن باشن یا خطا باید بده
            //if (newAreaInitializer.PreDefinedSearch != null)
            //{
            //    newAreaInitializer.EditSearchRepository = newAreaInitializer.PreDefinedSearch;
            //}
            if (newAreaInitializer.PreDefinedSearch != null)
            {
                ShowSearchRepository(newAreaInitializer.PreDefinedSearch);
            }
        }
        public void ShowSearchRepository(DP_SearchRepository searchRepository)
        {
            if (searchRepository == null)
            {
                return;
            }
            bool showInSimple = false;

            if (searchRepository.IsSimpleSearch == true)
            {
                showInSimple = SimpleSearchEntityArea.ShowSearchRepository(searchRepository);
                if (showInSimple)
                {
                    SearchView.IsSimpleSearchActiveOrAdvancedSearch = true;
                }
            }
            if (!showInSimple)
            {
                if (!AdvancedSearchEntityAre.ShowSearchRepository(searchRepository))
                {
                    throw (new Exception("AsdasdasD"));
                }
                else
                {
                    SearchView.IsSimpleSearchActiveOrAdvancedSearch = false;
                }
            }
        }
 public DP_SearchRepository GetSearchRepository()
 {
     if (SearchView.IsSimpleSearchActiveOrAdvancedSearch)
     {
         return(SimpleSearchEntityArea.GetSearchRepository());
     }
     else
     {
         return(AdvancedSearchEntityAre.GetSearchRepository());
     }
 }