private bool DoAdd() { bool flag = true; Rain.Model.user_message model = new Rain.Model.user_message(); Rain.BLL.user_message userMessage = new Rain.BLL.user_message(); model.title = this.txtTitle.Text.Trim(); model.content = this.txtContent.Value; string[] strArray = this.txtUserName.Text.Trim().Split(','); if (strArray.Length > 0) { foreach (string user_name in strArray) { if (new Rain.BLL.users().Exists(user_name)) { model.accept_user_name = user_name; if (userMessage.Add(model) < 1) { flag = false; } } } } return(flag); }
private void ShowInfo(int _id) { Rain.Model.user_message model = new Rain.BLL.user_message().GetModel(_id); this.div_view.Visible = true; this.div_add.Visible = false; this.btnSubmit.Visible = false; this.labType.Text = this.GetMessageType(model.type); this.labPostUserName.Text = string.IsNullOrEmpty(model.post_user_name) ? "-" : model.post_user_name; this.labAcceptUserName.Text = model.accept_user_name; this.labPostTime.Text = model.post_time.ToString(); this.labIsRead.Text = model.is_read == 1 ? "已阅读" : "未阅读"; this.labReadTime.Text = !model.read_time.HasValue ? "-" : model.read_time.ToString(); this.labTitle.Text = model.title; this.litContent.Text = model.content; }
protected override void InitPage() { this.id = DTRequest.GetQueryInt("id"); Rain.BLL.user_message userMessage = new Rain.BLL.user_message(); if (!userMessage.Exists(this.id)) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")))); } else { this.model = userMessage.GetModel(this.id); if (this.model.accept_user_name != this.userModel.user_name && this.model.post_user_name != this.userModel.user_name) { HttpContext.Current.Response.Redirect(this.linkurl("error", (object)("?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的短消息!")))); } else { userMessage.UpdateField(this.id, "is_read=1,read_time='" + (object)DateTime.Now + "'"); } } }