/// <summary> /// 获得数据列表 /// </summary> public List <Light.Model.user_role> DataTableToList(DataTable dt) { List <Light.Model.user_role> modelList = new List <Light.Model.user_role>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.user_role model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.user_role(); 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()); } if (dt.Rows[n]["roleid"].ToString() != "") { model.roleid = int.Parse(dt.Rows[n]["roleid"].ToString()); } model.specialty = dt.Rows[n]["specialty"].ToString(); model.introducemyself = dt.Rows[n]["introducemyself"].ToString(); if (dt.Rows[n]["tip"].ToString() != "") { model.tip = int.Parse(dt.Rows[n]["tip"].ToString()); } if (dt.Rows[n]["createman"].ToString() != "") { model.createman = int.Parse(dt.Rows[n]["createman"].ToString()); } if (dt.Rows[n]["createtime"].ToString() != "") { model.createtime = DateTime.Parse(dt.Rows[n]["createtime"].ToString()); } if (dt.Rows[n]["executiontimes"].ToString() != "") { model.executiontimes = int.Parse(dt.Rows[n]["executiontimes"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 获得数据列表 /// </summary> public List<Light.Model.user_role> DataTableToList(DataTable dt) { List<Light.Model.user_role> modelList = new List<Light.Model.user_role>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.user_role model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.user_role(); 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()); } if(dt.Rows[n]["roleid"].ToString()!="") { model.roleid=int.Parse(dt.Rows[n]["roleid"].ToString()); } model.specialty= dt.Rows[n]["specialty"].ToString(); model.introducemyself= dt.Rows[n]["introducemyself"].ToString(); if(dt.Rows[n]["tip"].ToString()!="") { model.tip=int.Parse(dt.Rows[n]["tip"].ToString()); } if(dt.Rows[n]["createman"].ToString()!="") { model.createman=int.Parse(dt.Rows[n]["createman"].ToString()); } if(dt.Rows[n]["createtime"].ToString()!="") { model.createtime=DateTime.Parse(dt.Rows[n]["createtime"].ToString()); } if(dt.Rows[n]["executiontimes"].ToString()!="") { model.executiontimes=int.Parse(dt.Rows[n]["executiontimes"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Light.Model.user_role model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Light.Model.user_role model) { dal.Add(model); }