/// <summary> /// 获得数据列表 /// </summary> public List <Light.Model.marriage> DataTableToList(DataTable dt) { List <Light.Model.marriage> modelList = new List <Light.Model.marriage>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.marriage model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.marriage(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["proposeid"].ToString() != "") { model.proposeid = int.Parse(dt.Rows[n]["proposeid"].ToString()); } if (dt.Rows[n]["whoid"].ToString() != "") { model.whoid = int.Parse(dt.Rows[n]["whoid"].ToString()); } if (dt.Rows[n]["state"].ToString() != "") { model.state = int.Parse(dt.Rows[n]["state"].ToString()); } model.synopsis = dt.Rows[n]["synopsis"].ToString(); if (dt.Rows[n]["proposetime"].ToString() != "") { model.proposetime = DateTime.Parse(dt.Rows[n]["proposetime"].ToString()); } if (dt.Rows[n]["agreetime"].ToString() != "") { model.agreetime = DateTime.Parse(dt.Rows[n]["agreetime"].ToString()); } if (dt.Rows[n]["checktime"].ToString() != "") { model.checktime = DateTime.Parse(dt.Rows[n]["checktime"].ToString()); } if (dt.Rows[n]["checkman"].ToString() != "") { model.checkman = int.Parse(dt.Rows[n]["checkman"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 获得数据列表 /// </summary> public List<Light.Model.marriage> DataTableToList(DataTable dt) { List<Light.Model.marriage> modelList = new List<Light.Model.marriage>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.marriage model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.marriage(); if(dt.Rows[n]["id"].ToString()!="") { model.id=int.Parse(dt.Rows[n]["id"].ToString()); } if(dt.Rows[n]["proposeid"].ToString()!="") { model.proposeid=int.Parse(dt.Rows[n]["proposeid"].ToString()); } if(dt.Rows[n]["whoid"].ToString()!="") { model.whoid=int.Parse(dt.Rows[n]["whoid"].ToString()); } if(dt.Rows[n]["state"].ToString()!="") { model.state=int.Parse(dt.Rows[n]["state"].ToString()); } model.synopsis= dt.Rows[n]["synopsis"].ToString(); if(dt.Rows[n]["proposetime"].ToString()!="") { model.proposetime=DateTime.Parse(dt.Rows[n]["proposetime"].ToString()); } if(dt.Rows[n]["agreetime"].ToString()!="") { model.agreetime=DateTime.Parse(dt.Rows[n]["agreetime"].ToString()); } if(dt.Rows[n]["checktime"].ToString()!="") { model.checktime=DateTime.Parse(dt.Rows[n]["checktime"].ToString()); } if(dt.Rows[n]["checkman"].ToString()!="") { model.checkman=int.Parse(dt.Rows[n]["checkman"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Light.Model.marriage model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Light.Model.marriage model) { dal.Add(model); }