Пример #1
0
        /// <summary>
        /// Deletes a Notification record
        /// </summary>
        public static int Delete(NotificationDO DO)
        {
            SqlParameter _RegistrationID = new SqlParameter("RegistrationID", SqlDbType.Int);
            SqlParameter _NotificationTypeID = new SqlParameter("NotificationTypeID", SqlDbType.VarChar);

            _RegistrationID.Value = DO.RegistrationID;
            _NotificationTypeID.Value = DO.NotificationTypeID;

            SqlParameter[] _params = new SqlParameter[] {
                _RegistrationID,
                _NotificationTypeID
            };

            return DataCommon.ExecuteScalar("[dbo].[Notification_Delete]", _params, "dbo");
        }
Пример #2
0
        /// <summary>
        /// Creates a new Notification record
        /// </summary>
        public static void Create(NotificationDO DO)
        {
            SqlParameter _RegistrationID = new SqlParameter("RegistrationID", SqlDbType.Int);
            SqlParameter _NotificationTypeID = new SqlParameter("NotificationTypeID", SqlDbType.VarChar);

            _RegistrationID.Value = DO.RegistrationID;
            _NotificationTypeID.Value = DO.NotificationTypeID;

            SqlParameter[] _params = new SqlParameter[] {
                _RegistrationID,
                _NotificationTypeID
            };

            DataCommon.ExecuteNonQuery("[dbo].[Notification_Insert]", _params, "dbo");
        }
Пример #3
0
        /// <summary>
        /// Gets all Notification records
        /// </summary>
        public static NotificationDO[] GetAll()
        {
            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[Notification_GetAll]", new SqlParameter[] { }, "dbo");

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

            while(sr.Read()){

                NotificationDO obj = new NotificationDO();

                obj.RegistrationID = sr.GetInt32(sr.GetOrdinal("RegistrationID"));
                obj.NotificationTypeID = sr.GetString(sr.GetOrdinal("NotificationTypeID"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Пример #4
0
        /// <summary>
        /// Selects Notification records by PK
        /// </summary>
        public static NotificationDO[] GetByPK(Int32 RegistrationID,
 String NotificationTypeID)
        {
            SqlParameter _RegistrationID = new SqlParameter("RegistrationID", SqlDbType.Int);
            SqlParameter _NotificationTypeID = new SqlParameter("NotificationTypeID", SqlDbType.VarChar);

            _RegistrationID.Value = RegistrationID;
            _NotificationTypeID.Value = NotificationTypeID;

            SqlParameter[] _params = new SqlParameter[] {
                _RegistrationID,
                _NotificationTypeID
            };

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

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

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

                obj.RegistrationID = sr.GetInt32(sr.GetOrdinal("RegistrationID"));
                obj.NotificationTypeID = sr.GetString(sr.GetOrdinal("NotificationTypeID"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }