protected void Page_Load(object sender, EventArgs e) { if (!long.TryParse(this.Page.Request.QueryString["LeaveId"], out this.LeaveId)) { base.GotoResourceNotFound(); } else { this.btnReplyLeaveComments.Click += new EventHandler(this.btnReplyLeaveComments_Click); if (!this.Page.IsPostBack) { LeaveCommentInfo leaveComment = SubsiteCommentsHelper.GetLeaveComment(this.LeaveId); if (leaveComment == null) { base.GotoResourceNotFound(); } else { this.litTitle.Text = Globals.HtmlDecode(leaveComment.Title); this.litContent.Text = Globals.HtmlDecode(leaveComment.PublishContent); this.litUserName.Text = Globals.HtmlDecode(leaveComment.UserName); } } } }
private void SetControl(long leaveId) { LeaveCommentInfo leaveComment = SubsiteCommentsHelper.GetLeaveComment(leaveId); Globals.EntityCoding(leaveComment, false); this.litTitle.Text = leaveComment.Title; this.lblUserName.Text = leaveComment.UserName; this.litLeaveDate.Time = leaveComment.PublishDate; this.litPublishContent.Text = leaveComment.PublishContent; }
private void SetControl(long leaveId) { LeaveCommentInfo leaveComment = NoticeHelper.GetLeaveComment(leaveId); Globals.EntityCoding(leaveComment, false); this.litTitle.Text = leaveComment.Title; this.lblUserName.Text = leaveComment.UserName; this.litLeaveDate.Time = leaveComment.PublishDate; this.litPublishContent.Text = leaveComment.PublishContent; this.a_user.HRef = string.Concat(new object[] { "javascript:DialogFrame('", Globals.ApplicationPath, "/admin/member/MemberDetails.aspx?userId=", leaveComment.UserId, "','查看会员详细信息',null,null)" }); }
public override bool InsertLeaveComment(LeaveCommentInfo leave) { System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("Insert into Hishop_LeaveComments(UserId,UserName,Title,PublishContent,PublishDate,LastDate) values(@UserId,@UserName,@Title,@PublishContent,@PublishDate,@LastDate)"); this.database.AddInParameter(sqlStringCommand, "UserId", System.Data.DbType.Int32, leave.UserId); this.database.AddInParameter(sqlStringCommand, "UserName", System.Data.DbType.String, leave.UserName); this.database.AddInParameter(sqlStringCommand, "Title", System.Data.DbType.String, leave.Title); this.database.AddInParameter(sqlStringCommand, "PublishContent", System.Data.DbType.String, leave.PublishContent); this.database.AddInParameter(sqlStringCommand, "PublishDate", System.Data.DbType.DateTime, DataHelper.GetSafeDateTimeFormat(DateTime.Now)); this.database.AddInParameter(sqlStringCommand, "LastDate", System.Data.DbType.DateTime, DataHelper.GetSafeDateTimeFormat(DateTime.Now)); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public override bool InsertLeaveComment(LeaveCommentInfo leave) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("Insert into distro_LeaveComments(UserId,DistributorUserId,UserName,Title,PublishContent,PublishDate,LastDate) values(@UserId,@DistributorUserId,@UserName,@Title,@PublishContent,@PublishDate,@LastDate)"); this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, leave.UserId); this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value); this.database.AddInParameter(sqlStringCommand, "UserName", DbType.String, leave.UserName); this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, leave.Title); this.database.AddInParameter(sqlStringCommand, "PublishContent", DbType.String, leave.PublishContent); this.database.AddInParameter(sqlStringCommand, "PublishDate", DbType.DateTime, DataHelper.GetSafeDateTimeFormat(DateTime.Now)); this.database.AddInParameter(sqlStringCommand, "LastDate", DbType.DateTime, DataHelper.GetSafeDateTimeFormat(DateTime.Now)); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
public LeaveCommentInfo GetLeaveComment(long leaveId) { LeaveCommentInfo result = null; DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Ecshop_LeaveComments WHERE LeaveId=@LeaveId;"); this.database.AddInParameter(sqlStringCommand, "LeaveId", DbType.Int64, leaveId); using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { if (dataReader.Read()) { result = DataMapper.PopulateLeaveComment(dataReader); } } return(result); }
public override LeaveCommentInfo GetLeaveComment(long leaveId) { LeaveCommentInfo info = null; DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_LeaveComments WHERE LeaveId=@LeaveId AND DistributorUserId=@DistributorUserId;"); this.database.AddInParameter(sqlStringCommand, "LeaveId", DbType.Int64, leaveId); this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId); using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand)) { if (reader.Read()) { info = DataMapper.PopulateLeaveComment(reader); } } return(info); }
public void btnRefer_Click(object sender, System.EventArgs e) { if (!HiContext.Current.CheckVerifyCode(this.txtLeaveCode.Value)) { this.ShowMessage("验证码不正确", false); return; } if (!this.ValidateConvert()) { return; } if (HiContext.Current.User.UserRole != UserRole.Member && !this.userRegion(this.txtLeaveUserName.Value, this.txtLeavePsw.Value)) { return; } LeaveCommentInfo leaveCommentInfo = new LeaveCommentInfo(); leaveCommentInfo.UserName = Globals.HtmlEncode(this.txtUserName.Text); leaveCommentInfo.UserId = new int?(HiContext.Current.User.UserId); leaveCommentInfo.Title = Globals.HtmlEncode(this.txtTitle.Text); leaveCommentInfo.PublishContent = Globals.HtmlEncode(this.txtContent.Text); ValidationResults validationResults = Validation.Validate <LeaveCommentInfo>(leaveCommentInfo, new string[] { "Refer" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMessage(text, false); return; } if (CommentBrowser.InsertLeaveComment(leaveCommentInfo)) { this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"{0}\");window.location.href=\"{1}\"</script>", "留言成功,管理员回复后即可显示", Globals.GetSiteUrls().UrlData.FormatUrl("LeaveComments"))); } else { this.ShowMessage("留言失败", false); } this.txtTitle.Text = string.Empty; this.txtContent.Text = string.Empty; }
public void btnRefer_Click(object sender, EventArgs e) { if (!HiContext.Current.CheckVerifyCode(this.txtLeaveCode.Value)) { this.ShowMessage("验证码不正确", false); } else if (this.ValidateConvert() && (((HiContext.Current.User.UserRole == UserRole.Member) || (HiContext.Current.User.UserRole == UserRole.Underling)) || this.userRegion(this.txtLeaveUserName.Value, this.txtLeavePsw.Value))) { LeaveCommentInfo target = new LeaveCommentInfo(); target.UserName = Globals.HtmlEncode(this.txtUserName.Text); target.UserId = new int?(HiContext.Current.User.UserId); target.Title = Globals.HtmlEncode(this.txtTitle.Text); target.PublishContent = Globals.HtmlEncode(this.txtContent.Text); ValidationResults results = Hishop.Components.Validation.Validation.Validate <LeaveCommentInfo>(target, new string[] { "Refer" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } this.ShowMessage(msg, false); } else { if (CommentProcessor.InsertLeaveComment(target)) { this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"{0}\");window.location.href=\"{1}\"</script>", "留言成功,管理员回复后即可显示", Globals.GetSiteUrls().UrlData.FormatUrl("LeaveComments"))); } else { this.ShowMessage("留言失败", false); } this.txtTitle.Text = string.Empty; this.txtContent.Text = string.Empty; } } }
public IHttpActionResult Feedback(JObject request) { Logger.WriterLogger("Common.Feedback, Params: " + request.ToString(), LoggerType.Info); ParamFeedback param = new ParamFeedback(); try { param = request.ToObject <ParamFeedback>(); } catch { // 参数无效 return(base.JsonFaultResult(new CommonException(40100).GetMessage(), request.ToString())); } string accessToken = param.accessToken; // 验证令牌 int accessTookenCode = VerifyAccessToken(accessToken); if (accessTookenCode > 0) { return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), request.ToString())); } // 验证参数 //ThrowParamException(skuId); int channel = param.channel; int platform = param.platform; string ver = param.ver; string userId = param.UserId; string content = param.Content; int feedbackType = param.FeedbackType; string contactWay = param.ContactWay; int? innerUserId = new Nullable <int>(); string username = ""; Member member = GetMember(userId.ToSeesionId()); if (member != null) { innerUserId = member.UserId; username = member.Username; } LeaveCommentInfo leaveCommentInfo = new LeaveCommentInfo(); leaveCommentInfo.UserName = Globals.HtmlEncode(username); leaveCommentInfo.UserId = innerUserId; leaveCommentInfo.Title = ""; leaveCommentInfo.PublishContent = Globals.HtmlEncode(content); leaveCommentInfo.ContactWay = Globals.HtmlEncode(contactWay); leaveCommentInfo.FeedbackType = feedbackType; if (param.Images.Count > 0) { foreach (SubmitImage item in param.Images) { leaveCommentInfo.Images.Add(item.Image); } } if (CommentBrowser.InsertLeaveComment(leaveCommentInfo)) { StandardResult <string> result = new StandardResult <string>(); result.code = 0; result.msg = "保存成功"; result.data = null; return(base.JsonActionResult(result)); } return(base.JsonFaultResult(new CommonException(40999).GetMessage(), request.ToString())); }
public static bool InsertLeaveComment(LeaveCommentInfo leave) { Globals.EntityCoding(leave, true); return(CommentProvider.Instance().InsertLeaveComment(leave)); }
public abstract bool InsertLeaveComment(LeaveCommentInfo leave);
public bool InsertLeaveComment(LeaveCommentInfo leave) { bool result = false; using (DbConnection connection = this.database.CreateConnection()) { //打开链接 connection.Open(); //创建事务 DbTransaction Tran = connection.BeginTransaction(); try { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("Insert into Ecshop_LeaveComments(UserId,UserName,Title,PublishContent,PublishDate,LastDate,FeedbackType,ContactWay) values(@UserId,@UserName,@Title,@PublishContent,@PublishDate,@LastDate,@FeedbackType,@ContactWay);select @@identity"); this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, leave.UserId); this.database.AddInParameter(sqlStringCommand, "UserName", DbType.String, leave.UserName); this.database.AddInParameter(sqlStringCommand, "Title", DbType.String, leave.Title); this.database.AddInParameter(sqlStringCommand, "PublishContent", DbType.String, leave.PublishContent); this.database.AddInParameter(sqlStringCommand, "PublishDate", DbType.DateTime, DataHelper.GetSafeDateTimeFormat(DateTime.Now)); this.database.AddInParameter(sqlStringCommand, "LastDate", DbType.DateTime, DataHelper.GetSafeDateTimeFormat(DateTime.Now)); this.database.AddInParameter(sqlStringCommand, "FeedbackType", DbType.Int32, leave.FeedbackType); this.database.AddInParameter(sqlStringCommand, "ContactWay", DbType.String, leave.ContactWay); int commentid = 0; if (!int.TryParse(this.database.ExecuteScalar(sqlStringCommand, Tran).ToString(), out commentid)) { Tran.Rollback(); result = false; } //新增图片 if (leave.Images.Count > 0) { foreach (string image in leave.Images) { DbCommand sqlStringCommand2 = this.database.GetSqlStringCommand("INSERT INTO Ecshop_Image(Image,BindType,BindId) VALUES (@Image, @BindType,@BindId)"); this.database.AddInParameter(sqlStringCommand2, "Image", DbType.String, image); this.database.AddInParameter(sqlStringCommand2, "BindType", DbType.Int32, ImageBindType.Feedback); this.database.AddInParameter(sqlStringCommand2, "BindId", DbType.Int32, commentid); this.database.ExecuteNonQuery(sqlStringCommand2, Tran); } } //提交事务 Tran.Commit(); result = true; } catch (Exception Ex) { //出错回滚 Tran.Rollback(); ErrorLog.Write(Ex.ToString()); } finally { //关闭连接 connection.Close(); } return(result); } }
public static bool InsertLeaveComment(LeaveCommentInfo leave) { Globals.EntityCoding(leave, true); return(new LeaveCommentDao().InsertLeaveComment(leave)); }