/// <summary> /// 获得数据列表 /// </summary> public List<Light.Model.user_im> DataTableToList(DataTable dt) { List<Light.Model.user_im> modelList = new List<Light.Model.user_im>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.user_im model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.user_im(); if(dt.Rows[n]["id"].ToString()!="") { model.id=int.Parse(dt.Rows[n]["id"].ToString()); } if(dt.Rows[n]["userid"].ToString()!="") { model.userid=int.Parse(dt.Rows[n]["userid"].ToString()); } model.imtoken= dt.Rows[n]["imtoken"].ToString(); if(dt.Rows[n]["create_time"].ToString()!="") { model.create_time=long.Parse(dt.Rows[n]["create_time"].ToString()); } if(dt.Rows[n]["update_time"].ToString()!="") { model.update_time=long.Parse(dt.Rows[n]["update_time"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 获得数据列表 /// </summary> public List <Light.Model.user_im> DataTableToList(DataTable dt) { List <Light.Model.user_im> modelList = new List <Light.Model.user_im>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.user_im model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.user_im(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["userid"].ToString() != "") { model.userid = int.Parse(dt.Rows[n]["userid"].ToString()); } model.imtoken = dt.Rows[n]["imtoken"].ToString(); if (dt.Rows[n]["create_time"].ToString() != "") { model.create_time = long.Parse(dt.Rows[n]["create_time"].ToString()); } if (dt.Rows[n]["update_time"].ToString() != "") { model.update_time = long.Parse(dt.Rows[n]["update_time"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Light.Model.user_im model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Light.Model.user_im model) { return(dal.Add(model)); }