Beispiel #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <NoName.NetShop.Model.AnswerModel> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List <NoName.NetShop.Model.AnswerModel> modelList = new List <NoName.NetShop.Model.AnswerModel>();
            int rowsCount = ds.Tables[0].Rows.Count;

            if (rowsCount > 0)
            {
                NoName.NetShop.Model.AnswerModel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new NoName.NetShop.Model.AnswerModel();
                    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]["AnswerId"].ToString() != "")
                    {
                        model.AnswerId = int.Parse(ds.Tables[0].Rows[n]["AnswerId"].ToString());
                    }
                    model.Title   = ds.Tables[0].Rows[n]["Title"].ToString();
                    model.Brief   = ds.Tables[0].Rows[n]["Brief"].ToString();
                    model.Content = ds.Tables[0].Rows[n]["Content"].ToString();
                    if (ds.Tables[0].Rows[n]["AnswerTime"].ToString() != "")
                    {
                        model.AnswerTime = DateTime.Parse(ds.Tables[0].Rows[n]["AnswerTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(NoName.NetShop.Model.AnswerModel model)
 {
     dal.Update(model);
 }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(NoName.NetShop.Model.AnswerModel model)
 {
     dal.Add(model);
 }
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<NoName.NetShop.Model.AnswerModel> GetModelList(string strWhere)
 {
     DataSet ds = dal.GetList(strWhere);
     List<NoName.NetShop.Model.AnswerModel> modelList = new List<NoName.NetShop.Model.AnswerModel>();
     int rowsCount = ds.Tables[0].Rows.Count;
     if (rowsCount > 0)
     {
         NoName.NetShop.Model.AnswerModel model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new NoName.NetShop.Model.AnswerModel();
             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]["AnswerId"].ToString()!="")
             {
                 model.AnswerId=int.Parse(ds.Tables[0].Rows[n]["AnswerId"].ToString());
             }
             model.Title=ds.Tables[0].Rows[n]["Title"].ToString();
             model.Brief=ds.Tables[0].Rows[n]["Brief"].ToString();
             model.Content=ds.Tables[0].Rows[n]["Content"].ToString();
             if(ds.Tables[0].Rows[n]["AnswerTime"].ToString()!="")
             {
                 model.AnswerTime=DateTime.Parse(ds.Tables[0].Rows[n]["AnswerTime"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }