Exemplo n.º 1
0
        public static Card Update(int cardId, string name, int areaId)
        {
            var changeType = CardChangeType.Transfer;
            var db         = DbFactory.Create();
            var card       = db.FindCard(cardId);

            if (card != null)
            {
                if (areaId == card.AreaID)
                {
                    changeType = CardChangeType.Modify;
                    card.Name  = name;
                }

                card.AreaID          = areaId;
                card.ModifiedDateUtc = DateProvider.UtcNow();

                //TODO: db update card does not return card
                db.UpdateCard(card);

                Activity.Create(cardId, areaId, changeType, null);

                return(card);
            }

            return(null);
        }
Exemplo n.º 2
0
        public static Area Delete(int id)
        {
            var db   = DbFactory.Create();
            var area = db.FindArea(id);

            if (area != null)
            {
                area.IsActive        = false;
                area.ModifiedDateUtc = DateProvider.UtcNow();

                return(db.UpdateArea(area));
            }

            return(null);
        }
Exemplo n.º 3
0
        public static Area Update(int id, string name)
        {
            var db   = DbFactory.Create();
            var area = db.FindArea(id);

            if (area != null)
            {
                area.Name            = name;
                area.ModifiedDateUtc = DateProvider.UtcNow();
                db.UpdateArea(area);

                return(area);
            }

            return(null);
        }
Exemplo n.º 4
0
        public static Card Create(string name, int areaId)
        {
            var db   = DbFactory.Create();
            var card = new Card()
            {
                Name            = name,
                AreaID          = areaId,
                CreatedDateUtc  = DateProvider.UtcNow(),
                ModifiedDateUtc = DateProvider.UtcNow()
            };

            card = db.CreateCard(card);

            Activity.Create(card.ID, areaId, CardChangeType.Transfer, null);

            return(card);
        }
Exemplo n.º 5
0
        public static Card Delete(int id)
        {
            var db = DbFactory.Create();

            var card = db.FindCard(id);

            if (card != null)
            {
                card.IsActive        = false;
                card.ModifiedDateUtc = DateProvider.UtcNow();

                db.UpdateCard(card);

                Activity.Create(id, card.AreaID, CardChangeType.Delete, null);

                return(card);
            }

            return(null);
        }
Exemplo n.º 6
0
 public Area()
 {
     IsActive        = true;
     CreatedDateUtc  = DateProvider.UtcNow();
     ModifiedDateUtc = DateProvider.UtcNow();
 }
Exemplo n.º 7
0
 private long getAge()
 {
     return((DateProvider.UtcNow().Date - CreatedDateUtc.Date).Days);
 }
Exemplo n.º 8
0
 private int getDaysSinceLastUpdate()
 {
     return((DateProvider.UtcNow().Date - ModifiedDateUtc.Date).Days);
 }
Exemplo n.º 9
0
 public Card()
 {
     IsActive        = true;
     ModifiedDateUtc = DateProvider.UtcNow();
     CreatedDateUtc  = DateProvider.UtcNow();
 }