Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_Votei GetModel(int ivote_Id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@ivote_Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = ivote_Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ivote_Id"].ToString() != "")
                {
                    model.ivote_Id = int.Parse(ds.Tables[0].Rows[0]["ivote_Id"].ToString());
                }
                model.ivote_Title = ds.Tables[0].Rows[0]["ivote_Title"].ToString();
                if (ds.Tables[0].Rows[0]["ivote_Count"].ToString() != "")
                {
                    model.ivote_Count = int.Parse(ds.Tables[0].Rows[0]["ivote_Count"].ToString());
                }
                model.ivote_yesUserId = ds.Tables[0].Rows[0]["ivote_yesUserId"].ToString();
                if (ds.Tables[0].Rows[0]["ivote_voteId"].ToString() != "")
                {
                    model.ivote_voteId = int.Parse(ds.Tables[0].Rows[0]["ivote_voteId"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(Tunnel.Model.Tunnel_Votei model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@ivote_Id",        SqlDbType.Int,        4),
                new SqlParameter("@ivote_Title",     SqlDbType.VarChar, 3000),
                new SqlParameter("@ivote_Count",     SqlDbType.Int,        4),
                new SqlParameter("@ivote_yesUserId", SqlDbType.VarChar, 3000),
                new SqlParameter("@ivote_voteId",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ivote_Id;
            parameters[1].Value = model.ivote_Title;
            parameters[2].Value = model.ivote_Count;
            parameters[3].Value = model.ivote_yesUserId;
            parameters[4].Value = model.ivote_voteId;

            DbHelperSQL.RunProcedure("UP_Tunnel_Votei_Update", parameters, out rowsAffected);
        }
Exemplo n.º 3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_Votei model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@ivote_Id",        SqlDbType.Int,        4),
                new SqlParameter("@ivote_Title",     SqlDbType.VarChar, 3000),
                new SqlParameter("@ivote_Count",     SqlDbType.Int,        4),
                new SqlParameter("@ivote_yesUserId", SqlDbType.VarChar, 3000),
                new SqlParameter("@ivote_voteId",    SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.ivote_Title;
            parameters[2].Value     = model.ivote_Count;
            parameters[3].Value     = model.ivote_yesUserId;
            parameters[4].Value     = model.ivote_voteId;

            DbHelperSQL.RunProcedure("UP_Tunnel_Votei_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }