Esempio n. 1
0
        public Stream Read(IOutItem item)
        {
            var filename = ItemFile(item);

            return(new FileStream(
                       filename,
                       FileMode.Open
                       ));
        }
Esempio n. 2
0
        private void SetFlag(IOutItem item, string flag)
        {
            var cmd = SqlConn.CreateCommand();

            cmd.CommandText =
                $@"
                   Update items set {flag} = julianday('now') where {Cols.Id} =  @{Cols.Id}
               ";
            cmd.Parameters.Add(Cols.Id, DbType.UInt32).Value = item.Id;
            cmd.ExecuteNonQuery();
        }
Esempio n. 3
0
        public FileStream AddWrite(IOutItem item)
        {
            var filename = ItemFile(item);

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }
            return(new FileStream(
                       filename,
                       FileMode.CreateNew
                       ));
        }
Esempio n. 4
0
        public void AddRollback(IOutItem item)
        {
            var filename = ItemFile(item);

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            var cmd = SqlConn.CreateCommand();

            cmd.CommandText =
                $@"
                   delete from items where {Cols.Id}  =  @{Cols.Id} 
               ";
            cmd.Parameters.Add(Cols.Id, DbType.UInt32).Value = item.Id;
            cmd.ExecuteNonQuery();
        }
Esempio n. 5
0
 public string ItemFile(IOutItem item) =>
 Path.Combine(StorageFolder, item.Id.ToString() + ".txt");
Esempio n. 6
0
 public void AddCommit(IOutItem item)
 {
     this.SetFlag(item, Cols.Commited);
     this.OnAddItem?.Invoke(this.Queue, item);
 }
Esempio n. 7
0
 public void Fault(IOutItem item)
 {
     SetFlag(item, Cols.Faulted);
 }
Esempio n. 8
0
 public void Deliver(IOutItem item)
 {
     SetFlag(item, Cols.Delivered);
 }
Esempio n. 9
0
 public void Send(IOutItem item)
 {
     SetFlag(item, Cols.Sent);
 }