示例#1
0
        /// <summary>
        /// Creates a new TOC record using async
        /// </summary>
        public static async Task<int> CreateAsync(TOCDO DO)
        {
            SqlParameter _ParentTOCID = new SqlParameter("ParentTOCID", SqlDbType.Int);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            SqlParameter _NavigateUrl = new SqlParameter("NavigateUrl", SqlDbType.VarChar);
            SqlParameter _Instructions = new SqlParameter("Instructions", SqlDbType.VarChar);
            SqlParameter _Active = new SqlParameter("Active", SqlDbType.Bit);
            SqlParameter _DisplayOrder = new SqlParameter("DisplayOrder", SqlDbType.SmallInt);
            
            _ParentTOCID.Value = DO.ParentTOCID;
            _Description.Value = DO.Description;
            _NavigateUrl.Value = DO.NavigateUrl;
            _Instructions.Value = DO.Instructions;
            _Active.Value = DO.Active;
            _DisplayOrder.Value = DO.DisplayOrder;
            
            SqlParameter[] _params = new SqlParameter[] {
                _ParentTOCID,
                _Description,
                _NavigateUrl,
                _Instructions,
                _Active,
                _DisplayOrder
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            return await DataCommon.ExecuteScalarAsync("[dbo].[TOC_Insert]", _params, pid);
            
        }
示例#2
0
        /// <summary>
        /// Gets all TOC records
        /// </summary>
        public static TOCDO[] GetAll()
        {

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[TOC_GetAll]", new SqlParameter[] { }, pid);
            
            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.Instructions = sr.GetString(sr.GetOrdinal("Instructions"));
                obj.Active = sr.GetBoolean(sr.GetOrdinal("Active"));
                if (sr.IsDBNull(sr.GetOrdinal("DisplayOrder"))) { obj.DisplayOrder = null; } else { obj.DisplayOrder = sr.GetInt16(sr.GetOrdinal("DisplayOrder")); }


                objs.Add(obj);
            }

            return objs.ToArray();
        }
示例#3
0
        /// <summary>
        /// Selects TOC records by PK
        /// </summary>
        public static async Task<TOCDO[]> GetByPKAsync(Int32 TOCID)
        {

            SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int);
			
            _TOCID.Value = TOCID;
			
            SqlParameter[] _params = new SqlParameter[] {
                _TOCID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[TOC_GetByPK]", _params, pid);


            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.Instructions = sr.GetString(sr.GetOrdinal("Instructions"));
                obj.Active = sr.GetBoolean(sr.GetOrdinal("Active"));
                if (sr.IsDBNull(sr.GetOrdinal("DisplayOrder"))) { obj.DisplayOrder = null; } else { obj.DisplayOrder = sr.GetInt16(sr.GetOrdinal("DisplayOrder")); }

                objs.Add(obj);
            }

            return objs.ToArray();
        }
示例#4
0
        /// <summary>
        /// Deletes a TOC record
        /// </summary>
        public static async Task<int> DeleteAsync(TOCDO DO)
        {
            SqlParameter _TOCID = new SqlParameter("TOCID", SqlDbType.Int);
            
            _TOCID.Value = DO.TOCID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _TOCID
            };

            string pid = ConfigurationManager.AppSettings["ePermitDAL"];

            return await DataCommon.ExecuteScalarAsync("[dbo].[TOC_Delete]", _params, pid);
        }