Exemple #1
0
 public void Setup()
 {
     unitOfWork        = new UnitOfWork();
     appViewModel      = new Mock <IApplicationViewModel <Administrator> >();
     dispatcherWrapper = new DispatcherWrapper();
     parentPage        = new ParentPage();
     security          = new Security();
     viewModel         = new DoctorsViewModel(unitOfWork, appViewModel.Object, dispatcherWrapper, security)
     {
         ParentPage = parentPage
     };
 }
Exemple #2
0
 public void Setup()
 {
     unitOfWork        = new UnitOfWork();
     appViewModel      = new Mock <IApplicationViewModel <DCPersonnel> >();
     dispatcherWrapper = new DispatcherWrapper();
     parentPage        = new ParentPage();
     security          = new Security();
     viewModel         = new BloodDonationRequestsViewModel(unitOfWork, appViewModel.Object, dispatcherWrapper, security)
     {
         ParentPage = parentPage
     };
 }
Exemple #3
0
 public void PerformActionAndWaitForPageToLoad(Action <DropdownWebElement> action, DropdownWebElement webElement = null)
 {
     action(webElement ?? this);
     if (ParentPage is ContainerBasePage)
     {
         (ParentPage as ContainerBasePage).WaitForPageToLoad();
     }
     else
     {
         ParentPage.WaitForPageToLoad();
     }
 }
Exemple #4
0
        /// <summary>
        /// 判断本任务以及所有子任务是否完毕
        /// 如果完毕则通知父页
        /// </summary>
        /// <param name="snifferManager"></param>
        public void PageDone(SnifferManager snifferManager)
        {
            //snifferManager?.OnPageDoneEventHandler(this);
            //if (this.Config.Plug != null)
            //    this.Config.Plug.OnPageDoneEventHandler(this);

            //所有子页已完成,则标注已完成状态
            if (SubPages.All(x => x.Done && x.SnifferState == SnifferState.Complate))
            {
                SnifferState = SnifferState.Complate;
            }

            if (ParentPage == null)
            {
                if (SubPages.All(x => x.Done && x.SnifferState == SnifferState.Complate))
                {
                    //触发顶级页采集完毕事件
                    snifferManager?.OnRootPageDoneEventHandler(this, snifferManager.Context);
                    if (this.Config.Plug != null)
                    {
                        this.Config.Plug.OnRootPageDoneEventHandler(this, snifferManager.Context);
                    }
                }
            }
            else
            {
                //当前页以及当前页的所有子页完毕
                if (SnifferState == SnifferState.Complate)
                {
                    if (Config.PageType == PageType.DetailPage)
                    {
                        //当前详细页以及详细页内容采集完毕
                        snifferManager?.OnDetailPageDoneEventHandler(this as DetailPage, snifferManager.Context);
                        if (this.Config.Plug != null)
                        {
                            this.Config.Plug.OnDetailPageDoneEventHandler(this as DetailPage, snifferManager.Context);
                        }
                    }
                    else
                    {
                        //列表页以及所有子页采集完毕
                        snifferManager?.OnListPageDoneEventHandler(this as ListPage, snifferManager.Context);
                        if (this.Config.Plug != null)
                        {
                            this.Config.Plug.OnListPageDoneEventHandler(this as ListPage, snifferManager.Context);
                        }
                    }

                    //触发父页 PageDone
                    ParentPage.PageDone(snifferManager);
                }
            }
        }
Exemple #5
0
        public IObjectContainer AddMasterPageObject(Guid masterPageGuid, Guid viewGuid, double x = 0, double y = 0)
        {
            IObjectContainer container = ParentPage.AddMasterPageObject(masterPageGuid, viewGuid);

            IMasterPage masterPage = ParentDocument.MasterPages[masterPageGuid];

            masterPage.Open();

            PageView masterPageView = masterPage.PageViews[viewGuid] as PageView;

            if (masterPageView == null)
            {
                masterPageView = masterPage.PageViews[ParentDocument.AdaptiveViewSet.Base.Guid] as PageView;
            }

            double xDelta = masterPageView.PageViewStyle.X - x;
            double yDelta = masterPageView.PageViewStyle.Y - y;

            foreach (Widget widget in container.WidgetList)
            {
                // Set the created view as the current view because this is the first time when the widget
                // is added in the current document.
                widget.CreatedViewGuid = _viewGuid;

                // Set this flag to false. PlaceWidgetInternal method will set this flag base on checking
                // if this is base view.
                widget.HasBeenPlacedInBaseView = false;

                // Get widget style in this view.
                IWidgetStyle widgetViewStyle = widget.GetWidgetStyle(_viewGuid);

                // Widgets in master page should have same relative location, so make them have the same delta.
                widgetViewStyle.X -= xDelta;
                widgetViewStyle.Y -= yDelta;

                if (widget is IHamburgerMenu)
                {
                    IHamburgerMenu       menu   = widget as IHamburgerMenu;
                    IHamburgerMenuButton button = menu.MenuButton;

                    IWidgetStyle buttonViewStyle = button.GetWidgetStyle(_viewGuid);
                    buttonViewStyle.X -= xDelta;
                    buttonViewStyle.Y -= yDelta;
                }

                PlaceWidgetInternal(widget, true);
            }

            // Master Page doesn't contain masters, so we don't handle container.MasterList.

            return(container);
        }
Exemple #6
0
        /// <summary>
        /// Gets all the pages in the current hierarchy
        /// </summary>
        /// <returns></returns>
        public List <PageCache> GetPageHierarchy()
        {
            var pages = new List <PageCache> {
                this
            };

            if (ParentPage != null)
            {
                ParentPage.GetPageHierarchy().ForEach(p => pages.Add(p));
            }

            return(pages);
        }
Exemple #7
0
        public virtual void Close(bool destroy = false)
        {
            Hide();

            if (destroy)
            {
                ParentPage.RemoveNodes(new List <Node>()
                {
                    this
                });
                Destroy(this.gameObject);
            }
        }
Exemple #8
0
        /// <summary>
        /// Also waits for dynamic contents to load (updater overlay to dissapear, pending ajax calls to finish) - due to some controls triggering overlay loader or ajax calls after being edited
        /// </summary>
        /// <param name="waitForItself"></param>
        /// <param name="waitForDynamicContentLoad"></param>
        public void Blur(bool waitForItself = true, bool waitForDynamicContentLoad = true)      //param waitForItself must be default true because stale test needs to happen when it's used directly on control
        {
            if (waitForItself)
            {
                WaitForElementVisibleAndEnabled();
            }

            Element.SendKeys("\t");             //Keys.Tab

            if (waitForDynamicContentLoad)
            {
                ParentPage.WaitForDynamicContentToLoad();
            }
        }
 public void Setup()
 {
     unitOfWork        = new UnitOfWork();
     appViewModel      = new ApplicationViewModel <Model.Donor>();
     appViewModel.User = new Model.Donor {
         PersonID = 0
     };
     dispatcherWrapper = new Core.UnitTests.Dependencies.DispatcherWrapper();
     parentPage        = new ParentPage();
     security          = new Security.Security();
     viewModel         = new ProfileViewModel(unitOfWork, appViewModel, dispatcherWrapper, security)
     {
         ParentPage = parentPage
     };
 }
Exemple #10
0
        /// <summary>
        /// Also waits for dynamic contents to load (updater overlay to dissapear, pending ajax calls to finish) - due to some controls triggering overlay loader or ajax calls after being edited
        /// </summary>
        /// <param name="waitForItself"></param>
        /// <param name="waitForDynamicContentLoad"></param>
        public void Clear(bool waitForItself = true, bool waitForDynamicContentLoad = true) //param waitForItself must be default true because stale test needs to happen when it's used directly on control
        {
            if (waitForItself)
            {
                WaitForElementVisibleAndEnabled();
            }

            //			this.Element.Click();
            Element.Clear();

            if (waitForDynamicContentLoad)
            {
                ParentPage.WaitForDynamicContentToLoad();
            }
        }
    void ShowHideTitle()
    {
        var title = ParentPage.GetNode <TitleTestNode>();

        if (title != null)
        {
            if (title.IsShown())
            {
                title.Close();
            }
            else
            {
                title.Open();
            }
        }
    }
Exemple #12
0
            public override Panel GenerateMainControl(int id)
            {
                Panel       panel      = base.GenerateMainControl(id);
                MultiToggle buttonList = (MultiToggle)ParentPage.LoadControl("~/MultiToggle.ascx");

                buttonList.HolderPanel.Attributes.Add("style", "margin-top:5px;margin-bottom:5px");
                buttonList.HolderPanel.Attributes.Add("data-toggle", "tooltip");
                buttonList.HolderPanel.Attributes.Add("data-placement", "right");
                buttonList.HolderPanel.Attributes.Add("data-title", Description);
                buttonList.AddOption(WhenTrue);
                buttonList.AddOption(WhenFalse);
                buttonList.ID = "BooleanEntryBox-" + id;
                panel.Controls.Add(buttonList);
                BooleanToggle = buttonList;
                panel.Controls.Add(new LiteralControl("<br/>"));
                return(panel);
            }
Exemple #13
0
        public string GetQuoteId()
        {
            string quoteId = "DB040ECD-5ED4-E211-9BE0-000C299FFE7D"; // Debug

            if (ParentPage.Ui != null)
            {
                string guid = ParentPage.Data.Entity.GetId();
                if (guid != null)
                {
                    quoteId = guid.Replace("{", "").Replace("}", "");
                }

                this._transactionCurrencyId = ((Lookup[])ParentPage.GetAttribute("transactioncurrencyid").GetValue())[0].Id;
            }

            return(quoteId);
        }
Exemple #14
0
        private void InitControls()
        {
            ValidationErrorSummary.HeaderText = ParentPage.GetTranslation("PleaseFixTheFollowingErrors");

            rqVFirstName.Text        = rqVFirstLastName.Text = rqVFirstEmail.Text = rqVAddress1.Text =
                rqVTown.Text         = rqVPostCode.Text = rqVAddress1.Text = rqVTown.Text = rqVPostCode.Text =
                    cstVCountry.Text = ParentPage.GetTranslation("Required");
            cstVTerms.Text           = "*";

            rqVFirstName.ErrorMessage     = ParentPage.GetTranslation("Pleaseenteryourfirstname");
            rqVFirstLastName.ErrorMessage = ParentPage.GetTranslation("Pleaseenteryourlastname");
            rqVFirstEmail.ErrorMessage    = ParentPage.GetTranslation("Pleaseenteryouremailaddress");
            regexEmailValid.ErrorMessage  = ParentPage.GetTranslation("Pleaseenteryouremailaddress");
            rqVAddress1.ErrorMessage      = ParentPage.GetTranslation("Pleaseenteryouraddress");
            rqVTown.ErrorMessage          = ParentPage.GetTranslation("Pleasenteryourtowncity");
            rqVPostCode.ErrorMessage      = ParentPage.GetTranslation("Pleaseenteryourpostzipcode");
            cstVCountry.ErrorMessage      = ParentPage.GetTranslation("Booking_SelectCountryError");
            cstVTerms.ErrorMessage        = ParentPage.GetTranslation("Pleasereadandagreetotandc");
        }
Exemple #15
0
            void Handle(Input.Delete Action)
            {
                Db.Transact(() => {
                    var messages = Db.SQL <ChatMessage>("SELECT m FROM Simplified.Ring6.ChatMessage m WHERE m.\"Group\" = ?", Data);

                    foreach (ChatMessage message in messages)
                    {
                        var relations = Db.SQL <Relation>("SELECT m FROM Simplified.Ring1.Relation m WHERE m.ToWhat = ?", message);
                        foreach (Relation relation in relations)
                        {
                            relation.WhatIs?.Delete();
                            relation.Delete();
                        }
                        message.Delete();
                    }

                    Data.Delete();
                });

                ParentPage.RefreshData();
            }
        private bool CheckPersonBProject(string _p)
        {
            if (_p.Length == 0)
            {
                return(false);
            }

            //Person p = new Person(_p);
            var p = ParentPage.GetObjectById(typeof(PersonOld), _p) as PersonOld;

            if (p == null || p.Unavailable)
            {
                return(false);
            }
            if (p.BusinessProjectID <= 0)
            {
                return(false);
            }

            return(true);
        }
Exemple #17
0
        public IObjectContainer AddCustomObject(ICustomObject customObject, double x = 0, double y = 0)
        {
            IObjectContainer container = ParentPage.AddCustomObject(customObject);

            foreach (Widget widget in container.WidgetList)
            {
                // Set the created view as the current view because this is the first time when the widget
                // is added in the current document.
                widget.CreatedViewGuid = _viewGuid;

                // Set this flag to false. PlaceWidgetInternal method will set this flag base on checking
                // if this is base view.
                widget.HasBeenPlacedInBaseView = false;

                // Get widget style in this view.
                IWidgetStyle widgetViewStyle = widget.GetWidgetStyle(_viewGuid);

                // Widgets in library should have same relative location, so make them have the same delta.
                widgetViewStyle.X += x;
                widgetViewStyle.Y += y;

                if (widget is IHamburgerMenu)
                {
                    IHamburgerMenu       menu   = widget as IHamburgerMenu;
                    IHamburgerMenuButton button = menu.MenuButton;

                    IWidgetStyle buttonViewStyle = button.GetWidgetStyle(_viewGuid);
                    buttonViewStyle.X += x;
                    buttonViewStyle.Y += y;
                }

                PlaceWidgetInternal(widget, true);
            }

            // Custom object doesn't contain masters, so we don't handle container.MasterList.

            return(container);
        }
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            try
            {
                string budgetNextState = BudgetStates.GetBudgetNextState(BudgetState);
                switch (BudgetType)
                {
                case 0:
                    ApproveInitialBudget(budgetNextState);
                    break;

                case 1:
                    ApproveRevisedBudget(budgetNextState);
                    break;

                case 2:
                    ApproveCompletionBudget(budgetNextState);
                    break;

                default:
                    throw new IndException("Unknown budget type: " + BudgetType.ToString());
                }
            }
            catch (IndException ex)
            {
                ReportControlError(ex);
                return;
            }
            catch (Exception ex)
            {
                ReportControlError(new IndException(ex));
                return;
            }

            //navigate back to followup - Do not put this in try!!!!
            ParentPage.ResponseRedirect("~/Pages/Budget/FollowUpBudget/FollowUpBudget.aspx?BudgetType=" + BudgetType + "&BudgetVersion=" + BudgetVersion);
        }
        protected void btnReject_Click(object sender, EventArgs e)
        {
            try
            {
                switch (BudgetType)
                {
                case 0:
                    RejectInitialBudget();
                    break;

                case 1:
                    RejectRevisedBudget();
                    break;

                case 2:
                    RejectCompletionBudget();
                    break;

                default:
                    throw new IndException("Unknown budget type: " + BudgetType.ToString());
                }
            }
            catch (IndException ex)
            {
                ReportControlError(ex);
                return;
            }
            catch (Exception ex)
            {
                ReportControlError(new IndException(ex));
                return;
            }

            //navigate back to followup
            ParentPage.ResponseRedirect("~/Pages/Budget/FollowUpBudget/FollowUpBudget.aspx?BudgetType=" + BudgetType + "&BudgetVersion=" + BudgetVersion);
        }
 protected override void OnPreRender(EventArgs e)
 {
     try
     {
         base.OnPreRender(e);
         AjaxManager.AjaxSettings.AddAjaxSetting(this, ParentPage.pnlErrors);
         if (!Page.ClientScript.IsOnSubmitStatementRegistered(ParentPage.GetType(), "ResizePopUp"))
         {
             this.Page.ClientScript.RegisterOnSubmitStatement(ParentPage.GetType(), "ResizePopUp", "SetPopUpHeight(); try{if(Page_IsValid) this.disabled=true;}catch(e){}");
         }
     }
     catch (IndException exc)
     {
         ShouldContinue = false;
         _ParentGenericUserControl.ReportControlError(exc);
         return;
     }
     catch (Exception ex)
     {
         ShouldContinue = false;
         _ParentGenericUserControl.ReportControlError(new IndException(ex));
         return;
     }
 }
Exemple #21
0
            public override Panel GenerateMainControl(int id)
            {
                Panel   panel = base.GenerateMainControl(id);
                TextBox box   = new TextBox();

                box.Enabled  = true;
                box.ID       = "WebPortEntryBox-" + id;
                box.CssClass = "form-control";
                box.Attributes.Add("style", "margin-top:5px;margin-bottom:5px");
                box.Attributes.Add("data-toggle", "tooltip");
                box.Attributes.Add("data-placement", "right");
                box.Attributes.Add("data-title", Description);
                box.Attributes.Add("type", "number");
                box.Attributes.Add("min", ushort.MinValue.ToString());
                box.Attributes.Add("max", ushort.MaxValue.ToString());
                panel.Controls.Add(box);
                RangeValidator validator = new RangeValidator();

                validator.Type              = ValidationDataType.Integer;
                validator.MinimumValue      = ushort.MinValue.ToString();
                validator.MaximumValue      = ushort.MaxValue.ToString();
                validator.Enabled           = true;
                validator.ControlToValidate = box.ID;
                panel.Controls.Add(validator);
                MultiToggle buttonList = (MultiToggle)ParentPage.LoadControl("~/MultiToggle.ascx");

                buttonList.AddOption("Forward port");
                buttonList.AddOption("Don't forward");
                buttonList.ID = "WebPortBooleanBox-" + id;
                panel.Controls.Add(buttonList);

                PortBox       = box;
                ForwardToggle = buttonList;
                panel.Controls.Add(new LiteralControl("<br/>"));
                return(panel);
            }
Exemple #22
0
 public IObjectContainer BreakMaster(Guid masterGuid)
 {
     return(ParentPage.BreakMaster(masterGuid));
 }
Exemple #23
0
 public string GetSeoTitle() => ParentPage == null ? Title : $"{ParentPage.GetSeoTitle()} - {Title}";
Exemple #24
0
 public void AddGroup(IGroup group)
 {
     ParentPage.AddGroup(group);
 }
Exemple #25
0
 public void DeleteGroup(Guid groupGuid)
 {
     ParentPage.DeleteGroup(groupGuid);
 }
Exemple #26
0
 public void Ungroup(Guid groupGuid)
 {
     ParentPage.Ungroup(groupGuid);
 }
Exemple #27
0
 public IGroup CreateGroup(List <Guid> guidList)
 {
     return(ParentPage.CreateGroup(guidList));
 }
Exemple #28
0
 public void AddMaster(IMaster master)
 {
     ParentPage.AddMaster(master);
     PlaceMasterInternal(master as Master, true);
 }
Exemple #29
0
        private void SplitPage()
        {
#if DUMP_INSERTS
            System.Diagnostics.Trace.WriteLine("Split page #" + this.RecordNo);
#endif
            var ndxFile = (NdxFile)mHolder.mFile;
            // split needed (on save)
            int mid = EntriesCount / 2;
            if (ParentPage == null)
            {
                ParentPage = (NdxPage)ndxFile.NewPage(null);

                var rootEntry = new NdxEntry();
                var lastEntry = GetEntry(EntriesCount - 1);
                rootEntry.DbfRecordNo       = lastEntry.DbfRecordNo;
                rootEntry.Fields            = lastEntry.Fields.Clone();
                rootEntry.LowerPageRecordNo = this.RecordNo;

                ParentPage.EntriesClear();
                ParentPage.EntriesInsert(0, rootEntry);
                ndxFile.mNdxHeader.StartingPageRecordNo = ParentPage.RecordNo;

                //ParentPage.mNbChildEntries = mNbChildEntries;
                ParentPage.mIsModified = true;
#if DUMP_INSERTS
                System.Diagnostics.Trace.WriteLine("  Create new parent page #" + mParentPage.RecordNo);
                mParentPage.Dump("      ");
#endif
            }

            var newPage = (NdxPage)ndxFile.NewPage(ParentPage);
            newPage.EntriesClear();
            newPage.mIsModified = true;
            newPage.ParentPage  = ParentPage;

            for (int i = 0; i < mid; i++)
            {
                //mNbChildEntries = mNbChildEntries;
                newPage.EntriesInsert(i, GetEntry(i));
                var lowerPageRecordNo = GetEntry(i).LowerPageRecordNo;
                if (lowerPageRecordNo != UInt32.MaxValue)
                {
                    var ndxPage2 = ndxFile.InternalGetPage(
                        ParentPage,
                        lowerPageRecordNo,
                        /* returnNullIfNotInCache */ true) as NdxPage;
                    if (ndxPage2 != null)
                    {
                        ndxPage2.ParentPage = newPage;
                    }
                }
            }
            EntriesRemoveRange(0, mid);

            var midEntry    = newPage.GetEntry(mid - 1);
            var newMidEntry = new NdxEntry()
            {
                DbfRecordNo       = midEntry.DbfRecordNo,
                LowerPageRecordNo = newPage.RecordNo,
                Fields            = midEntry.Fields.Clone()
            };

#if DUMP_INSERTS
            System.Diagnostics.Trace.WriteLine("  newPage #" + newPage.RecordNo);
            newPage.Dump("      ");

            System.Diagnostics.Trace.WriteLine("  this page #" + RecordNo);
            Dump("      ");
#endif
            int midEntryPos = ParentPage.FindInsertPos(newMidEntry, ndxFile);
            ParentPage.InsertInThisPage(newMidEntry, midEntryPos);
        }
Exemple #30
0
 public void DeleteMaster(Guid masterGuid)
 {
     ParentPage.DeleteMaster(masterGuid);
 }