/// <summary> /// Updates a Notification record and returns the number of records affected /// </summary> public static int Update(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 }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; return DataCommon.ExecuteScalar("[dbo].[Notification_Update]", _params, pid); }
/// <summary> /// Creates a new Notification record using async /// </summary> public static async Task CreateAsync(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 }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; await DataCommon.ExecuteNonQueryAsync("[dbo].[Notification_Insert]", _params, pid); }
/// <summary> /// Selects Notification records by PK /// </summary> public static async Task<NotificationDO[]> GetByPKAsync(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 }; string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[Notification_GetByPK]", _params, pid); 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(); }
/// <summary> /// Gets all Notification records /// </summary> public static async Task<NotificationDO[]> GetAllAsync() { string pid = ConfigurationManager.AppSettings["ePermitDAL"]; SafeReader sr = await DataCommon.ExecuteSafeReaderAsync("[dbo].[Notification_GetAll]", new SqlParameter[] { }, pid); 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(); }