/// <summary> /// 获得数据列表 /// </summary> public List <CSLG.CTalk.Model.userInfo> DataTableToList(DataTable dt) { List <CSLG.CTalk.Model.userInfo> modelList = new List <CSLG.CTalk.Model.userInfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { CSLG.CTalk.Model.userInfo model; for (int n = 0; n < rowsCount; n++) { model = new CSLG.CTalk.Model.userInfo(); if (dt.Rows[n]["userID"] != null && dt.Rows[n]["userID"].ToString() != "") { model.userID = int.Parse(dt.Rows[n]["userID"].ToString()); } if (dt.Rows[n]["userPWD"] != null && dt.Rows[n]["userPWD"].ToString() != "") { model.userPWD = dt.Rows[n]["userPWD"].ToString(); } if (dt.Rows[n]["userName"] != null && dt.Rows[n]["userName"].ToString() != "") { model.userName = dt.Rows[n]["userName"].ToString(); } if (dt.Rows[n]["userShuoshuo"] != null && dt.Rows[n]["userShuoshuo"].ToString() != "") { model.userShuoshuo = dt.Rows[n]["userShuoshuo"].ToString(); } if (dt.Rows[n]["userState"] != null && dt.Rows[n]["userState"].ToString() != "") { model.userState = int.Parse(dt.Rows[n]["userState"].ToString()); } if (dt.Rows[n]["userHeadImage"] != null && dt.Rows[n]["userHeadImage"].ToString() != "") { model.userHeadImage = dt.Rows[n]["userHeadImage"].ToString(); } if (dt.Rows[n]["userSex"] != null && dt.Rows[n]["userSex"].ToString() != "") { model.userSex = dt.Rows[n]["userSex"].ToString(); } if (dt.Rows[n]["userBirthDay"] != null && dt.Rows[n]["userBirthDay"].ToString() != "") { model.userBirthDay = DateTime.Parse(dt.Rows[n]["userBirthDay"].ToString()); } if (dt.Rows[n]["userDescription"] != null && dt.Rows[n]["userDescription"].ToString() != "") { model.userDescription = dt.Rows[n]["userDescription"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(CSLG.CTalk.Model.userInfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(CSLG.CTalk.Model.userInfo model) { return(dal.Add(model)); }