Exemplo n.º 1
0
        /// <summary>
        /// Deletes a TOC record
        /// </summary>
        public static int Delete(TOCDO DO)
        {
            SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int);

            _TOCID.Value = DO.TOCID;

            SqlParameter[] _params = new SqlParameter[] {
                _TOCID
            };

            return DataCommon.ExecuteScalar("[dbo].[TOC_Delete]", _params, "dbo");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets all TOC records
        /// </summary>
        public static TOCDO[] GetAll()
        {
            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[TOC_GetAll]", new SqlParameter[] { }, "dbo");

            List<TOCDO> objs = new List<TOCDO>();

            while(sr.Read()){

                TOCDO obj = new TOCDO();

                obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID"));
                obj.ParentTOCID = sr.GetInt32(sr.GetOrdinal("ParentTOCID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                obj.NavigateUrl = sr.GetString(sr.GetOrdinal("NavigateUrl"));
                obj.Tips = sr.GetString(sr.GetOrdinal("Tips"));
                obj.Active = sr.GetBoolean(sr.GetOrdinal("Active"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new TOC record
        /// </summary>
        public static int Create(TOCDO DO)
        {
            SqlParameter _ParentTOCID = new SqlParameter("ParentTOCID", SqlDbType.Int);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            SqlParameter _NavigateUrl = new SqlParameter("NavigateUrl", SqlDbType.VarChar);
            SqlParameter _Tips = new SqlParameter("Tips", SqlDbType.VarChar);
            SqlParameter _Active = new SqlParameter("Active", SqlDbType.Bit);

            _ParentTOCID.Value = DO.ParentTOCID;
            _Description.Value = DO.Description;
            _NavigateUrl.Value = DO.NavigateUrl;
            _Tips.Value = DO.Tips;
            _Active.Value = DO.Active;

            SqlParameter[] _params = new SqlParameter[] {
                _ParentTOCID,
                _Description,
                _NavigateUrl,
                _Tips,
                _Active
            };

            return DataCommon.ExecuteScalar("[dbo].[TOC_Insert]", _params, "dbo");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Selects TOC records by PK
        /// </summary>
        public static TOCDO[] GetByPK(Int32 TOCID)
        {
            SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int);

            _TOCID.Value = TOCID;

            SqlParameter[] _params = new SqlParameter[] {
                _TOCID
            };

            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[TOC_GetByPK]", _params, "dbo");

            List<TOCDO> objs = new List<TOCDO>();

            while(sr.Read())
            {
                TOCDO obj = new TOCDO();

                obj.TOCID = sr.GetInt32(sr.GetOrdinal("TOCID"));
                obj.ParentTOCID = sr.GetInt32(sr.GetOrdinal("ParentTOCID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                obj.NavigateUrl = sr.GetString(sr.GetOrdinal("NavigateUrl"));
                obj.Tips = sr.GetString(sr.GetOrdinal("Tips"));
                obj.Active = sr.GetBoolean(sr.GetOrdinal("Active"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }