public override IControlManager GenerateControlManager(WindowTabInfo tabInfo, ISearchManager sm)
        {
            IControlManager cm = base.GenerateControlManager(tabInfo, sm);
            IDisplayManager dm = cm.DisplayManager;

            if (tabInfo.SelectedDataValueChanged != null)
            {
                dm.SelectedDataValueChanged += new EventHandler<SelectedDataValueChangedEventArgs>(delegate(object sender, SelectedDataValueChangedEventArgs e)
                {
                    EventProcessUtils.ExecuteEventProcess(ADInfoBll.Instance.GetEventProcessInfos(tabInfo.SelectedDataValueChanged), sender, e);
                });
            }
            if (tabInfo.PositionChanged != null)
            {
                dm.PositionChanged += new EventHandler(delegate(object sender, EventArgs e)
                {
                    EventProcessUtils.ExecuteEventProcess(ADInfoBll.Instance.GetEventProcessInfos(tabInfo.PositionChanged), sender, e);
                });
            }

            AddEvent(tabInfo, cm, WindowTabEventManagerType.ControlManager);
            AddEvent(tabInfo, cm.DisplayManager, WindowTabEventManagerType.DisplayManager);

            return cm;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="fm"></param>
        public SearchWindowSetupForm(ISearchManager sm)
        {
            InitializeComponent();

            m_sm = sm;
            txtMaxResult.Value = m_sm.MaxResult;
        }
        public void Init()
        {
            _searchManager = MockRepository.GenerateStub<ISearchManager>();
            _trackHandler = MockRepository.GenerateStub<ITrackHandler>();
            _eventAggregator = MockRepository.GenerateStub<IEventAggregator>();

            _spotifyServices = new SpotifyServices(_searchManager, _trackHandler, _eventAggregator);
        }
        public ScalarTests()
        {
            _idProvider = new IdProvider();
            _testData = TestHelper.GetResponseData<Widget>(10);

            _searchManager = Substitute.For<ISearchManager>();
            _searchManager.Search(Arg.Any<AdvancedSearchCriteria>()).ReturnsForAnyArgs(
                _testData
                );

            _widgets = EktronQueryFactory.Queryable<Widget>(_idProvider, _searchManager);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="archiveSeeForm"></param>
        /// <param name="sm"></param>
        /// <param name="winTabInfo"></param>
        public ArchiveSearchForm(Form parentForm, ISearchManager sm, WindowTabInfo winTabInfo)
            : this()
        {
            m_parentForm = parentForm;

            m_sm = sm;
            m_winTabInfo = winTabInfo;

            m_sm.DataLoaded += new EventHandler<DataLoadedEventArgs>(searchManager_DataLoaded);
            m_sm.DataLoading += new EventHandler<DataLoadingEventArgs>(searchManager_DataLoading);

            searchControlContainer1.SetSearchManager(sm);
            searchControlContainer1.LoadSearchControls(winTabInfo.GridName, this.flowLayoutPanelSearchControlNormal, this.flowLayoutPanelSearchControlHidden);

            //tabControl1.SetTabPageBackColor();

            LoadCustomSearch(winTabInfo.GridName);

            LoadLayout();
        }
        public static Tuple<ISearchExpression, IList<ISearchOrder>> GetSearchManagerParameters(ISearchManager sm, System.Collections.Specialized.NameValueCollection nvc)
        {
            sm.FirstResult = 0;
            sm.MaxResult = SearchManagerDefaultValue.MaxResult;

            ISearchExpression exp = null;
            IList<ISearchOrder> orders = null;
            if (!string.IsNullOrEmpty(nvc["exp"]))
            {
                exp = SearchExpression.Parse(System.Web.HttpUtility.UrlDecode(nvc["exp"]));
            }
            else if (!string.IsNullOrEmpty(nvc["filter"]))
            {
                exp = SearchExpression.Parse(System.Web.HttpUtility.UrlDecode(nvc["filter"]));
            }
            if (!string.IsNullOrEmpty(nvc["order"]))
            {
                orders = SearchOrder.Parse(System.Web.HttpUtility.UrlDecode(nvc["order"]));
            }
            else if (!string.IsNullOrEmpty(nvc["orderby"]))
            {
                orders = SearchOrder.Parse(System.Web.HttpUtility.UrlDecode(nvc["orderby"]));
            }
            if (!string.IsNullOrEmpty(nvc["first"]))
            {
                sm.FirstResult = Feng.Utils.ConvertHelper.ToInt(nvc["first"]).Value;
            }
            else if (!string.IsNullOrEmpty(nvc["skip"]))
            {
                sm.FirstResult = Feng.Utils.ConvertHelper.ToInt(nvc["skip"]).Value;
            }
            if (!string.IsNullOrEmpty(nvc["count"]))
            {
                sm.MaxResult = Feng.Utils.ConvertHelper.ToInt(nvc["count"]).Value;
            }
            else if (!string.IsNullOrEmpty(nvc["top"]))
            {
                sm.MaxResult = Feng.Utils.ConvertHelper.ToInt(nvc["top"]).Value;
            }
            return new Tuple<ISearchExpression, IList<ISearchOrder>>(exp, orders);
        }
 /// <summary>
 /// CreateSearchManagerEagerFetchs
 /// </summary>
 /// <param name="fm"></param>
 /// <param name="gridName"></param>
 public static void CreateSearchManagerEagerFetchs(ISearchManager fm, string gridName)
 {
     Dictionary<string, bool> eagerFetchs = new Dictionary<string, bool>();
     foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(gridName))
     {
         if (info.GridColumnType == GridColumnType.Normal)
         {
             string toEagerFetch = null;
             if (info.CellViewerManager == "Object")
             {
                 if (string.IsNullOrEmpty(info.Navigator))
                 {
                     toEagerFetch = info.PropertyName;
                 }
                 else
                 {
                     toEagerFetch = info.Navigator + "." + info.PropertyName;
                 }
             }
             else if (!string.IsNullOrEmpty(info.Navigator))
             {
                 toEagerFetch = info.Navigator;
             }
             if (!string.IsNullOrEmpty(toEagerFetch))
             {
                 string[] ss = toEagerFetch.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                 StringBuilder sb = new StringBuilder();
                 for (int i = 0; i < ss.Length; ++i)
                 {
                     sb.Append(ss[i]);
                     eagerFetchs[sb.ToString()] = true;
                     sb.Append(".");
                 }
             }
         }
     }
     foreach (string s in eagerFetchs.Keys)
     {
         fm.EagerFetchs.Add(s);
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dmParent"></param>
        /// <param name="tableName"></param>
        /// <param name="defaultOrder"></param>
        /// <param name="selectClause"></param>
        /// <param name="groupByClause"></param>
        /// <param name="searchExpression"></param>
        /// <param name="searchOrder"></param>
        /// <param name="innerSearchManagerType"></param>
        public SearchManagerProxyDetailInMaster(IDisplayManager dmParent, string tableName, string defaultOrder, string selectClause, string groupByClause, string searchExpression, string searchOrder, string innerSearchManagerType)
            : base(dmParent)
        {
            switch (innerSearchManagerType.ToUpper())
            {
                case "":
                case "NORMAL":
                    m_innerSearchManager = new SearchManager(tableName, defaultOrder, selectClause, groupByClause);
                    break;
                case "FUNCTION":
                    m_innerSearchManager = new SearchManagerFunction(tableName, defaultOrder);
                    break;
                case "PROCEDURE":
                    m_innerSearchManager = new SearchManagerProcedure(tableName);
                    break;
                default:
                    throw new NotSupportedException("innerSearchManagerType is invalid!");
            }

            m_searchExpression = searchExpression;
            m_searchOrder = searchOrder;

            m_innerSearchManager.EnablePage = false;
        }
Exemple #9
0
 public Decoder(ISearchManager searchManager, bool fireNonFinalResults, bool autoAllocate,
                List <IResultListener> resultListeners, int featureBlockSize) : base(searchManager, fireNonFinalResults, autoAllocate, resultListeners)
 {
     this.featureBlockSize = featureBlockSize;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sm"></param>
 public DisplayManagerBindingSource(ISearchManager sm)
     : base(sm)
 {
 }
 public DeliveryController(IContext context, IStorefrontContext storefrontContext, IDeliveryRepository deliveryRepository, IVisitorContext visitorContext, ISearchManager searchManager)
     : base(storefrontContext, context)
 {
     Assert.ArgumentNotNull(deliveryRepository, nameof(deliveryRepository));
     Assert.ArgumentNotNull(storefrontContext, nameof(storefrontContext));
     Assert.ArgumentNotNull(visitorContext, nameof(visitorContext));
     _visitorContext     = visitorContext;
     _deliveryRepository = deliveryRepository;
     _searchManager      = searchManager;
 }
 public ReturnPropertiesTests()
 {
     _idProvider = new IdProvider();
     _searchManager = Substitute.For<ISearchManager>();
     _executor = new TestableExecutor(_idProvider, _searchManager);
 }
        public void DisableSearchProgressForm(ISearchManager sm)
        {
            if (sm == null)
            {
                foreach (var i in m_progressSms)
                {
                    sm = i as ISearchManager;
                    if (sm != null)
                    {
                        sm.DataLoaded -= new EventHandler<DataLoadedEventArgs>(searchManager_DataLoaded);
                        sm.DataLoading -= new EventHandler<DataLoadingEventArgs>(searchManager_DataLoading);
                    }
                }
                m_progressSms.Clear();

                if (progressForm != null)
                {
                    progressForm.ProgressStopped -= new EventHandler(progressForm_ProgressStopped);
                    progressForm.Stop();
                    progressForm.Dispose();
                    progressForm = null;
                }
            }
            else
            {
                sm.DataLoaded -= new EventHandler<DataLoadedEventArgs>(searchManager_DataLoaded);
                sm.DataLoading -= new EventHandler<DataLoadingEventArgs>(searchManager_DataLoading);
                m_progressSms.Remove(sm);
            }
        }
Exemple #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HashtagsController"/> class
 /// </summary>
 /// <param name="log">Log</param>
 /// <param name="searchManager">Search manager</param>
 public HashtagsController(ILog log, ISearchManager searchManager)
 {
     this.log           = log;
     this.searchManager = searchManager;
 }
        public void EnableSearchProgressForm(ISearchManager sm)
        {
            sm.DataLoaded += new EventHandler<DataLoadedEventArgs>(searchManager_DataLoaded);
            sm.DataLoading += new EventHandler<DataLoadingEventArgs>(searchManager_DataLoading);

            m_progressSms.Add(sm);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    //Get all the information from query string
                    long   FromCityId   = Convert.ToInt64(Request.QueryString["fromid"].ToString());
                    long   ToCityId     = Convert.ToInt64(Request.QueryString["toid"].ToString());
                    string FromCityName = Request.QueryString["fromCityName"].ToString();
                    string ToCityName   = Request.QueryString["toCityName"].ToString();
                    string flightclass  = Request.QueryString["class"].ToString();
                    int    td           = Convert.ToInt16(Request.QueryString["td"].ToString());
                    string adults       = Request.QueryString["adults"].ToString();

                    //Display the header information
                    lblAdults.Text           = adults;
                    hdnTravelDirection.Value = td.ToString();
                    if (Request.QueryString["depart_date"] != null)
                    {
                        lblHeaderDepart.Text = Convert.ToDateTime(Request.QueryString["depart_date"]).ToString("ddd, dd MMM, yyyy");
                    }

                    if (Request.QueryString["return_date"] != null)
                    {
                        lblHeaderReturn.Text = Convert.ToDateTime(Request.QueryString["return_date"]).ToString("ddd, dd MMM, yyyy");
                    }

                    TravelDirection traveldirection = (TravelDirection)td;

                    City fromcity = new City();
                    fromcity.CityId = FromCityId;
                    fromcity.Name   = FromCityName;

                    City tocity = new City();
                    tocity.CityId = ToCityId;
                    tocity.Name   = ToCityName;

                    DateTime onwardDateOfJourney = new DateTime();

                    if (Request.QueryString["depart_date"] != null)
                    {
                        onwardDateOfJourney = Convert.ToDateTime(Request.QueryString["depart_date"]);
                    }

                    DateTime returnDateOfJourney = new DateTime();
                    if (Request.QueryString["return_date"] != null)
                    {
                        returnDateOfJourney = Convert.ToDateTime(Request.QueryString["return_date"]);
                    }
                    TravelClass travelclass = (TravelClass)Enum.Parse(typeof(TravelClass), flightclass);

                    //Calling the Parameterized Constructor
                    //This is done once the class variables are set to private set
                    //and a paramterized constructor is introduced
                    //Using VS - Effectively - CR - STYCBG09.01
                    SearchInfo searchinfo = new SearchInfo(fromcity, tocity, onwardDateOfJourney, returnDateOfJourney, Convert.ToInt32(adults), travelclass, traveldirection);

                    //Contact the search manager and get all the schedules as a search log
                    ISearchManager searchmanager = SearchManagerFactory.GetInstance().Create();
                    SearchLog      searchlog     = searchmanager.SearchForFlights(searchinfo);

                    SearchResult searchresult = searchlog.GetSearchResult(TravelDirection.OneWay);

                    List <TravelSchedule> lstTravelSchedule = searchresult.GetTravelSchedules();
                    dlOuterOnward.DataSource = lstTravelSchedule;
                    dlOuterOnward.DataBind();

                    Session["flightbookingonwardresults"] = lstTravelSchedule;
                    Session["SearchInfo"] = searchinfo;

                    if (lstTravelSchedule.Count > 0)
                    {
                        lblOneWayFromCity.Text = lblHeaderFromCity.Text = searchinfo.FromCity.Name;
                        lblOneWayToCity.Text   = lblHeaderToCity.Text = searchinfo.ToCity.Name;
                    }

                    if (traveldirection == TravelDirection.Return)
                    {
                        SearchResult searchresultreturn = searchlog.GetSearchResult(TravelDirection.Return);

                        List <TravelSchedule> lstTravelScheduleReturn = searchresultreturn.GetTravelSchedules();
                        dlOuterReturn.DataSource = lstTravelScheduleReturn;
                        dlOuterReturn.DataBind();

                        Session["flightbookingreturnresults"] = lstTravelScheduleReturn;

                        if (lstTravelScheduleReturn.Count > 0)
                        {
                            lblReturnFromCity.Text = searchinfo.ToCity.Name;
                            lblReturnToCity.Text   = searchinfo.FromCity.Name;
                        }
                    }
                    else
                    {
                        outbound_div.Style.Add("width", "70%");
                        return_div.Visible             = false;
                        lblHeaderReturn.Visible        = false;
                        lblHeaderDateSeparator.Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    lblError.Visible = true;
                    lblError.Text    = ex.Message;
                }
            }
        }
        public Presenter(
            ISearchManager searchManager,
            IBookmarks bookmarks,
            IFiltersList hlFilters,
            IView view,
            IPresentersFacade navHandler,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            IHeartBeatTimer heartbeat,
            ISynchronizationContext uiThreadSynchronization,
            StatusReports.IPresenter statusReports,
            LogViewer.IPresenterFactory logViewerPresenterFactory,
            IColorTheme theme,
            IChangeNotification changeNotification
            )
        {
            this.searchManager                    = searchManager;
            this.bookmarks                        = bookmarks;
            this.hlFilters                        = hlFilters;
            this.view                             = view;
            this.loadedMessagesPresenter          = loadedMessagesPresenter;
            this.statusReports                    = statusReports;
            this.theme                            = theme;
            this.changeNotification               = changeNotification;
            var(messagesPresenter, messagesModel) = logViewerPresenterFactory.CreateSearchResultsPresenter(
                view.MessagesView, loadedMessagesPresenter.LogViewerPresenter);
            this.messagesPresenter = messagesPresenter;
            this.messagesPresenter.FocusedMessageDisplayMode          = LogViewer.FocusedMessageDisplayModes.Slave;
            this.messagesPresenter.DblClickAction                     = Presenters.LogViewer.PreferredDblClickAction.DoDefaultAction;
            this.messagesPresenter.DefaultFocusedMessageActionCaption = "Go to message";
            this.messagesPresenter.DisabledUserInteractions           = LogViewer.UserInteraction.RawViewSwitching;
            this.messagesPresenter.DefaultFocusedMessageAction       += async(s, e) =>
            {
                if (messagesPresenter.FocusedMessage != null)
                {
                    if (await navHandler.ShowMessage(messagesPresenter.FocusedMessageBookmark,
                                                     BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.SearchResultStringsSet
                                                     ).IgnoreCancellation())
                    {
                        loadedMessagesPresenter.LogViewerPresenter.ReceiveInputFocus();
                    }
                }
            };
            this.hlFilters.OnPropertiesChanged += (sender, args) =>
            {
                if (args.ChangeAffectsFilterResult)
                {
                    lazyUpdateFlag.Invalidate();
                }
            };
            this.hlFilters.OnFiltersListChanged += (sender, args) =>
            {
                lazyUpdateFlag.Invalidate();
            };
            this.hlFilters.OnFilteringEnabledChanged += (sender, args) =>
            {
                lazyUpdateFlag.Invalidate();
            };
            this.searchManager.SearchResultChanged += (sender, e) =>
            {
                if ((e.Flags & SearchResultChangeFlag.HitCountChanged) != 0 ||
                    (e.Flags & SearchResultChangeFlag.ProgressChanged) != 0 ||
                    (e.Flags & SearchResultChangeFlag.PinnedChanged) != 0 ||
                    (e.Flags & SearchResultChangeFlag.VisibleChanged) != 0)
                {
                    lazyUpdateFlag.Invalidate();
                }
                if ((e.Flags & SearchResultChangeFlag.StatusChanged) != 0)
                {
                    lazyUpdateFlag.Invalidate();
                    uiThreadSynchronization.Post(ValidateView);
                    uiThreadSynchronization.Post(PostSearchActions);
                }
            };
            this.searchManager.CombinedSearchResultChanged += (sender, e) =>
            {
                uiThreadSynchronization.Post(() => messagesModel.RaiseSourcesChanged());
            };
            this.searchManager.SearchResultsChanged += (sender, e) =>
            {
                lazyUpdateFlag.Invalidate();
                messagesModel.RaiseSourcesChanged();
                uiThreadSynchronization.Post(ValidateView);
                uiThreadSynchronization.Post(PreSearchActions);
            };

            heartbeat.OnTimer += (sender, args) =>
            {
                if (args.IsNormalUpdate)
                {
                    ValidateView();
                }
            };

            view.SetViewModel(this);
            UpdateExpandedState();
        }
 public ShoppingCartLinesController(IStorefrontContext storefrontContext, IVisitorContext visitorContext, ISearchManager searchManager, IShoppingCartLinesRepository shoppingCartLinesRepository, IContext context)
     : base(storefrontContext, context)
 {
     Assert.ArgumentNotNull(visitorContext, nameof(visitorContext));
     Assert.ArgumentNotNull(searchManager, nameof(searchManager));
     Assert.ArgumentNotNull(shoppingCartLinesRepository, nameof(shoppingCartLinesRepository));
     _shoppingCartLinesRepository = shoppingCartLinesRepository;
     _visitorContext = visitorContext;
     _searchManager  = searchManager;
 }
 public WishListManager(IWishListConnectServiceProvider connectServiceProvider, IStorefrontContext storefrontContext, ISearchManager searchManager)
 {
     Assert.ArgumentNotNull((object)connectServiceProvider, nameof(connectServiceProvider));
     Assert.ArgumentNotNull((object)storefrontContext, nameof(storefrontContext));
     Assert.ArgumentNotNull((object)searchManager, nameof(searchManager));
     this.StorefrontContext       = storefrontContext;
     this.SearchManager           = searchManager;
     this.WishListServiceProvider = connectServiceProvider.GetWishListServiceProvider();
 }
 public ProductCompareRepository(IModelProvider modelProvider, ISiteContext siteContext, ICompareManager compareManager, IStorefrontContext storefrontContext, ISearchInformation searchInformation, ISearchManager searchManager, ICatalogManager catalogManager, ICatalogUrlManager catalogUrlManager, IContext context)
     : base(modelProvider, storefrontContext, siteContext, searchInformation, searchManager, catalogManager, catalogUrlManager, context)
 {
     Assert.ArgumentNotNull(modelProvider, nameof(modelProvider));
     _modelProvider  = modelProvider;
     _compareManager = compareManager;
     _siteContext    = siteContext;
 }
Exemple #21
0
        public RequestForQuoteFunctionsViewModel(IEventAggregator eventAggregator, IClientManager clientManager,
                                                 IUnderlyingManager underlyingManager, IBookManager bookManager, ISearchManager searchManager,
                                                 IConfigurationManager configManager, IUserManager userManager, IGroupManager groupManager)
        {
            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }

            if (clientManager == null)
            {
                throw new ArgumentNullException("clientManager");
            }

            if (underlyingManager == null)
            {
                throw new ArgumentNullException("underlyingManager");
            }

            if (bookManager == null)
            {
                throw new ArgumentNullException("bookManager");
            }

            if (searchManager == null)
            {
                throw new ArgumentNullException("searchManager");
            }

            if (configManager == null)
            {
                throw new ArgumentNullException("configManager");
            }

            if (userManager == null)
            {
                throw new ArgumentNullException("userManager");
            }

            if (groupManager == null)
            {
                throw new ArgumentNullException("groupManager");
            }

            SearchRequestsCommand = new SearchRequestsCommand(this);
            FilterRequestsCommand = new FilterRequestsCommand(this);
            ClearCriteriaCommand  = new ClearCriteriaCommand(this);
            SaveSearchCommand     = new SaveSearchCommand(this);
            DeleteSearchCommand   = new DeleteSearchCommand(this);
            UpdatePrivacyCommand  = new UpdatePrivacyCommand(this);

            this.clientManager     = clientManager;
            this.underlyingManager = underlyingManager;
            this.bookManager       = bookManager;
            this.searchManager     = searchManager;
            this.eventAggregator   = eventAggregator;
            this.configManager     = configManager;
            this.userManager       = userManager;
            this.groupManager      = groupManager;

            InitializeCollections();
            InitializeEventSubscriptions();
        }
Exemple #22
0
 public void Init()
 {
     _musicServices = MockRepository.GenerateStub<IMusicServices>();
     _searchManager = new SearchManager(_musicServices);
 }
 public HomeController(ILogger <HomeController> logger, SearchEnginesDbContext context, ISearchManager searchManager, IMapper mapper)
 {
     _logger        = logger;
     _context       = context;
     _searchManager = searchManager;
     _mapper        = mapper;
 }
        /// <summary>
        /// �öԻ�����ʾ���Ҵ���
        /// </summary>
        /// <param name="searchPanel"></param>
        /// <param name="sm"></param>
        /// <param name="formName"></param>
        public static void ShowSearchDialog(Control searchPanel, ISearchManager sm, string formName)
        {
            if (searchPanel != null)
            {
                PositionPersistForm searchForm = new PositionPersistForm();
                searchForm.Name = formName;
                searchForm.Text = "����";

                searchForm.Controls.Add(searchPanel);
                searchPanel.Dock = DockStyle.Fill;

                sm.DataLoaded += new EventHandler<DataLoadedEventArgs>(searchManager_DataLoaded);
                m_searchForms[sm.Name] = searchForm;
                searchForm.ShowDialog();

                searchForm.Controls.Remove(searchPanel);
                searchForm.Dispose();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            resultPanel.Visible       = true;
            searchFailedPanel.Visible = false;
            if (!IsPostBack)
            {
                try
                {
                    long   FromCityId  = Convert.ToInt64(Request.QueryString["fromid"].ToString());
                    long   ToCityId    = Convert.ToInt64(Request.QueryString["toid"].ToString());
                    string flightclass = Request.QueryString["class"].ToString();
                    int    td          = Convert.ToInt16(Request.QueryString["td"].ToString());
                    string adults      = Request.QueryString["adults"].ToString();

                    lblAdults.Text           = adults;
                    hdnTravelDirection.Value = td.ToString();
                    lblHeaderDepart.Text     = Convert.ToDateTime(Request.QueryString["depart_date"]).ToString("ddd, dd MMM, yyyy");
                    lblHeaderReturn.Text     = Convert.ToDateTime(Request.QueryString["return_date"]).ToString("ddd, dd MMM, yyyy");

                    TravelDirection traveldirection = (TravelDirection)td;
                    SearchInfo      searchinfo      = new SearchInfo();
                    City            fromcity        = new City();
                    searchinfo.OnwardDateOfJourney = Convert.ToDateTime(Request.QueryString["depart_date"]);
                    searchinfo.ReturnDateOfJourney = Convert.ToDateTime(Request.QueryString["return_date"]);
                    fromcity.CityId = FromCityId;
                    City tocity = new City();
                    tocity.CityId = ToCityId;
                    TravelClass travelclass = (TravelClass)Enum.Parse(typeof(TravelClass), flightclass);
                    searchinfo.FromCity  = fromcity;
                    searchinfo.ToCity    = tocity;
                    searchinfo.Class     = travelclass;
                    searchinfo.Direction = traveldirection;

                    ISearchManager searchmanager = SearchManagerFactory.GetInstance().Create();
                    SearchLog      searchlog     = searchmanager.SearchForFlights(searchinfo);

                    SearchResult searchresultOnward = searchlog.GetSearchResult(TravelDirection.OneWay);


                    List <TravelSchedule> lstTravelSchedule = searchresultOnward.GetTravelSchedules();
                    if (lstTravelSchedule.Count == 0)
                    {
                        resultPanel.Visible       = false;
                        searchFailedPanel.Visible = true;
                        return;
                    }



                    dlOuterOnward.DataSource = lstTravelSchedule;
                    Session["flightbookingonwardresults"] = lstTravelSchedule;
                    dlOuterOnward.DataBind();



                    if (lstTravelSchedule.Count > 0)
                    {
                        lblOneWayFromCity.Text = lblHeaderFromCity.Text = lstTravelSchedule[0].GetSchedules()[0].RouteInfo.FromCity.Name;
                        lblOneWayToCity.Text   = lblHeaderToCity.Text = lstTravelSchedule[0].GetSchedules()[0].RouteInfo.ToCity.Name;
                    }

                    if (traveldirection == TravelDirection.Return)
                    {
                        SearchResult searchresultreturn = searchlog.GetSearchResult(TravelDirection.Return);

                        List <TravelSchedule> lstTravelScheduleReturn = searchresultreturn.GetTravelSchedules();
                        if (lstTravelScheduleReturn.Count == 0)
                        {
                            resultPanel.Visible       = false;
                            searchFailedPanel.Visible = true;
                            return;
                        }
                        dlOuterReturn.DataSource = lstTravelScheduleReturn;
                        dlOuterReturn.DataBind();

                        Session["flightbookingreturnresults"] = lstTravelScheduleReturn;

                        if (lstTravelScheduleReturn.Count > 0)
                        {
                            lblReturnFromCity.Text = lstTravelScheduleReturn[0].GetSchedules()[0].RouteInfo.FromCity.Name;
                            lblReturnToCity.Text   = lstTravelScheduleReturn[0].GetSchedules()[0].RouteInfo.ToCity.Name;
                        }
                    }
                    else
                    {
                        outbound_div.Style.Add("width", "70%");
                        return_div.Visible             = false;
                        lblHeaderReturn.Visible        = false;
                        lblHeaderDateSeparator.Visible = false;
                    }
                }
                catch (FlightsNotAvailableException ex)
                {
                    lblHeaderDepart.Text = ex.Message;
                }
                catch (Exception ex)
                {
                    Response.Redirect("~/Error.aspx");
                }
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sm"></param>
 public DisplayManagerBindingSource(ISearchManager sm)
     : base(sm)
 {
 }
Exemple #27
0
        //private static void AddManualDetailForm(System.Windows.Forms.Form form, IArchiveDetailFormAuto detailFormAuto)
        //{
        //    form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        //    form.TopLevel = false;

        //    detailFormAuto.ReplaceFlowLayoutPanel(form);
        //}

        public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IBaseDao daoParent, IDisplayManager dmParent, IArchiveDetailForm originalDetailForm = null)
        {
            ArchiveDetailForm     detailForm = originalDetailForm as ArchiveDetailForm;
            IList <WindowTabInfo> tabInfos   = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name);

            IList <WindowTabInfo> detailFormTabInfos  = new List <WindowTabInfo>();
            IList <WindowTabInfo> detailFormTabInfos2 = new List <WindowTabInfo>();

            foreach (WindowTabInfo subTabInfo in tabInfos[0].ChildTabs)
            {
                if (subTabInfo.IsInDetailForm)
                {
                    detailFormTabInfos.Add(subTabInfo);
                }
                else
                {
                    detailFormTabInfos2.Add(subTabInfo);
                }
            }

            //if (detailStyleForm == null && windowInfo.DetailForm != null)
            //{
            //    FormInfo formInfo = ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name);
            //    if (formInfo == null)
            //    {
            //        throw new ArgumentException("There is no FormInfo with Name of " + windowInfo.DetailForm.Name);
            //    }
            //    detailStyleForm = CreateForm(formInfo);
            //}
            //if (detailStyleForm != null)
            //{
            //    ret = detailStyleForm as ArchiveDetailForm;
            //}

            // 当第二层的任何一个ControlManager为空时,DetailForm作为不可编辑的。
            bool isControlManagerEnable = cmParent != null;

            if (isControlManagerEnable)
            {
                for (int i = 0; i < detailFormTabInfos.Count; ++i)
                {
                    if (string.IsNullOrEmpty(detailFormTabInfos[i].ControlManagerClassName))
                    {
                        dmParent = cmParent.DisplayManager;
                        isControlManagerEnable = false;
                        break;
                    }
                }
            }

            if (detailForm == null)
            {
                if (detailFormTabInfos.Count == 0)
                {
                    if (isControlManagerEnable)
                    {
                        detailForm = new ArchiveDetailFormAuto(cmParent, tabInfos[0].GridName);
                    }
                    else
                    {
                        detailForm = new ArchiveDetailFormAuto(dmParent, tabInfos[0].GridName);
                    }
                }
                else if (detailFormTabInfos.Count == 1)
                {
                    if (isControlManagerEnable)
                    {
                        detailForm = new ArchiveDetailFormAutoWithDetailGrid(cmParent, tabInfos[0].GridName);
                    }
                    else
                    {
                        detailForm = new ArchiveDetailFormAutoWithDetailGrid(dmParent, tabInfos[0].GridName);
                    }
                }
                else
                {
                    string[] texts = new string[detailFormTabInfos.Count];
                    for (int i = 0; i < detailFormTabInfos.Count; ++i)
                    {
                        texts[i] = detailFormTabInfos[i].Text;
                    }

                    if (isControlManagerEnable)
                    {
                        detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(cmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts);
                    }
                    else
                    {
                        detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(dmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts);
                    }
                }

                //IArchiveDetailFormAuto detailFormAuto = ret as IArchiveDetailFormAuto;
                //if (detailStyleForm != null && detailFormAuto != null)
                //{
                //    AddManualDetailForm(detailStyleForm, detailFormAuto);
                //}
            }
            else
            {
                // Dao 在cmParent处已经设置了
                if (isControlManagerEnable)
                {
                    detailForm.SetControlMananger(cmParent, tabInfos[0].GridName);
                }
                else
                {
                    detailForm.SetDisplayManager(dmParent, tabInfos[0].GridName);
                }
            }

            detailForm.Name = windowInfo.Name;
            detailForm.Text = windowInfo.Text;

            // 只有2层可编辑。主层(控件)-第二层(grid)。再下去就是第二层grid的DetailGrid,不可编辑。
            IArchiveDetailFormWithDetailGrids detailFormWithGrids = detailForm as IArchiveDetailFormWithDetailGrids;

            if (detailFormWithGrids != null)
            {
                for (int i = 0; i < detailFormTabInfos.Count; ++i)
                {
                    if (i >= detailFormWithGrids.DetailGrids.Count)
                    {
                        break;
                    }
                    // 主是ControlManager,并不一定子也是ControlManager。
                    // 主可以在grid编辑,不能通过DetailForm编辑。此时DetailForm是另外显示的东西。
                    if (isControlManagerEnable)
                    {
                        var daoRelational = daoParent as IRelationalDao;
                        if (daoRelational == null)
                        {
                            throw new ArgumentException("IArchiveDetailFormWithDetailGrids must has IRelationalDao.");
                        }

                        ISearchManager        subSm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], cmParent.DisplayManager);
                        IWindowControlManager subCm = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(detailFormTabInfos[i], subSm) as IWindowControlManager;
                        subCm.Name = detailFormTabInfos[i].Name;
                        ((IArchiveGrid)detailFormWithGrids.DetailGrids[i]).SetControlManager(subCm, detailFormTabInfos[i].GridName);

                        ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos[i]);

                        IBaseDao subDao = daoRelational.GetRelationalDao(i);
                        if (subDao is IMemoriedRelationalDao)
                        {
                            IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).DetailMemoryDao;
                            subCm.Dao = subMemoryDao;

                            //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent));
                            ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager);
                        }
                        else
                        {
                            subCm.Dao = subDao;
                        }
                    }
                    else
                    {
                        ISearchManager  subSm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], dmParent);
                        IDisplayManager subDm = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(detailFormTabInfos[i], subSm);
                        subDm.Name = detailFormTabInfos[i].Name;

                        detailFormWithGrids.DetailGrids[i].SetDisplayManager(subDm, detailFormTabInfos[i].GridName);
                    }
                    GenerateDetailGrids(detailFormWithGrids.DetailGrids[i], detailFormTabInfos[i]);
                }
            }

            if (isControlManagerEnable)
            {
                // Generate Other Daos
                for (int i = 0; i < detailFormTabInfos2.Count; ++i)
                {
                    if (!string.IsNullOrEmpty(detailFormTabInfos2[i].BusinessLayerClassName))
                    {
                        ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos2[i]);
                    }
                }
            }

            // if Master Tab's IsInDetailForm=false, Invisible it
            if (!tabInfos[0].IsInDetailForm)
            {
                if (detailForm is IArchiveDetailFormAuto)
                {
                    (detailForm as IArchiveDetailFormAuto).RemoveControls();
                }
            }

            return(detailForm);
        }
Exemple #28
0
        private void Initialize(WindowInfo windowInfo)
        {
            this.Name = windowInfo.Name;
            this.Text = windowInfo.Text;

            IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name);

            if (tabInfos == null)
            {
                throw new ArgumentException("there is no windowTab with windowId of " + windowInfo.Name);
            }
            if (tabInfos.Count == 0)
            {
                throw new ArgumentException("There should be at least one TabInfo in WindowInfo with name is " + windowInfo.Name + "!");
            }
            if (tabInfos.Count > 1)
            {
                throw new ArgumentException("There should be at most one TabInfo in WindowInfo with name is " + windowInfo.Name + "!");
            }

            ISearchManager        smMaster = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null);
            IWindowControlManager cmMaster = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], smMaster) as IWindowControlManager;

            IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]);

            cmMaster.Dao = daoParent;

            ((IArchiveGrid)base.MasterGrid).SetControlManager(cmMaster, tabInfos[0].GridName);

            // daoParent's subDao is inserted in detailForm
            if (base.MasterGrid is IBoundGridWithDetailGridLoadOnDemand)
            {
                ArchiveFormFactory.GenerateDetailGrids(base.MasterGrid as IBoundGridWithDetailGridLoadOnDemand, tabInfos[0]);
            }

            // Load Additional Menus
            IList <WindowMenuInfo> windowMenuInfos = ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name);
            IList <WindowMenuInfo> masterWindowMenuInfos;
            IList <WindowMenuInfo> detailWindowMenuInfos;

            GeneratedArchiveSeeForm.SplitWindowMenu(windowMenuInfos, out masterWindowMenuInfos, out detailWindowMenuInfos);
            if (masterWindowMenuInfos.Count > 0)
            {
                this.GenerateWindowMenu(masterWindowMenuInfos);
            }

            if (windowInfo.GenerateDetailForm)
            {
                if (windowInfo.DetailForm != null)
                {
                    m_detailForm = ArchiveFormFactory.CreateForm(ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name)) as IArchiveDetailForm;
                    if (windowInfo.DetailWindow == null)
                    {
                        ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent, null, m_detailForm);
                    }
                }
                // 和主窗体不关联
                else if (windowInfo.DetailWindow != null)
                {
                    WindowInfo detailWindowInfo = ADInfoBll.Instance.GetWindowInfo(windowInfo.DetailWindow.Name);
                    m_detailForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(detailWindowInfo) as IArchiveDetailForm;
                    var searchWindow = m_detailForm.GetCustomProperty(MyChildForm.SearchPanelName) as ArchiveSearchForm;
                    if (searchWindow != null)
                    {
                        searchWindow.EnableProgressForm = false;
                    }
                }
                else
                {
                    m_detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(windowInfo, cmMaster, daoParent as IRelationalDao);
                }

                if (m_detailForm != null)
                {
                    //m_detailWindow.ParentArchiveForm = this;
                    // Generate DetailForm's Menu
                    if (detailWindowMenuInfos.Count > 0)
                    {
                        m_detailForm.GenerateWindowMenu(detailWindowMenuInfos);

                        m_detailForm.VisibleChanged += new EventHandler(m_detailForm_VisibleChanged);
                    }
                }
            }

            ArchiveSearchForm searchForm = null;

            this.SetSearchPanel(() =>
            {
                if (searchForm == null)
                {
                    searchForm = new ArchiveSearchForm(this, smMaster, tabInfos[0]);
                    if (cmMaster != null)
                    {
                        cmMaster.StateControls.Add(searchForm);
                    }
                }
                return(searchForm);
            });

            m_attachmentForm = GeneratedArchiveSeeForm.CreateAttachmentWindow(this, windowInfo);

            GeneratedArchiveSeeForm.InitializeWindowProcess(windowInfo, this);

            m_windowInfo = windowInfo;
        }
        private static void SetSearchControlsValues(ISearchManager sm, bool allEmpty = false)
        {
            foreach (ISearchControl sc in sm.SearchControls)
            {
                if (allEmpty)
                {
                    sc.SelectedDataValues = null;
                }
                else
                {
                    IWindowControl wc = sc as IWindowControl;
                    if (wc != null)
                    {
                        MyComboBox c = wc.Control as MyComboBox;
                        if (c != null && c.Items.Count > 0)
                        {
                            c.SelectedIndex = 0;
                            continue;
                        }
                        else
                        {
                            MyOptionPicker op = wc.Control as MyOptionPicker;
                            if (op != null && op.DropDownControl.DataRows.Count > 0)
                            {
                                op.DropDownControl.DataRows[0].Cells[Feng.Grid.Columns.CheckColumn.DefaultSelectColumnName].Value = true;
                                continue;
                            }
                        }
                    }
                    System.Collections.ArrayList arr = new System.Collections.ArrayList { };
                    if (sc.ResultType == typeof(DateTime))
                    {
                        arr.Add(System.DateTime.Today);
                    }
                    else if (sc.ResultType == typeof(int))
                    {
                        arr.Add(1);
                    }
                    else if (sc.ResultType == typeof(long))
                    {
                        arr.Add(1L);
                    }
                    else if (sc.ResultType == typeof(string))
                    {
                        arr.Add("1");
                    }
                    else if (sc.ResultType == typeof(double))
                    {
                        arr.Add(1.1d);
                    }
                    else if (sc.ResultType == typeof(decimal))
                    {
                        arr.Add(1.1m);
                    }
                    else if (sc.ResultType == typeof(bool))
                    {
                        arr.Add(true);
                    }

                    sc.SelectedDataValues = arr;
                }
            }
        }
 public ConsultantController(ISearchManager searchManager)
 {
     _searchManager = searchManager;
 }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            if (disposing)
            {
                this.PerformLayout();   // remove cachedLayoutEventArgs

                if (this.searchControlContainer1 != null)
                {
                    this.searchControlContainer1.Dispose();
                    this.searchControlContainer1 = null;
                }

                if (m_progressForm != null)
                {
                    m_progressForm.Dispose();
                }

                tabControl1.SelectedIndexChanged -= new EventHandler(tabControl1_SelectedIndexChanged);

                if (m_sm != null)
                {
                    m_sm.DataLoaded -= new EventHandler<DataLoadedEventArgs>(searchManager_DataLoaded);
                    m_sm.DataLoading -= new EventHandler<DataLoadingEventArgs>(searchManager_DataLoading);

                    m_sm.Dispose();
                    m_sm = null;
                }
            }
            base.Dispose(disposing);
        }
        /// <summary>
        /// 生成报表
        /// </summary>
        /// <param name="reportInfoName"></param>
        /// <param name="dateStart"></param>
        /// <param name="dateEnd"></param>
        /// <returns></returns>
        public static byte[] GenerateReport(string reportInfoName, DateTime dateStart, DateTime dateEnd)
        {
            CrystalHelper crystalHelper = new CrystalHelper();

            ReportInfo reportInfo = ADInfoBll.Instance.GetReportInfo(reportInfoName);

            if (reportInfo == null)
            {
                throw new ArgumentException("不存在名为" + reportInfoName + "的ReportInfo!");
            }
            ReportDocument reportDocument = ReportHelper.CreateReportDocument(reportInfo.ReportDocument);

            crystalHelper.ReportSource = reportDocument;
            System.Data.DataSet templateDataSet = ReportHelper.CreateDataset(reportInfo.DatasetName);

            IList <ISearchManager> sms             = new List <ISearchManager>();
            IList <ReportDataInfo> reportDataInfos = ADInfoBll.Instance.GetReportDataInfo(reportInfo.Name);

            foreach (ReportDataInfo reportDataInfo in reportDataInfos)
            {
                if (string.IsNullOrEmpty(reportDataInfo.SearchManagerClassName))
                {
                    throw new ArgumentException("ReportDataInfo of " + reportDataInfo.Name + " 's SearchManagerClassName must not be null!");
                }

                ISearchManager sm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(reportDataInfo.SearchManagerClassName, reportDataInfo.SearchManagerClassParams);

                sm.EnablePage = false;

                sms.Add(sm);
            }

            ISearchExpression se = SearchExpression.And(SearchExpression.Ge("日期", dateStart),
                                                        SearchExpression.Le("日期", dateEnd));

            for (int i = 0; i < reportDataInfos.Count; ++i)
            {
                System.Collections.IEnumerable dataList = sms[i].GetData(se, null);

                string s = reportDataInfos[i].DatasetTableName;
                if (!templateDataSet.Tables.Contains(s))
                {
                    throw new ArgumentException("报表DataSet中未包含名为" + s + "的DataTable!");
                }
                System.Data.DataTable dt = templateDataSet.Tables[s];
                dt.Rows.Clear();
                GenerateReportData.Generate(dt, dataList, reportDataInfos[i].GridName);
            }

            // Set Parameter
            SetParameter(crystalHelper, se);

            crystalHelper.DataSource = templateDataSet;

            string fileName = System.IO.Path.GetTempFileName();

            crystalHelper.Export(fileName, CrystalExportFormat.PortableDocFormat);

            System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
            byte[] fileData         = new byte[fs.Length];

            using (System.IO.BinaryReader sr = new System.IO.BinaryReader(fs))
            {
                sr.Read(fileData, 0, fileData.Length);
            }
            fs.Close();
            System.IO.File.Delete(fileName);

            return(fileData);
        }
 public SearchController(ISearchManager searchManager)
 {
     _searchManager = searchManager;
 }
Exemple #34
0
 public ShoppingCartLinesManager(IStorefrontContext storefrontContext, ISearchManager searchManager)
 {
     this.SearchManager     = searchManager;
     this.StorefrontContext = storefrontContext;
 }
 public RelatedProductsManager(IModelProvider modelProvider, IStorefrontContext storefrontContext, ISearchManager searchManager, IVariantDefinitionProvider variantDefinitionProvider, ISiteContext siteContext)
 {
     Assert.ArgumentNotNull((object)storefrontContext, nameof(storefrontContext));
     Assert.ArgumentNotNull((object)modelProvider, nameof(modelProvider));
     Assert.ArgumentNotNull((object)searchManager, nameof(searchManager));
     this.SearchManager             = searchManager;
     this.StorefrontContext         = storefrontContext;
     this.ModelProvider             = modelProvider;
     this.VariantDefinitionProvider = variantDefinitionProvider;
 }
Exemple #36
0
 public SearchController(ISearchManager iSearchManager)
 {
     _iSearchManager = iSearchManager;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sm"></param>
        public PageBindingSource(ISearchManager sm)
        {
            m_searchManager = sm;

            m_searchManager.DataLoaded += new EventHandler<DataLoadedEventArgs>(SearchManagerDataLoaded);
        }
 public EventsController(GenesisTrustDatabaseContext context, IDatabase database, ISearchManager searchManager)
 {
     _context       = context;
     _database      = database;
     _searchManager = searchManager;
 }
        public AddBundleToCartController(IStorefrontContext storefrontContext, IModelProvider modelProvider, IAddToCartRepository addToCartRepository, IMinicartRepository minicartRepository, IPromotionCodesRepository promotionCodesRepository, IShoppingCartLinesRepository shoppingCartLinesRepository, IShoppingCartTotalRepository shoppingCartTotalRepository, IVisitorContext visitorContext, ISiteContext siteContext, IProductBundleRepository productBundleRepository, ISearchManager searchManager, IProductBundleRepository productBundleRepository1, IContext context)
            : base(storefrontContext, modelProvider, addToCartRepository, minicartRepository, promotionCodesRepository, shoppingCartLinesRepository, shoppingCartTotalRepository, visitorContext, context)
        {
            Assert.ArgumentNotNull(productBundleRepository, nameof(productBundleRepository));

            _searchManager           = searchManager;
            _productBundleRepository = productBundleRepository1;
            _visitorContext          = visitorContext;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tabInfo"></param>
        /// <param name="sm"></param>
        /// <returns></returns>
        public virtual IControlManager GenerateControlManager(WindowTabInfo tabInfo, ISearchManager sm)
        {
            // maybe null, saved in outer space
            //if (string.IsNullOrEmpty(tabInfo.BusinessLayerClassName))
            //{
            //    throw new ArgumentException("WindowTabInfo of " + tabInfo.Name + " 's BusinessLayerClassName must not be null!");
            //}
            if (string.IsNullOrEmpty(tabInfo.ControlManagerClassName))
            {
                throw new ArgumentException("WindowTabInfo of " + tabInfo.Identity + " 's ControlManagerClassName must not be null!");
            }
            IControlManager cm = null;
            switch (tabInfo.ControlManagerClassName.ToUpper())
            {
                case "TYPED":
                    cm = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.CreateGenericType(
                        Feng.Utils.ReflectionHelper.GetTypeFromName("Feng.Windows.Forms.ControlManager`1, Feng.Windows.Controller"), new Type[] { Feng.Utils.ReflectionHelper.GetTypeFromName(tabInfo.ModelClassName) }),
                        sm) as IControlManager;
                    break;
                case "UNTYPED":
                    cm = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName("Feng.Windows.Forms.ControlManager, Feng.Windows.Controller"),
                        sm) as IControlManager;
                    break;
                default:
                    cm = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(tabInfo.ControlManagerClassName), sm) as IControlManager;
                    break;
            }
            if (cm == null)
            {
                throw new ArgumentException("WindowTabInfo of " + tabInfo.Identity + " 's ControlManagerClassName is wrong!");
            }
            //cm.Name = windowInfo == null ? tabInfo.Name : windowInfo.Name;
            cm.Name = tabInfo.Identity;
            cm.DisplayManager.Name = tabInfo.Identity;

            SetGridPermissions(tabInfo, cm);

            return cm;
        }
        public Presenter(
            IView view,
            ISearchManager searchManager,
            ISearchHistory searchHistory,
            IUserDefinedSearches userDefinedSearches,
            ILogSourcesManager sourcesManager,
            IFiltersFactory filtersFactory,
            ISearchResultsPanelView searchResultsPanelView,
            LoadedMessages.IPresenter loadedMessagesPresenter,
            SearchResult.IPresenter searchResultPresenter,
            StatusReports.IPresenter statusReportFactory,
            SearchEditorDialog.IPresenter searchEditorDialog,
            SearchesManagerDialog.IPresenter searchesManagerDialog,
            IAlertPopup alerts
            )
        {
            this.view                    = view;
            this.searchManager           = searchManager;
            this.searchHistory           = searchHistory;
            this.filtersFactory          = filtersFactory;
            this.searchResultsPanelView  = searchResultsPanelView;
            this.loadedMessagesPresenter = loadedMessagesPresenter;
            this.searchResultPresenter   = searchResultPresenter;
            this.statusReportFactory     = statusReportFactory;
            this.sourcesManager          = sourcesManager;
            this.searchesManagerDialog   = searchesManagerDialog;
            this.alerts                  = alerts;
            this.quickSearchPresenter    = new QuickSearchTextBox.Presenter(view.SearchTextBox);
            this.searchEditorDialog      = searchEditorDialog;

            InvalidateSearchHistoryList();
            searchHistory.OnChanged += (sender, args) => InvalidateSearchHistoryList();

            sourcesManager.OnLogSourceAdded   += (sender, e) => UpdateSearchControls();
            sourcesManager.OnLogSourceRemoved += (sender, e) => UpdateSearchControls();

            UpdateSearchControls();
            UpdateUserDefinedSearchDependentControls(false);

            view.SetPresenter(this);

            quickSearchPresenter.OnSearchNow += (sender, args) =>
            {
                if (quickSearchPresenter.Text != "")
                {
                    DoSearch(reverseDirection: args.ReverseSearchModifier);
                }
            };
            quickSearchPresenter.OnCancelled += (sender, args) =>
            {
                bool searchCancelled = false;
                foreach (var r in searchManager.Results.Where(r => r.Status == SearchResultStatus.Active))
                {
                    r.Cancel();
                    searchCancelled = true;
                }
                if (!searchCancelled && InputFocusAbandoned != null)
                {
                    InputFocusAbandoned(this, EventArgs.Empty);
                }
            };
            quickSearchPresenter.SetSuggestionsHandler((sender, e) =>
            {
                if (e.Etag == searchListEtag)
                {
                    return;
                }
                foreach (var i in searchHistory.Items)
                {
                    var description = new StringBuilder();
                    GetUserFriendlySearchHistoryEntryDescription(i, description);
                    e.AddItem(new QuickSearchTextBox.SuggestionItem()
                    {
                        DisplayString = description.ToString(),
                        SearchString  = (i as ISimpleSearchHistoryEntry)?.Options.Template,
                        Category      = "recent searches",
                        Data          = i
                    });
                }
                foreach (var i in userDefinedSearches.Items)
                {
                    var description = new StringBuilder();
                    GetUserFriendlySearchHistoryEntryDescription(i, description);
                    e.AddItem(new QuickSearchTextBox.SuggestionItem()
                    {
                        DisplayString = description.ToString(),
                        LinkText      = "edit",
                        Category      = "Filters",
                        Data          = i
                    });
                }
                e.ConfigureCategory("Filters", linkText: "manage", alwaysVisible: true);
                e.Etag = searchListEtag;
            });
            quickSearchPresenter.OnCurrentSuggestionChanged += (sender, e) =>
            {
                var datum = quickSearchPresenter.CurrentSuggestion?.Data;
                var searchHistoryEntry = datum as ISimpleSearchHistoryEntry;
                if (searchHistoryEntry != null)
                {
                    ReadControlsFromSelectedHistoryEntry(searchHistoryEntry);
                }
                UpdateUserDefinedSearchDependentControls(
                    datum is IUserDefinedSearch || datum is IUserDefinedSearchHistoryEntry);
            };
            quickSearchPresenter.OnSuggestionLinkClicked += (sender, e) =>
            {
                var uds = e.Suggestion.Data as IUserDefinedSearch;
                if (uds == null)
                {
                    return;
                }
                searchEditorDialog.Open(uds);
            };
            quickSearchPresenter.OnCategoryLinkClicked += (sender, e) =>
            {
                HandleSearchesManagerDialog();
            };
            userDefinedSearches.OnChanged += (sender, e) =>
            {
                InvalidateSearchHistoryList();
            };
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tabInfo"></param>
        /// <param name="sm"></param>
        /// <returns></returns>
        public virtual IDisplayManager GenerateDisplayManager(WindowTabInfo tabInfo, ISearchManager sm)
        {
            IDisplayManager dm;
            if (!string.IsNullOrEmpty(tabInfo.DisplayManagerClassName))
            {
                switch (tabInfo.DisplayManagerClassName.ToUpper())
                {
                    case "TYPED":
                        dm = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.CreateGenericType(
                            Feng.Utils.ReflectionHelper.GetTypeFromName("Feng.Windows.Forms.DisplayManager`1, Feng.Windows.Controller"), new Type[] { Feng.Utils.ReflectionHelper.GetTypeFromName(tabInfo.ModelClassName) }),
                            sm) as IDisplayManager;
                        break;
                    case "UNTYPED":
                        dm = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName("Feng.Windows.Forms.DisplayManager, Feng.Windows.Controller"),
                            sm) as IDisplayManager;
                        break;
                    default:
                        dm = Feng.Utils.ReflectionHelper.CreateInstanceFromType(Feng.Utils.ReflectionHelper.GetTypeFromName(tabInfo.DisplayManagerClassName), sm) as IDisplayManager;
                        break;
                }
                if (dm == null)
                {
                    throw new ArgumentException("WindowTabInfo of " + tabInfo.Identity + " 's DisplayManagerClassName is wrong!");
                }
            }
            else if (!string.IsNullOrEmpty(tabInfo.ControlManagerClassName))
            {
                dm = GenerateControlManager(tabInfo, sm).DisplayManager;
            }
            else
            {
                throw new ArgumentException("WindowTabInfo of " + tabInfo.Identity + " 's DisplayManagerClassName or ControlManagerClassName must not be null!");
            }
            // Why?
            //dm.Name = windowInfo == null ? tabInfo.Name : windowInfo.Name;
            dm.Name = tabInfo.Identity;

            return dm;
        }
Exemple #43
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sm">查找管理器</param>
 protected AbstractDisplayManager(ISearchManager sm)
     : base(sm)
 {
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="dmParent"></param>
        /// <param name="searchExpression"></param>
        /// <param name="searchOrder"></param>
        /// <param name="innerSearchManager"></param>
        public SearchManagerProxyDetailInMaster(IDisplayManager dmParent, string searchExpression, string searchOrder, ISearchManager innerSearchManager)
            : base(dmParent)
        {
            m_searchExpression = searchExpression;
            m_searchOrder = searchOrder;

            m_innerSearchManager = innerSearchManager;
        }
Exemple #45
0
 public static extern int CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter, Int32 dwClsContext, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out ISearchManager diaDataSourceInterface);
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sm"></param>
 public ControlManagerBindingSource(ISearchManager sm)
     : base(new DisplayManagerBindingSource(sm))
 {
     m_bs = (this.DisplayManager as DisplayManagerBindingSource).BindingSource;
 }
 public ShoppingCartLineJsonResult(IStorefrontContext storefrontContext, IModelProvider modelProvider, ISearchManager searchManager)
     : base(storefrontContext, modelProvider, searchManager)
 {
     Assert.ArgumentNotNull((object)modelProvider, nameof(modelProvider));
     this.ModelProvider = modelProvider;
 }
 public void EnableInvalidateAfterSearch(ISearchManager sm, Control invalidateControl)
 {
     sm.DataLoaded += new EventHandler<DataLoadedEventArgs>(searchManager2_DataLoaded);
     m_progressInvalidate[sm] = invalidateControl;
 }
 public StoresRepository(IModelProvider modelProvider, IStorefrontContext storefrontContext, ISiteContext siteContext, ISearchInformation searchInformation, ISearchManager searchManager, ICatalogManager catalogManager, ICatalogUrlManager catalogUrlManager) : base(modelProvider, storefrontContext, siteContext, searchInformation, searchManager, catalogManager, catalogUrlManager)
 {
     _nearestStoreManager = new NearestStoreManager();
 }
 public OrderLineVariantRenderingModel(IStorefrontContext storefrontContext, ISearchManager searchManager, IContext context)
     : base(storefrontContext, searchManager, context)
 {
 }
Exemple #51
0
 public SpotifyServices(ISearchManager searchManager, ITrackHandler trackHandler, IEventAggregator eventAggregator)
 {
     EventAggregator = eventAggregator;
     _searchManager = searchManager;
     _trackHandler = trackHandler;
 }
 public EktronSearcher(ISearchManager searchManager)
 {
     _searchManager = searchManager;
 }
 /// <summary>
 /// 创建ISearchControlCollection
 /// </summary>
 /// <param name="sm"></param>
 /// <returns></returns>
 public virtual ISearchControlCollection CreateSearchControlCollection(ISearchManager sm)
 {
     ISearchControlCollection ret = new SearchControlCollection();
     ret.ParentManager = sm;
     return ret;
 }
 public CollectionTests()
 {
     _idProvider = new IdProvider();
     _searchManager = Substitute.For<ISearchManager>();
     _executor = new EktronQueryExecutor(_idProvider, _searchManager);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sm"></param>
 public DisplayManager(ISearchManager sm)
     : base(sm)
 {
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sm"></param>
 public ControlManager(ISearchManager sm)
     : base(new DisplayManager(sm))
 {
 }
 public SearchController(ISearchManager searchManager, ICommandBus commandBus)
     : base(commandBus)
 {
     this.searchManager = searchManager;
 }
 //protected void AssociateButtonAdd(Button button, IControlManager cm)
 //{
 //    cm.StateControls.Add(new StateControl(button, true));
 //    button.Click += new EventHandler((sender, e) =>
 //    {
 //        cm.AddNew();
 //        UpdateContent(m_cm, m_controlGroupName);
 //        (m_cm.DisplayManager.CurrentItem as 任务).任务来源 = 任务来源.手工;
 //        (m_cm.DisplayManager.CurrentItem as 任务).IsActive = true;
 //    });
 //}
 public static void RestrictToUserAccess(ISearchManager sm, string adminName)
 {
     if (!Authority.AuthorizeByRule("R:" + adminName))
     {
         string userRestriction = string.Format("CreatedBy = {0}", SystemConfiguration.UserName);
         if (string.IsNullOrEmpty(sm.AdditionalSearchExpression))
         {
             sm.AdditionalSearchExpression = userRestriction;
         }
         else
         {
             sm.AdditionalSearchExpression = "(" + sm.AdditionalSearchExpression + ")"
                 + " AND " + userRestriction;
         }
     }
 }
 public DeveloperController(IDeveloperRepository developerRepository, IHostingEnvironment environment, ISearchManager searchManager)
 {
     this.developerRepository = developerRepository;
     this.environment = environment;
     this.searchManager = searchManager;
 }
 /// <summary>
 /// Contructor that take one parameter
 /// Shwetha
 /// </summary>
 /// <param name="sm"></param>
 public SearchProgramController(ISearchManager sm, IDollarManager dm)
 {
     this.dm = dm;
     this.sm = sm;
 }