/// <summary> /// ��������б� /// </summary> public List<ZQUSR.Model.sr_Message> DataTableToList(DataTable dt) { List<ZQUSR.Model.sr_Message> modelList = new List<ZQUSR.Model.sr_Message>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZQUSR.Model.sr_Message model; for (int n = 0; n < rowsCount; n++) { model = new ZQUSR.Model.sr_Message(); if(dt.Rows[n]["PK_MID"].ToString()!="") { model.PK_MID=int.Parse(dt.Rows[n]["PK_MID"].ToString()); } model.Title=dt.Rows[n]["Title"].ToString(); model.MessContent=dt.Rows[n]["MessContent"].ToString(); model.FK_RecieverID=dt.Rows[n]["FK_RecieverID"].ToString(); model.FK_SenderID=dt.Rows[n]["FK_SenderID"].ToString(); if(dt.Rows[n]["SendTime"].ToString()!="") { model.SendTime=DateTime.Parse(dt.Rows[n]["SendTime"].ToString()); } if(dt.Rows[n]["IsRead"].ToString()!="") { model.IsRead=int.Parse(dt.Rows[n]["IsRead"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 获得数据列表 /// </summary> public List <ZQUSR.Model.sr_Message> DataTableToList(DataTable dt) { List <ZQUSR.Model.sr_Message> modelList = new List <ZQUSR.Model.sr_Message>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZQUSR.Model.sr_Message model; for (int n = 0; n < rowsCount; n++) { model = new ZQUSR.Model.sr_Message(); if (dt.Rows[n]["PK_MID"].ToString() != "") { model.PK_MID = int.Parse(dt.Rows[n]["PK_MID"].ToString()); } model.Title = dt.Rows[n]["Title"].ToString(); model.MessContent = dt.Rows[n]["MessContent"].ToString(); model.FK_RecieverID = dt.Rows[n]["FK_RecieverID"].ToString(); model.FK_SenderID = dt.Rows[n]["FK_SenderID"].ToString(); if (dt.Rows[n]["SendTime"].ToString() != "") { model.SendTime = DateTime.Parse(dt.Rows[n]["SendTime"].ToString()); } if (dt.Rows[n]["IsRead"].ToString() != "") { model.IsRead = int.Parse(dt.Rows[n]["IsRead"].ToString()); } modelList.Add(model); } } return(modelList); }
public void BindData() { //获取消息Id int id=Convert.ToInt32(Request.QueryString.GetValues(0)[0]); MsgModel = MsgBll.GetModel(id); lblMsgTitle.Text = MsgModel.Title; //从ID获取用户姓名 string receiverID = MsgModel.FK_RecieverID; lblReceiver.Text = UserBll.GetUserName(receiverID); lblSender.Text = UserBll.GetUserName(MsgModel.FK_SenderID); lblSendTime.Text = MsgModel.SendTime.ToString(); lblMsgContend.Text = MsgModel.MessContent; //若消息状态为未读,则修改为已读。 if (MsgModel.IsRead==0) { MsgModel.IsRead = 1; MsgBll.Update(MsgModel); } }
public void BindData() { //获取消息Id int id = Convert.ToInt32(Request.QueryString.GetValues(0)[0]); MsgModel = MsgBll.GetModel(id); lblMsgTitle.Text = MsgModel.Title; //从ID获取用户姓名 string receiverID = MsgModel.FK_RecieverID; lblReceiver.Text = UserBll.GetUserName(receiverID); lblSender.Text = UserBll.GetUserName(MsgModel.FK_SenderID); lblSendTime.Text = MsgModel.SendTime.ToString(); lblMsgContend.Text = MsgModel.MessContent; //若消息状态为未读,则修改为已读。 if (MsgModel.IsRead == 0) { MsgModel.IsRead = 1; MsgBll.Update(MsgModel); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(ZQUSR.Model.sr_Message model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(ZQUSR.Model.sr_Message model) { return(dal.Add(model)); }