private void PrintOutput()
        {
            DateTime dt         = DateTime.Now;
            bool     cntVisible = true;

            if (dt < dataObjectSurvey.StartDate || dt > dataObjectSurvey.EndDate || dataObjectSurvey.ShowState != ObjectShowState.Published)
            {
                cntVisible = false;
            }
            if (cntVisible || isUserAdminOrOwner)
            {
                if (cntVisible)
                {
                    dataObjectSurvey.AddViewed(UserDataContext.GetUserDataContext());

                    if (UserProfile.Current.UserId != dataObjectSurvey.UserID.Value)
                    {
                        IncentivePointsManager.AddIncentivePointEvent(
                            dataObjectSurvey.ObjectType.ToString().ToUpper() + "_VIEWED", UserDataContext.GetUserDataContext(),
                            dataObjectSurvey.ObjectID.Value.ToString());
                    }
                }
                if (isUserAdminOrOwner)
                {
                    //Admin will see a special div
                    if (!cntVisible)
                    {
                        pnlOut.CssClass = "CSB_CNT_public_invisible";
                    }
                    else
                    {
                        pnlOut.CssClass = "CSB_CNT_public_OK";
                    }
                }
                RTTM.Visible = false;
                if (dataObjectSurvey != null)
                {
                    foreach (var tooltipId in AdWordHelper.GetCampaignObjectIds(dataObjectSurvey.ObjectID.Value))
                    {
                        RTTM.TargetControls.Add(tooltipId, true);
                        RTTM.Visible = true;
                    }
                }
                litHeader.Text = string.Format("<div class='CSB_Survey_Header'>{0}</div>", dataObjectSurvey.HeaderLinked);
                litFooter.Text = string.Format("<div class='CSB_Survey_Footer'>{0}</div>", dataObjectSurvey.FooterLinked);
                var surveyPages = from allPages in surveyDataClassDataContext.hitbl_Survey_Page_SPGs.Where(x => x.OBJ_ID == dataObjectSurvey.ObjectID.Value)
                                  orderby allPages.SortNumber ascending
                                  select allPages;
                countSurveyPages = surveyPages.Count();

                foreach (hitbl_Survey_Page_SPG surveyPage in surveyPages)
                {
                    surveyPagesTitle.Add(surveyPage.Title);
                    RadPageView rpv = new RadPageView();
                    rpv.ID = string.Format("rpv{0}", surveyPage.SPG_ID);
                    rpv.Controls.Add(PrintQuestionAndAnswers(surveyPage));
                    radMP.PageViews.Add(rpv);
                }
                AddPager();
            }
        }
Beispiel #2
0
        private void PrintOutput()
        {
            RTTM.Visible    = false;
            RTTMIMG.Visible = false;
            if (dataObjectProduct != null)
            {
                foreach (var tooltipId in AdWordHelper.GetCampaignObjectIds(dataObjectProduct.ObjectID.Value))
                {
                    RTTM.TargetControls.Add(tooltipId, true);
                    RTTM.Visible = true;
                }
            }


            prodPictures =
                DataObjects.Load <DataObjectPicture>(new QuickParameters
            {
                ObjectType     = Helper.GetObjectTypeNumericID("Picture"),
                RelationParams =
                    new RelationParams
                {
                    ParentObjectID = dataObjectProduct.ObjectID,
                },
                ShowState  = ObjectShowState.Published,
                Amount     = 0,
                Direction  = QuickSortDirection.Asc,
                PageNumber = 0,
                PageSize   = 999999,
                SortBy     = QuickSort.RelationSortNumber,
                Udc        = UserDataContext.GetUserDataContext()
            });
            if (prodPictures.Count > 0)
            {
                LitContent.Text = string.Format("{0}", dataObjectProduct.ProductTextLinked);

                Image img = new Image();
                img.ImageUrl      = string.Format("{0}{1}", SiteConfig.MediaDomainName, prodPictures[0].GetImage(PictureVersion.L));
                img.AlternateText = prodPictures[0].Title;
                img.ToolTip       = prodPictures[0].Title;
                img.Width         = 305;
                ProdImg1.Controls.Add(img);

                ProdImg1.Visible = true;


                for (int i = 1; i < prodPictures.Count; i++)
                {
                    var    picture = prodPictures[i];
                    string imageId = "Img_" + picture.ObjectID.Value.ToString();
                    RTTMIMG.TargetControls.Add(imageId, true);
                    RTTMIMG.Visible = true;
                    LiteralControl image =
                        new LiteralControl(
                            string.Format(
                                "<div style=\"float:left;width:110px;\"><div><img class ='articlepic' src=\"{0}{1}\" id=\"{2}\" /></div><div>{3}</div></div>",
                                SiteConfig.MediaDomainName, picture.GetImage(PictureVersion.XS), imageId, picture.Title));
                    PhProdImgs.Controls.Add(image);
                }
            }
            else
            {
                ProdImg1.Visible = false;
                LitContent.Text  = string.Format("{0}", dataObjectProduct.ProductTextLinked);
            }
            if (dataObjectProduct.Price1.HasValue && dataObjectProduct.Price2.HasValue && dataObjectProduct.Price1 != dataObjectProduct.Price2)
            {
                litSM.Text           = string.Format("Sie sparen CHF {0} ", (dataObjectProduct.Price1.Value - dataObjectProduct.Price2.Value).ToString("0.00"));
                PnlSpecPrice.Visible = true;
            }
            else
            {
                litSM.Visible = false;
            }
            litP1.Text      = dataObjectProduct.Price1.HasValue ? dataObjectProduct.Price1.Value.ToString("0.00") : "0.00";
            litP2.Text      = dataObjectProduct.Price2.HasValue ? dataObjectProduct.Price2.Value.ToString("0.00") : "0.00";
            LbtnAdd.ToolTip = GuiLanguage.GetGuiLanguage("dataObjectProductuct").GetString("TooltipAddToCart");
        }