/// <summary> /// 获得数据列表 /// </summary> public List <NoName.NetShop.Model.QuestionModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List <NoName.NetShop.Model.QuestionModel> modelList = new List <NoName.NetShop.Model.QuestionModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { NoName.NetShop.Model.QuestionModel model; for (int n = 0; n < rowsCount; n++) { model = new NoName.NetShop.Model.QuestionModel(); if (ds.Tables[0].Rows[n]["QuestionId"].ToString() != "") { model.QuestionId = int.Parse(ds.Tables[0].Rows[n]["QuestionId"].ToString()); } if (ds.Tables[0].Rows[n]["UserId"].ToString() != "") { model.UserId = int.Parse(ds.Tables[0].Rows[n]["UserId"].ToString()); } if (ds.Tables[0].Rows[n]["ContentType"].ToString() != "") { model.ContentType = int.Parse(ds.Tables[0].Rows[n]["ContentType"].ToString()); } model.ContentId = ds.Tables[0].Rows[n]["ContentId"].ToString(); model.Title = ds.Tables[0].Rows[n]["Title"].ToString(); model.Content = ds.Tables[0].Rows[n]["Content"].ToString(); model.Brief = ds.Tables[0].Rows[n]["Brief"].ToString(); if (ds.Tables[0].Rows[n]["InsertTime"].ToString() != "") { model.InsertTime = DateTime.Parse(ds.Tables[0].Rows[n]["InsertTime"].ToString()); } if (ds.Tables[0].Rows[n]["LastAnswerTime"].ToString() != "") { model.LastAnswerTime = DateTime.Parse(ds.Tables[0].Rows[n]["LastAnswerTime"].ToString()); } model.LastAnswerId = ds.Tables[0].Rows[n]["LastAnswerId"].ToString(); if (ds.Tables[0].Rows[n]["AnswerNum"].ToString() != "") { model.AnswerNum = int.Parse(ds.Tables[0].Rows[n]["AnswerNum"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(NoName.NetShop.Model.QuestionModel model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(NoName.NetShop.Model.QuestionModel model) { dal.Add(model); }