/// <summary> /// 更新留言内容 /// </summary> /// <param name="msid">留言id</param> /// <param name="msg">留言内容</param> /// <returns></returns> public bool Update(int msid, string msg) { Song.Entities.Message mm = Business.Do <IMessage>().GetSingle(msid); if (mm == null) { throw new Exception("当前信息不存在"); } mm.Msg_Context = msg; try { Business.Do <IMessage>().Save(mm); return(true); } catch (Exception exp) { throw exp; } }
/// <summary> /// 填充数据 /// </summary> private void fill() { msg = Business.Do <IMessage>().GetSingle(id); //消息内容 tbMsg.Text = msg.Msg_Context; tbReply.Text = msg.Msg_ReContext; //联系方式 tbQQ.Text = msg.Msg_QQ; tbPhone.Text = msg.Msg_Phone; //时间 lbCrtTime.Text = msg.Msg_CrtTime.ToString(); //是否阅读 if (msg.Msg_State == 0) { msg.Msg_State = 1; Business.Do <IMessage>().Save(msg); } }
/// <summary> /// 回复 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAnswer_Click(object sender, EventArgs e) { try { Song.Entities.Message msg = Business.Do <IMessage>().GetSingle(id); //消息内容与回复 msg.Msg_Context = tbMsg.Text.Trim(); msg.Msg_ReContext = tbReply.Text.Trim(); if (!string.IsNullOrWhiteSpace(msg.Msg_ReContext)) { msg.Msg_IsReply = true; } //联系方式 msg.Msg_QQ = tbQQ.Text; msg.Msg_Phone = tbPhone.Text; Business.Do <IMessage>().Save(msg); Master.AlertCloseAndRefresh("操作成功!"); } catch (Exception ex) { Message.Alert(ex); } }