コード例 #1
0
        private void SavePage(SurveyFeature.Business.Page page)
        {
            page.PageTitle   = txtPageTitle.Text;
            page.PageEnabled = chkPageEnabled.Checked;

            if (surveyPageGuid == Guid.Empty)
            {
                //new question so we need to know the page it will live on
                page.SurveyGuid = surveyGuid;
            }

            page.Save();
        }
コード例 #2
0
        void grdSurveyPages_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            List <SurveyFeature.Business.Page> pages = SurveyFeature.Business.Page.GetAll(surveyGuid);
            Guid currentPageGuid = new Guid(e.CommandArgument.ToString());

            SurveyFeature.Business.Page currentPage = null;

            SurveyFeature.Business.Page swapPage;

            int currentItemIndex = -1;
            int i = 0;

            foreach (SurveyFeature.Business.Page p in pages)
            {
                if (p.SurveyPageGuid == currentPageGuid)
                {
                    currentPage      = p;
                    currentItemIndex = i;
                }

                i += 1;
            }

            if (currentPage == null)
            {
                return;
            }

            switch (e.CommandName)
            {
            case "up":

                if (currentItemIndex > 0)
                {
                    swapPage = pages[currentItemIndex - 1];

                    currentPage.PageOrder = currentItemIndex - 1;
                    swapPage.PageOrder    = currentItemIndex;

                    currentPage.Save();
                    swapPage.Save();
                }

                break;

            case "down":

                if (currentItemIndex < pages.Count - 1)
                {
                    swapPage = pages[currentItemIndex + 1];

                    currentPage.PageOrder = currentItemIndex + 1;
                    swapPage.PageOrder    = currentItemIndex;

                    currentPage.Save();
                    swapPage.Save();
                }

                break;

            case "delete":
                //ImageButton button = (ImageButton)e.CommandSource;
                SurveyFeature.Business.Page.Delete(currentPageGuid);
                break;
            }

            WebUtils.SetupRedirect(this, Request.RawUrl);
            //BindGrid();
        }