/// <summary> /// 增加一条数据 /// </summary> public void Add(Maticsoft.Model.users model) { dal.Add(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.users model) { return(dal.Update(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <Maticsoft.Model.users> DataTableToList(DataTable dt) { List <Maticsoft.Model.users> modelList = new List <Maticsoft.Model.users>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Maticsoft.Model.users model; for (int n = 0; n < rowsCount; n++) { model = new Maticsoft.Model.users(); model.user_name = dt.Rows[n]["user_name"].ToString(); model.capacity = dt.Rows[n]["capacity"].ToString(); if (dt.Rows[n]["isedit"].ToString() != "") { if ((dt.Rows[n]["isedit"].ToString() == "1") || (dt.Rows[n]["isedit"].ToString().ToLower() == "true")) { model.isedit = true; } else { model.isedit = false; } } if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.pasword = dt.Rows[n]["pasword"].ToString(); model.bz = dt.Rows[n]["bz"].ToString(); if (dt.Rows[n]["islogin"].ToString() != "") { if ((dt.Rows[n]["islogin"].ToString() == "1") || (dt.Rows[n]["islogin"].ToString().ToLower() == "true")) { model.islogin = true; } else { model.islogin = false; } } model.password = dt.Rows[n]["password"].ToString(); model.user_type = dt.Rows[n]["user_type"].ToString(); model.departid = dt.Rows[n]["departid"].ToString(); if (dt.Rows[n]["indate"].ToString() != "") { model.indate = DateTime.Parse(dt.Rows[n]["indate"].ToString()); } if (dt.Rows[n]["grade"].ToString() != "") { model.grade = int.Parse(dt.Rows[n]["grade"].ToString()); } if (dt.Rows[n]["statue"].ToString() != "") { if ((dt.Rows[n]["statue"].ToString() == "1") || (dt.Rows[n]["statue"].ToString().ToLower() == "true")) { model.statue = true; } else { model.statue = false; } } model.user_title = dt.Rows[n]["user_title"].ToString(); model.pwh = dt.Rows[n]["pwh"].ToString(); modelList.Add(model); } } return(modelList); }