コード例 #1
0
        /// <summary>
        /// Updates a Announcement record and returns the number of records affected
        /// </summary>
        public static int Update(AnnouncementDO DO)
        {
            SqlParameter _AnnouncementID = new SqlParameter("AnnouncementID", SqlDbType.Int);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            
            _AnnouncementID.Value = DO.AnnouncementID;
            _Description.Value = DO.Description;
            
            SqlParameter[] _params = new SqlParameter[] {
                _AnnouncementID,
                _Description
            };

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

            return DataCommon.ExecuteScalar("[dbo].[Announcement_Update]", _params, pid);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new Announcement record using async
        /// </summary>
        public static async Task CreateAsync(AnnouncementDO DO)
        {
            SqlParameter _AnnouncementID = new SqlParameter("AnnouncementID", SqlDbType.Int);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            
            _AnnouncementID.Value = DO.AnnouncementID;
            _Description.Value = DO.Description;
            
            SqlParameter[] _params = new SqlParameter[] {
                _AnnouncementID,
                _Description
            };

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

            await DataCommon.ExecuteNonQueryAsync("[dbo].[Announcement_Insert]", _params, pid);
            
        }
コード例 #3
0
        /// <summary>
        /// Gets all Announcement records
        /// </summary>
        public static async Task<AnnouncementDO[]> GetAllAsync()
        {

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

            SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[Announcement_GetAll]", new SqlParameter[] { }, pid);
            
            List<AnnouncementDO> objs = new List<AnnouncementDO>();
            
            while(sr.Read()){

                AnnouncementDO obj = new AnnouncementDO();
                
                obj.AnnouncementID = sr.GetInt32(sr.GetOrdinal("AnnouncementID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                


                objs.Add(obj);
            }

            return objs.ToArray();
        }
コード例 #4
0
        /// <summary>
        /// Selects Announcement records by PK
        /// </summary>
        public static async Task<AnnouncementDO[]> GetByPKAsync(Int32 AnnouncementID)
        {

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

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

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


            List<AnnouncementDO> objs = new List<AnnouncementDO>();
			
            while(sr.Read())
            {
                AnnouncementDO obj = new AnnouncementDO();
				
                obj.AnnouncementID = sr.GetInt32(sr.GetOrdinal("AnnouncementID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                

                objs.Add(obj);
            }

            return objs.ToArray();
        }
コード例 #5
0
        /// <summary>
        /// Deletes a Announcement record
        /// </summary>
        public static async Task<int> DeleteAsync(AnnouncementDO DO)
        {
            SqlParameter _AnnouncementID = new SqlParameter("AnnouncementID", SqlDbType.Int);
            
            _AnnouncementID.Value = DO.AnnouncementID;
            
            SqlParameter[] _params = new SqlParameter[] {
                _AnnouncementID
            };

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

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