Cards: Mark user name of the actions, for auditing purporses.
This commit is contained in:
@@ -34,7 +34,15 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
|
|
||||||
public List<Card> Cards_Status()
|
public List<Card> Cards_Status()
|
||||||
{
|
{
|
||||||
return _cards;
|
List<Card> activeCards=new List<Card>();
|
||||||
|
foreach (Card card in _cards)
|
||||||
|
{
|
||||||
|
if (card.Active)
|
||||||
|
{
|
||||||
|
activeCards.Add(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return activeCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ICardEvent> Cards_GetEventList(int idCardEvent)
|
public List<ICardEvent> Cards_GetEventList(int idCardEvent)
|
||||||
@@ -62,7 +70,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
return _lastIDCard;
|
return _lastIDCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Card_Create(string title, string body, int x, int y)
|
public int Card_Create(string title, string body, int x, int y, string currentUserName)
|
||||||
{
|
{
|
||||||
Card card;
|
Card card;
|
||||||
lock (_cards)
|
lock (_cards)
|
||||||
@@ -76,6 +84,9 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
Body = body,
|
Body = body,
|
||||||
X = x,
|
X = x,
|
||||||
Y = y,
|
Y = y,
|
||||||
|
Active = true,
|
||||||
|
CreatedBy = currentUserName,
|
||||||
|
ModifiedBy = currentUserName,
|
||||||
};
|
};
|
||||||
_cards.Add(card);
|
_cards.Add(card);
|
||||||
|
|
||||||
@@ -85,6 +96,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
{
|
{
|
||||||
IDCardEvent = _lastIDCardEvent,
|
IDCardEvent = _lastIDCardEvent,
|
||||||
IDCard = card.IDCard,
|
IDCard = card.IDCard,
|
||||||
|
UserName = currentUserName,
|
||||||
Title = card.Title,
|
Title = card.Title,
|
||||||
Body = card.Body,
|
Body = card.Body,
|
||||||
X = card.X,
|
X = card.X,
|
||||||
@@ -97,7 +109,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
return card.IDCard;
|
return card.IDCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Card_Move(int idCard, int x, int y)
|
public bool Card_Move(int idCard, int x, int y, string currentUserName)
|
||||||
{
|
{
|
||||||
lock (_cards)
|
lock (_cards)
|
||||||
{
|
{
|
||||||
@@ -106,6 +118,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
if (card == null) { return false; }
|
if (card == null) { return false; }
|
||||||
card.X = x;
|
card.X = x;
|
||||||
card.Y = y;
|
card.Y = y;
|
||||||
|
card.ModifiedBy = currentUserName;
|
||||||
|
|
||||||
// Create event
|
// Create event
|
||||||
_lastIDCardEvent++;
|
_lastIDCardEvent++;
|
||||||
@@ -113,6 +126,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
{
|
{
|
||||||
IDCardEvent = _lastIDCardEvent,
|
IDCardEvent = _lastIDCardEvent,
|
||||||
IDCard = card.IDCard,
|
IDCard = card.IDCard,
|
||||||
|
UserName = currentUserName,
|
||||||
X = card.X,
|
X = card.X,
|
||||||
Y = card.Y,
|
Y = card.Y,
|
||||||
};
|
};
|
||||||
@@ -123,7 +137,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Card_Edit(int idCard, string title, string body)
|
public bool Card_Edit(int idCard, string title, string body, string currentUserName)
|
||||||
{
|
{
|
||||||
lock (_cards)
|
lock (_cards)
|
||||||
{
|
{
|
||||||
@@ -132,6 +146,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
if (card == null) { return false; }
|
if (card == null) { return false; }
|
||||||
card.Title = title;
|
card.Title = title;
|
||||||
card.Body = body;
|
card.Body = body;
|
||||||
|
card.ModifiedBy = currentUserName;
|
||||||
|
|
||||||
// Create event
|
// Create event
|
||||||
_lastIDCardEvent++;
|
_lastIDCardEvent++;
|
||||||
@@ -139,6 +154,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
{
|
{
|
||||||
IDCardEvent = _lastIDCardEvent,
|
IDCardEvent = _lastIDCardEvent,
|
||||||
IDCard = card.IDCard,
|
IDCard = card.IDCard,
|
||||||
|
UserName = currentUserName,
|
||||||
Title = card.Title,
|
Title = card.Title,
|
||||||
Body = card.Body,
|
Body = card.Body,
|
||||||
};
|
};
|
||||||
@@ -148,22 +164,24 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Card_Delete(int idCard)
|
public bool Card_Delete(int idCard, string currentUserName)
|
||||||
{
|
{
|
||||||
lock (_cards)
|
lock (_cards)
|
||||||
{
|
{
|
||||||
// Delete card
|
// Delete card
|
||||||
Card card = GetByID(idCard);
|
Card card = GetByID(idCard);
|
||||||
if (card == null) { return false; }
|
if (card == null) { return false; }
|
||||||
_cards.Remove(card);
|
card.Active = false;
|
||||||
|
card.ModifiedBy = currentUserName;
|
||||||
|
|
||||||
// Create event
|
// Create event
|
||||||
_lastIDCardEvent++;
|
_lastIDCardEvent++;
|
||||||
CardDeleteEvent cardDeleteEvent = new CardDeleteEvent()
|
CardDeleteEvent cardDeleteEvent = new CardDeleteEvent()
|
||||||
{
|
{
|
||||||
IDCardEvent = _lastIDCardEvent,
|
IDCardEvent = _lastIDCardEvent,
|
||||||
IDCard = card.IDCard,
|
IDCard = card.IDCard,
|
||||||
|
UserName = currentUserName,
|
||||||
};
|
};
|
||||||
_cardEvents.Insert(0, cardDeleteEvent);
|
_cardEvents.Insert(0, cardDeleteEvent);
|
||||||
|
|
||||||
@@ -181,6 +199,7 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
{
|
{
|
||||||
IDCardEvent = lastIDCardEvent,
|
IDCardEvent = lastIDCardEvent,
|
||||||
IDCard = card.IDCard,
|
IDCard = card.IDCard,
|
||||||
|
UserName = card.ModifiedBy,
|
||||||
Title = card.Title,
|
Title = card.Title,
|
||||||
Body = card.Body,
|
Body = card.Body,
|
||||||
X = card.X,
|
X = card.X,
|
||||||
@@ -216,9 +235,12 @@ namespace Scrummer.Code.BusinessLogic
|
|||||||
{
|
{
|
||||||
_cards = Persistence.LoadList<Card>(String.Format(CardsPersistenceFile, _idBoard));
|
_cards = Persistence.LoadList<Card>(String.Format(CardsPersistenceFile, _idBoard));
|
||||||
_lastIDCard = 0;
|
_lastIDCard = 0;
|
||||||
if (_cards.Count > 0)
|
foreach (Card card in _cards)
|
||||||
{
|
{
|
||||||
_lastIDCard = _cards[0].IDCard;
|
if (card.IDCard > _lastIDCard)
|
||||||
|
{
|
||||||
|
_lastIDCard = card.IDCard;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_cardEvents = Persistence.LoadList<ICardEvent>(String.Format(EventsPersistenceFile, _idBoard),
|
_cardEvents = Persistence.LoadList<ICardEvent>(String.Format(EventsPersistenceFile, _idBoard),
|
||||||
|
|||||||
@@ -14,5 +14,9 @@ namespace Scrummer.Code.Entities
|
|||||||
|
|
||||||
public int X { get; set; }
|
public int X { get; set; }
|
||||||
public int Y { get; set; }
|
public int Y { get; set; }
|
||||||
|
|
||||||
|
public bool Active { get; set; }
|
||||||
|
public string CreatedBy { get; set; }
|
||||||
|
public string ModifiedBy { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,6 +136,8 @@ namespace Scrummer.Controls
|
|||||||
|
|
||||||
private void ProcessEventSender(HttpContext context)
|
private void ProcessEventSender(HttpContext context)
|
||||||
{
|
{
|
||||||
|
Session session = Sessions.Current.Session_GetCurrent(context);
|
||||||
|
string currentUserName = session.UserName;
|
||||||
string strIDBoard = GetRequestParm(context, "IDBoard");
|
string strIDBoard = GetRequestParm(context, "IDBoard");
|
||||||
int idBoard = Convert.ToInt32(string.IsNullOrEmpty(strIDBoard) ? "0" : strIDBoard);
|
int idBoard = Convert.ToInt32(string.IsNullOrEmpty(strIDBoard) ? "0" : strIDBoard);
|
||||||
string command = GetRequestParm(context, "Command");
|
string command = GetRequestParm(context, "Command");
|
||||||
@@ -150,7 +152,7 @@ namespace Scrummer.Controls
|
|||||||
string body = GetRequestParm(context, "Body");
|
string body = GetRequestParm(context, "Body");
|
||||||
int x = Convert.ToInt32(GetRequestParm(context, "X"));
|
int x = Convert.ToInt32(GetRequestParm(context, "X"));
|
||||||
int y = Convert.ToInt32(GetRequestParm(context, "Y"));
|
int y = Convert.ToInt32(GetRequestParm(context, "Y"));
|
||||||
idCard = cardBoard.Card_Create(title, body, x, y);
|
idCard = cardBoard.Card_Create(title, body, x, y, currentUserName);
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
if (command == "Move")
|
if (command == "Move")
|
||||||
@@ -158,7 +160,7 @@ namespace Scrummer.Controls
|
|||||||
idCard = Convert.ToInt32(GetRequestParm(context, "IDCard"));
|
idCard = Convert.ToInt32(GetRequestParm(context, "IDCard"));
|
||||||
int x = Convert.ToInt32(GetRequestParm(context, "X"));
|
int x = Convert.ToInt32(GetRequestParm(context, "X"));
|
||||||
int y = Convert.ToInt32(GetRequestParm(context, "Y"));
|
int y = Convert.ToInt32(GetRequestParm(context, "Y"));
|
||||||
cardBoard.Card_Move(idCard, x, y);
|
cardBoard.Card_Move(idCard, x, y, currentUserName);
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
if (command == "Edit")
|
if (command == "Edit")
|
||||||
@@ -166,13 +168,13 @@ namespace Scrummer.Controls
|
|||||||
idCard = Convert.ToInt32(GetRequestParm(context, "IDCard"));
|
idCard = Convert.ToInt32(GetRequestParm(context, "IDCard"));
|
||||||
string title = GetRequestParm(context, "Title");
|
string title = GetRequestParm(context, "Title");
|
||||||
string body = GetRequestParm(context, "Body");
|
string body = GetRequestParm(context, "Body");
|
||||||
cardBoard.Card_Edit(idCard, title, body);
|
cardBoard.Card_Edit(idCard, title, body, currentUserName);
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
if (command == "Delete")
|
if (command == "Delete")
|
||||||
{
|
{
|
||||||
idCard = Convert.ToInt32(GetRequestParm(context, "IDCard"));
|
idCard = Convert.ToInt32(GetRequestParm(context, "IDCard"));
|
||||||
cardBoard.Card_Delete(idCard);
|
cardBoard.Card_Delete(idCard, currentUserName);
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user