Example #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(Tunnel.Model.Tunnel_CView model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@c_fid",      SqlDbType.BigInt,    8),
                new SqlParameter("@c_uid",      SqlDbType.BigInt,    8),
                new SqlParameter("@c_read",     SqlDbType.Int,       4),
                new SqlParameter("@c_readdate", SqlDbType.DateTime),
                new SqlParameter("@c_content",  SqlDbType.Text)
            };
            parameters[0].Value = model.c_fid;
            parameters[1].Value = model.c_uid;
            parameters[2].Value = model.c_read;
            parameters[3].Value = model.c_readdate;
            parameters[4].Value = model.c_content;

            DbHelperSQL.RunProcedure("UP_Tunnel_CView_Update", parameters, out rowsAffected);
        }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_CView GetModel(long c_id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@c_id", SqlDbType.BigInt)
            };
            parameters[0].Value = c_id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["c_id"].ToString() != "")
                {
                    model.c_id = long.Parse(ds.Tables[0].Rows[0]["c_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["c_fid"].ToString() != "")
                {
                    model.c_fid = long.Parse(ds.Tables[0].Rows[0]["c_fid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["c_uid"].ToString() != "")
                {
                    model.c_uid = long.Parse(ds.Tables[0].Rows[0]["c_uid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["c_read"].ToString() != "")
                {
                    model.c_read = int.Parse(ds.Tables[0].Rows[0]["c_read"].ToString());
                }
                if (ds.Tables[0].Rows[0]["c_readdate"].ToString() != "")
                {
                    model.c_readdate = DateTime.Parse(ds.Tables[0].Rows[0]["c_readdate"].ToString());
                }
                model.c_content = ds.Tables[0].Rows[0]["c_content"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_CView model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@c_id",      SqlDbType.BigInt, 8),
                new SqlParameter("@c_fid",     SqlDbType.BigInt, 8),
                new SqlParameter("@c_uid",     SqlDbType.BigInt, 8),
                new SqlParameter("@c_read",    SqlDbType.Int,    4),
                new SqlParameter("@c_content", SqlDbType.Text)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.c_fid;
            parameters[2].Value     = model.c_uid;
            parameters[3].Value     = model.c_read;
            parameters[4].Value     = model.c_content;

            DbHelperSQL.RunProcedure("UP_Tunnel_CView_ADD", parameters, out rowsAffected);
            return(Convert.ToInt32(parameters[0].Value));
        }