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

            if (rowsCount > 0)
            {
                NoName.NetShop.Model.VoteTopicModel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new NoName.NetShop.Model.VoteTopicModel();
                    if (ds.Tables[0].Rows[n]["VoteId"].ToString() != "")
                    {
                        model.VoteId = int.Parse(ds.Tables[0].Rows[n]["VoteId"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["ContentId"].ToString() != "")
                    {
                        model.ContentId = int.Parse(ds.Tables[0].Rows[n]["ContentId"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["ContentType"].ToString() != "")
                    {
                        model.ContentType = int.Parse(ds.Tables[0].Rows[n]["ContentType"].ToString());
                    }
                    model.Topic  = ds.Tables[0].Rows[n]["Topic"].ToString();
                    model.Remark = ds.Tables[0].Rows[n]["Remark"].ToString();
                    if (ds.Tables[0].Rows[n]["StartTime"].ToString() != "")
                    {
                        model.StartTime = DateTime.Parse(ds.Tables[0].Rows[n]["StartTime"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["EndTime"].ToString() != "")
                    {
                        model.EndTime = DateTime.Parse(ds.Tables[0].Rows[n]["EndTime"].ToString());
                    }
                    if (ds.Tables[0].Rows[n]["IsRegUser"].ToString() != "")
                    {
                        if ((ds.Tables[0].Rows[n]["IsRegUser"].ToString() == "1") || (ds.Tables[0].Rows[n]["IsRegUser"].ToString().ToLower() == "true"))
                        {
                            model.IsRegUser = true;
                        }
                        else
                        {
                            model.IsRegUser = false;
                        }
                    }
                    if (ds.Tables[0].Rows[n]["VoteUserNum"].ToString() != "")
                    {
                        model.VoteUserNum = int.Parse(ds.Tables[0].Rows[n]["VoteUserNum"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<NoName.NetShop.Model.VoteTopicModel> GetModelList(string strWhere)
 {
     DataSet ds = dal.GetList(strWhere);
     List<NoName.NetShop.Model.VoteTopicModel> modelList = new List<NoName.NetShop.Model.VoteTopicModel>();
     int rowsCount = ds.Tables[0].Rows.Count;
     if (rowsCount > 0)
     {
         NoName.NetShop.Model.VoteTopicModel model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new NoName.NetShop.Model.VoteTopicModel();
             if(ds.Tables[0].Rows[n]["VoteId"].ToString()!="")
             {
                 model.VoteId=int.Parse(ds.Tables[0].Rows[n]["VoteId"].ToString());
             }
             if(ds.Tables[0].Rows[n]["ContentId"].ToString()!="")
             {
                 model.ContentId=int.Parse(ds.Tables[0].Rows[n]["ContentId"].ToString());
             }
             if(ds.Tables[0].Rows[n]["ContentType"].ToString()!="")
             {
                 model.ContentType=int.Parse(ds.Tables[0].Rows[n]["ContentType"].ToString());
             }
             model.Topic=ds.Tables[0].Rows[n]["Topic"].ToString();
             model.Remark=ds.Tables[0].Rows[n]["Remark"].ToString();
             if(ds.Tables[0].Rows[n]["StartTime"].ToString()!="")
             {
                 model.StartTime=DateTime.Parse(ds.Tables[0].Rows[n]["StartTime"].ToString());
             }
             if(ds.Tables[0].Rows[n]["EndTime"].ToString()!="")
             {
                 model.EndTime=DateTime.Parse(ds.Tables[0].Rows[n]["EndTime"].ToString());
             }
             if(ds.Tables[0].Rows[n]["IsRegUser"].ToString()!="")
             {
                 if((ds.Tables[0].Rows[n]["IsRegUser"].ToString()=="1")||(ds.Tables[0].Rows[n]["IsRegUser"].ToString().ToLower()=="true"))
                 {
                 model.IsRegUser=true;
                 }
                 else
                 {
                     model.IsRegUser=false;
                 }
             }
             if(ds.Tables[0].Rows[n]["VoteUserNum"].ToString()!="")
             {
                 model.VoteUserNum=int.Parse(ds.Tables[0].Rows[n]["VoteUserNum"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
コード例 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(NoName.NetShop.Model.VoteTopicModel model)
 {
     dal.Update(model);
 }
コード例 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(NoName.NetShop.Model.VoteTopicModel model)
 {
     dal.Add(model);
 }