Exemplo n.º 1
0
        public static bool SaveNotifications(SQLiteConnection conn, List <Notification> notifications)
        {
            SQLiteTransaction transaction;

            transaction = conn.BeginTransaction();

            try
            {
                foreach (Notification notification in notifications)
                {
                    int r = NotificationDbMapper.Insert(conn, notification);
                    if (r != 0)
                    {
                        throw new Exception("error inserting nofitication to DB");
                    }
                }
                transaction.Commit();
            }

            catch (Exception e)
            {
                transaction.Rollback();
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public static void Delete(SQLiteConnection conn, int id)
        {
            List <Notification> notifications = NotificationDbMapper.SelectByInspectionId(conn, id);

            foreach (Notification notify in notifications)
            {
                NotificationDbMapper.Delete(conn, notify.Id);
            }

            InspectionDbMapper.Delete(conn, id);
        }
Exemplo n.º 3
0
 public static List <Notification> GetNotifications(SQLiteConnection conn, int days)
 {
     return(NotificationDbMapper.GenerateNotifications(conn, 30));
 }
Exemplo n.º 4
0
 public static void Delete(SQLiteConnection conn, int id)
 {
     NotificationDbMapper.Delete(conn, id);
 }