protected void OnCommentItemDataBound(object sender, RepeaterItemEventArgs e) { DataObjectComment comment = (DataObjectComment)e.Item.DataItem; Panel panel = (Panel)e.Item.FindControl("UD"); Control ctrl = this.LoadControl("/UserControls/Templates/SmallOutputUser2.ascx"); SmallOutputUser2 userOutput = ctrl as SmallOutputUser2; SetUserOutput(userOutput, comment.UserID.Value, comment.Nickname); panel.Controls.Add(userOutput); panel = (Panel)e.Item.FindControl("CP"); CommentPreview commentPreview = (CommentPreview)LoadControl("/UserControls/Dashboard/CommentPreview.ascx"); commentPreview.Comment = comment; commentPreview.Type = "Comment"; commentPreview.StripHtml = true; panel.Controls.Add(commentPreview); panel = (Panel)e.Item.FindControl("COP"); commentPreview = (CommentPreview)LoadControl("/UserControls/Dashboard/CommentPreview.ascx"); commentPreview.Comment = comment; commentPreview.Type = "Object"; panel.Controls.Add(commentPreview); }
protected override void OnInit(EventArgs e) { base.OnInit(e); doComment = this.DataObject as DataObjectComment; Control ctrl = this.LoadControl("/UserControls/Templates/SmallOutputUser2.ascx"); SmallOutputUser2 userOutput = ctrl as SmallOutputUser2; SetUserOutput(userOutput, doComment.UserID.Value, doComment.Nickname); phUserOutput.Controls.Add(userOutput); if (doComment.CommentStatus == 0) { CommentPreview commentPreview = (CommentPreview)LoadControl("/UserControls/Dashboard/CommentPreview.ascx"); commentPreview.Comment = doComment; commentPreview.StripHtml = false; commentPreview.Type = "Comment"; phCommentOuput.Controls.Add(commentPreview); LbtnDel.Visible = false; if (UserDataContext.GetUserDataContext().IsAdmin&& doComment.CommentStatus != 1) { LbtnDel.Visible = true; LbtnDel.ID = "del_" + doComment.ObjectID.ToString().Replace("-", ""); LbtnDel.CommandArgument = doComment.ObjectID.ToString(); } } else { phCommentOuput.Controls.Add(new LiteralControl(languageShared.GetString("MessageCommentDeletedByAdmin"))); LbtnDel.Visible = false; } }
protected void OnRepCommentsItemDataBound(object sender, RepeaterItemEventArgs e) { DataObjectComment item = (DataObjectComment)e.Item.DataItem; PlaceHolder placeHolder = (PlaceHolder)e.Item.FindControl("Ph"); Control control = LoadControl(string.Format("~/UserControls/Templates/{0}", outputTemplate)); ((IDataObjectWorker)control).DataObject = item; placeHolder.Controls.Add(control); }
protected void OnDeleteClick(object sender, EventArgs e) { Guid commentId = ((LinkButton)sender).CommandArgument.ToGuid(); DataObjectComment comment = DataObject.Load <DataObjectComment>(commentId); if (comment.State == ObjectState.Saved) { comment.CommentStatus = 1; comment.Update(UserDataContext.GetUserDataContext()); } }
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(); } }