/// <summary> /// 获得数据列表 /// </summary> public List <CSLG.CTalk.Model.messsageInfo> DataTableToList(DataTable dt) { List <CSLG.CTalk.Model.messsageInfo> modelList = new List <CSLG.CTalk.Model.messsageInfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { CSLG.CTalk.Model.messsageInfo model; for (int n = 0; n < rowsCount; n++) { model = new CSLG.CTalk.Model.messsageInfo(); if (dt.Rows[n]["messageID"] != null && dt.Rows[n]["messageID"].ToString() != "") { model.messageID = int.Parse(dt.Rows[n]["messageID"].ToString()); } if (dt.Rows[n]["senderID"] != null && dt.Rows[n]["senderID"].ToString() != "") { model.senderID = int.Parse(dt.Rows[n]["senderID"].ToString()); } if (dt.Rows[n]["receiverID"] != null && dt.Rows[n]["receiverID"].ToString() != "") { model.receiverID = int.Parse(dt.Rows[n]["receiverID"].ToString()); } if (dt.Rows[n]["messageContent"] != null && dt.Rows[n]["messageContent"].ToString() != "") { model.messageContent = dt.Rows[n]["messageContent"].ToString(); } if (dt.Rows[n]["sendTime"] != null && dt.Rows[n]["sendTime"].ToString() != "") { model.sendTime = DateTime.Parse(dt.Rows[n]["sendTime"].ToString()); } if (dt.Rows[n]["messageState"] != null && dt.Rows[n]["messageState"].ToString() != "") { model.messageState = int.Parse(dt.Rows[n]["messageState"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(CSLG.CTalk.Model.messsageInfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(CSLG.CTalk.Model.messsageInfo model) { return(dal.Add(model)); }