Esempio n. 1
0
        /// <summary>
        /// Get the number of incentive points
        /// </summary>
        internal static int GetIncentivePoints(Guid userId, Business.Dialog dialog)
        {
            int incentivePoints = 0;

            try
            {
                List <IncentivePoint> points = IncentivePointsManager.GetIncentivePointsHistory(userId);
                foreach (IncentivePoint point in points)
                {
                    incentivePoints += point.TotalPoints;
                }
            }
            finally
            {
            }
            return(incentivePoints);
        }
Esempio n. 2
0
        protected void OnSaveClick(object sender, EventArgs e)
        {
            Page.Validate();

            if (!string.IsNullOrEmpty(Request.Form["codeBox"]))
            {
                PnlError.Visible = true;
                LitError.Text    = GuiLanguage.GetGuiLanguage("Pages.Popups.WebUI.Base").GetString("MessageInvisibleTextBoxCaptcha");
            }
            else if (Page.IsValid)
            {
                DataObjectForumTopic forumTopic = DataObject.Load <DataObjectForumTopic>(objectId);

                bool isCommunityMember;
                bool isCommunityOwner = Community.GetIsUserOwner(UserProfile.Current.UserId, forumTopic.CommunityID.Value, out isCommunityMember);

                if (((forumTopic.TopicItemCreationUsers == CommunityUsersType.Members && isCommunityMember) ||
                     (forumTopic.TopicItemCreationUsers == CommunityUsersType.Authenticated && udc.IsAuthenticated) ||
                     isRoleAllowed) && forumTopic.State == ObjectState.Saved)
                {
                    DataObjectForumTopicItem forumTopicItem = new DataObjectForumTopicItem(udc);
                    forumTopicItem.ObjectID         = Guid.NewGuid();
                    forumTopicItem.CommunityID      = forumTopic.CommunityID;
                    forumTopicItem.Status           = forumTopic.Status;
                    forumTopicItem.ShowState        = forumTopic.IsModerated && !isCommunityOwner ? ObjectShowState.Draft : ObjectShowState.Published;
                    forumTopicItem.Title            = "ForumTopicItem";
                    forumTopicItem.Description      = TxtCom.Content;
                    forumTopicItem.ReferencedItemId = referencedItemId;
                    if (!udc.IsAuthenticated)
                    {
                        forumTopicItem.Nickname = TxtName.Text.CropString(32);
                        forumTopicItem.Email    = TxtEmail.Text;
                    }
                    forumTopicItem.Insert(udc, forumTopic.ObjectID.Value, Helper.GetObjectTypeNumericID("ForumTopic"));
                    IncentivePointsManager.AddIncentivePointEvent("FORUMTOPICITEM_UPLOAD", udc, forumTopicItem.CommunityID.Value.ToString());
                }
                ClientScript.RegisterStartupScript(GetType(), "CloseWindow", "$telerik.$(function() { RefreshParentPage();GetRadWindow().Close(); } );", true);
            }
        }
Esempio n. 3
0
        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();
            }
        }