/// <summary> /// 获得数据列表 /// </summary> public List <NoName.NetShop.Model.MessageModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List <NoName.NetShop.Model.MessageModel> modelList = new List <NoName.NetShop.Model.MessageModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { NoName.NetShop.Model.MessageModel model; for (int n = 0; n < rowsCount; n++) { model = new NoName.NetShop.Model.MessageModel(); 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]["MsgId"].ToString() != "") { model.MsgId = int.Parse(ds.Tables[0].Rows[n]["MsgId"].ToString()); } if (ds.Tables[0].Rows[n]["MsgType"].ToString() != "") { model.MsgType = int.Parse(ds.Tables[0].Rows[n]["MsgType"].ToString()); } model.Subject = ds.Tables[0].Rows[n]["Subject"].ToString(); model.Content = ds.Tables[0].Rows[n]["Content"].ToString(); if (ds.Tables[0].Rows[n]["SenderId"].ToString() != "") { model.SenderId = int.Parse(ds.Tables[0].Rows[n]["SenderId"].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]["ReadTime"].ToString() != "") { model.ReadTime = DateTime.Parse(ds.Tables[0].Rows[n]["ReadTime"].ToString()); } if (ds.Tables[0].Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(ds.Tables[0].Rows[n]["Status"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(NoName.NetShop.Model.MessageModel model) { dal.Add(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(NoName.NetShop.Model.MessageModel model) { dal.Update(model); }
/// <summary> /// ��������б� /// </summary> public List<NoName.NetShop.Model.MessageModel> GetModelList(string strWhere) { DataSet ds = dal.GetList(strWhere); List<NoName.NetShop.Model.MessageModel> modelList = new List<NoName.NetShop.Model.MessageModel>(); int rowsCount = ds.Tables[0].Rows.Count; if (rowsCount > 0) { NoName.NetShop.Model.MessageModel model; for (int n = 0; n < rowsCount; n++) { model = new NoName.NetShop.Model.MessageModel(); 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]["MsgId"].ToString()!="") { model.MsgId=int.Parse(ds.Tables[0].Rows[n]["MsgId"].ToString()); } if(ds.Tables[0].Rows[n]["MsgType"].ToString()!="") { model.MsgType=int.Parse(ds.Tables[0].Rows[n]["MsgType"].ToString()); } model.Subject=ds.Tables[0].Rows[n]["Subject"].ToString(); model.Content=ds.Tables[0].Rows[n]["Content"].ToString(); if(ds.Tables[0].Rows[n]["SenderId"].ToString()!="") { model.SenderId=int.Parse(ds.Tables[0].Rows[n]["SenderId"].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]["ReadTime"].ToString()!="") { model.ReadTime=DateTime.Parse(ds.Tables[0].Rows[n]["ReadTime"].ToString()); } if(ds.Tables[0].Rows[n]["Status"].ToString()!="") { model.Status=int.Parse(ds.Tables[0].Rows[n]["Status"].ToString()); } modelList.Add(model); } } return modelList; }