Example #1
0
        protected void OnSaveClick(object sender, System.EventArgs e)
        {
            pnlInput.Visible  = true;
            pnlInput2.Visible = false;

            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)
            {
                GetCommentedDataObject();
                udc = UserDataContext.GetUserDataContext();
                DataObjectComment doComment = new DataObjectComment(udc);
                doComment.Status      = ObjectStatus.Public;
                doComment.Description = TxtCom.Content;
                doComment.IP          = udc.UserIP;
                doComment.ShowState   = ObjectShowState.Published;
                if (allowAnonymous && !udc.IsAuthenticated)
                {
                    doComment.Nickname = TxtName.Text.CropString(32);
                    doComment.Email    = TxtEmail.Text;
                }
                MembershipUser membershipUser = Membership.GetUser(commentedDataObject.UserID, false);
                doComment.CommunityID = UserProfile.GetProfile(membershipUser.UserName).ProfileCommunityID;
                doComment.Insert(udc, commentedDataObject.ObjectID.Value, commentedDataObject.ObjectType);
                commentedDataObject.AddCommented();
                TxtCom.Content = string.Empty;

                pnlInput.Visible  = false;
                pnlInput2.Visible = true;

                Reload(true);

                up2.Update();
            }
        }