示例#1
0
        public List <Tunnel.Model.Tunnel_VoteRe> GetList(PageBase pb, ref int count)
        {
            DataTable dt = dal.GetList(pb, ref count).Tables[0];
            List <Tunnel.Model.Tunnel_VoteRe> modelList = new List <Tunnel.Model.Tunnel_VoteRe>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0 && pb.DoCount == 0)
            {
                Tunnel.Model.Tunnel_VoteRe model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tunnel.Model.Tunnel_VoteRe();
                    if (dt.Rows[n]["vote_Id"].ToString() != "")
                    {
                        model.vote_Id = int.Parse(dt.Rows[n]["vote_Id"].ToString());
                    }
                    model.vote_Message = dt.Rows[n]["vote_Message"].ToString();
                    if (dt.Rows[n]["vate_Date"].ToString() != "")
                    {
                        model.vate_Date = DateTime.Parse(dt.Rows[n]["vate_Date"].ToString());
                    }
                    if (dt.Rows[n]["vate_userId"].ToString() != "")
                    {
                        model.vate_userId = int.Parse(dt.Rows[n]["vate_userId"].ToString());
                    }
                    if (dt.Rows[n]["vate_voteId"].ToString() != "")
                    {
                        model.vate_voteId = int.Parse(dt.Rows[n]["vate_voteId"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tunnel.Model.Tunnel_VoteRe> DataTableToList(DataTable dt)
        {
            List <Tunnel.Model.Tunnel_VoteRe> modelList = new List <Tunnel.Model.Tunnel_VoteRe>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tunnel.Model.Tunnel_VoteRe model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tunnel.Model.Tunnel_VoteRe();
                    if (dt.Rows[n]["vote_Id"].ToString() != "")
                    {
                        model.vote_Id = int.Parse(dt.Rows[n]["vote_Id"].ToString());
                    }
                    model.vote_Message = dt.Rows[n]["vote_Message"].ToString();
                    if (dt.Rows[n]["vate_Date"].ToString() != "")
                    {
                        model.vate_Date = DateTime.Parse(dt.Rows[n]["vate_Date"].ToString());
                    }
                    if (dt.Rows[n]["vate_userId"].ToString() != "")
                    {
                        model.vate_userId = int.Parse(dt.Rows[n]["vate_userId"].ToString());
                    }
                    if (dt.Rows[n]["vate_voteId"].ToString() != "")
                    {
                        model.vate_voteId = int.Parse(dt.Rows[n]["vate_voteId"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#3
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(Tunnel.Model.Tunnel_VoteRe model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@vote_Id",      SqlDbType.Int,          4),
                new SqlParameter("@vote_Message", SqlDbType.VarChar,   3000),
                new SqlParameter("@vate_Date",    SqlDbType.DateTime),
                new SqlParameter("@vate_userId",  SqlDbType.Int,          4),
                new SqlParameter("@vate_voteId",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.vote_Id;
            parameters[1].Value = model.vote_Message;
            parameters[2].Value = model.vate_Date;
            parameters[3].Value = model.vate_userId;
            parameters[4].Value = model.vate_voteId;

            DbHelperSQL.RunProcedure("UP_Tunnel_VoteRe_Update", parameters, out rowsAffected);
        }
示例#4
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_VoteRe model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@vote_Id",      SqlDbType.Int,          4),
                new SqlParameter("@vote_Message", SqlDbType.VarChar,   3000),
                new SqlParameter("@vate_Date",    SqlDbType.DateTime),
                new SqlParameter("@vate_userId",  SqlDbType.Int,          4),
                new SqlParameter("@vate_voteId",  SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.vote_Message;
            parameters[2].Value     = model.vate_Date;
            parameters[3].Value     = model.vate_userId;
            parameters[4].Value     = model.vate_voteId;

            DbHelperSQL.RunProcedure("UP_Tunnel_VoteRe_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
示例#5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_VoteRe GetModel(int vote_Id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@vote_Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = vote_Id;

            Tunnel.Model.Tunnel_VoteRe model = new Tunnel.Model.Tunnel_VoteRe();
            DataSet ds = DbHelperSQL.RunProcedure("UP_Tunnel_VoteRe_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["vote_Id"].ToString() != "")
                {
                    model.vote_Id = int.Parse(ds.Tables[0].Rows[0]["vote_Id"].ToString());
                }
                model.vote_Message = ds.Tables[0].Rows[0]["vote_Message"].ToString();
                if (ds.Tables[0].Rows[0]["vate_Date"].ToString() != "")
                {
                    model.vate_Date = DateTime.Parse(ds.Tables[0].Rows[0]["vate_Date"].ToString());
                }
                if (ds.Tables[0].Rows[0]["vate_userId"].ToString() != "")
                {
                    model.vate_userId = int.Parse(ds.Tables[0].Rows[0]["vate_userId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["vate_voteId"].ToString() != "")
                {
                    model.vate_voteId = int.Parse(ds.Tables[0].Rows[0]["vate_voteId"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
示例#6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Tunnel.Model.Tunnel_VoteRe model)
 {
     dal.Update(model);
 }
示例#7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Tunnel.Model.Tunnel_VoteRe model)
 {
     return(dal.Add(model));
 }