/// <summary> /// 获得数据列表 /// </summary> public List <XHD.Model.mail_info> DataTableToList(DataTable dt) { List <XHD.Model.mail_info> modelList = new List <XHD.Model.mail_info>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { XHD.Model.mail_info model; for (int n = 0; n < rowsCount; n++) { model = new XHD.Model.mail_info(); if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["mail_title"] != null && dt.Rows[n]["mail_title"].ToString() != "") { model.mail_title = dt.Rows[n]["mail_title"].ToString(); } if (dt.Rows[n]["mail_content"] != null && dt.Rows[n]["mail_content"].ToString() != "") { model.mail_content = dt.Rows[n]["mail_content"].ToString(); } if (dt.Rows[n]["atta_count"] != null && dt.Rows[n]["atta_count"].ToString() != "") { model.atta_count = int.Parse(dt.Rows[n]["atta_count"].ToString()); } if (dt.Rows[n]["create_id"] != null && dt.Rows[n]["create_id"].ToString() != "") { model.create_id = int.Parse(dt.Rows[n]["create_id"].ToString()); } if (dt.Rows[n]["create_name"] != null && dt.Rows[n]["create_name"].ToString() != "") { model.create_name = dt.Rows[n]["create_name"].ToString(); } if (dt.Rows[n]["create_time"] != null && dt.Rows[n]["create_time"].ToString() != "") { model.create_time = DateTime.Parse(dt.Rows[n]["create_time"].ToString()); } if (dt.Rows[n]["isDelete"] != null && dt.Rows[n]["isDelete"].ToString() != "") { model.isDelete = int.Parse(dt.Rows[n]["isDelete"].ToString()); } if (dt.Rows[n]["Delete_time"] != null && dt.Rows[n]["Delete_time"].ToString() != "") { model.Delete_time = DateTime.Parse(dt.Rows[n]["Delete_time"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// ��������б� /// </summary> public List<XHD.Model.mail_info> DataTableToList(DataTable dt) { List<XHD.Model.mail_info> modelList = new List<XHD.Model.mail_info>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { XHD.Model.mail_info model; for (int n = 0; n < rowsCount; n++) { model = new XHD.Model.mail_info(); if(dt.Rows[n]["id"]!=null && dt.Rows[n]["id"].ToString()!="") { model.id=int.Parse(dt.Rows[n]["id"].ToString()); } if(dt.Rows[n]["mail_title"]!=null && dt.Rows[n]["mail_title"].ToString()!="") { model.mail_title=dt.Rows[n]["mail_title"].ToString(); } if(dt.Rows[n]["mail_content"]!=null && dt.Rows[n]["mail_content"].ToString()!="") { model.mail_content=dt.Rows[n]["mail_content"].ToString(); } if(dt.Rows[n]["atta_count"]!=null && dt.Rows[n]["atta_count"].ToString()!="") { model.atta_count=int.Parse(dt.Rows[n]["atta_count"].ToString()); } if(dt.Rows[n]["create_id"]!=null && dt.Rows[n]["create_id"].ToString()!="") { model.create_id=int.Parse(dt.Rows[n]["create_id"].ToString()); } if(dt.Rows[n]["create_name"]!=null && dt.Rows[n]["create_name"].ToString()!="") { model.create_name=dt.Rows[n]["create_name"].ToString(); } if(dt.Rows[n]["create_time"]!=null && dt.Rows[n]["create_time"].ToString()!="") { model.create_time=DateTime.Parse(dt.Rows[n]["create_time"].ToString()); } if(dt.Rows[n]["isDelete"]!=null && dt.Rows[n]["isDelete"].ToString()!="") { model.isDelete=int.Parse(dt.Rows[n]["isDelete"].ToString()); } if(dt.Rows[n]["Delete_time"]!=null && dt.Rows[n]["Delete_time"].ToString()!="") { model.Delete_time=DateTime.Parse(dt.Rows[n]["Delete_time"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(XHD.Model.mail_info model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(XHD.Model.mail_info model) { return(dal.Add(model)); }