/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.MesgInfo model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hownet.Model.MesgInfo model) { return(dal.Update(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.MesgInfo> DataTableToList(DataTable dt) { List <Hownet.Model.MesgInfo> modelList = new List <Hownet.Model.MesgInfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.MesgInfo model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.MesgInfo(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["MainID"] != null && dt.Rows[n]["MainID"].ToString() != "") { model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString()); } if (dt.Rows[n]["ToID"] != null && dt.Rows[n]["ToID"].ToString() != "") { model.ToID = int.Parse(dt.Rows[n]["ToID"].ToString()); } model.ToMan = dt.Rows[n]["ToMan"].ToString(); model.Remark = dt.Rows[n]["Remark"].ToString(); if (dt.Rows[n]["IsRead"] != null && dt.Rows[n]["IsRead"].ToString() != "") { if ((dt.Rows[n]["IsRead"].ToString() == "1") || (dt.Rows[n]["IsRead"].ToString().ToLower() == "true")) { model.IsRead = true; } else { model.IsRead = false; } } if (dt.Rows[n]["IsEnd"] != null && dt.Rows[n]["IsEnd"].ToString() != "") { if ((dt.Rows[n]["IsEnd"].ToString() == "1") || (dt.Rows[n]["IsEnd"].ToString().ToLower() == "true")) { model.IsEnd = true; } else { model.IsEnd = false; } } if (dt.Rows[n]["IsComplete"] != null && dt.Rows[n]["IsComplete"].ToString() != "") { if ((dt.Rows[n]["IsComplete"].ToString() == "1") || (dt.Rows[n]["IsComplete"].ToString().ToLower() == "true")) { model.IsComplete = true; } else { model.IsComplete = false; } } if (dt.Rows[n]["LastDateTime"] != null && dt.Rows[n]["LastDateTime"].ToString() != "") { model.LastDateTime = DateTime.Parse(dt.Rows[n]["LastDateTime"].ToString()); } if (dt.Rows[n]["CompleteDateTime"] != null && dt.Rows[n]["CompleteDateTime"].ToString() != "") { model.CompleteDateTime = DateTime.Parse(dt.Rows[n]["CompleteDateTime"].ToString()); } modelList.Add(model); } } return(modelList); }