/// <summary> /// Change the position of an issue within the readlist, shifting surrounding issues automatically /// </summary> /// <param name="index">Issue to move</param> /// <param name="pos">New position</param> public void setPosition(int index, int pos) { ReadlistIssue readlistIssue = (ReadlistIssue)Issues[index]; for (int i = 0; i < Issues.Count; i++) { if (i != index) { ReadlistIssue readlistIssue2 = (ReadlistIssue)Issues[i]; if (readlistIssue2.Position < readlistIssue.Position) { if (readlistIssue2.Position >= pos && pos < readlistIssue.Position) { readlistIssue2.Position++; } } else if (readlistIssue2.Position > readlistIssue.Position && readlistIssue2.Position <= pos && pos > readlistIssue.Position) { readlistIssue2.Position--; } } } readlistIssue.Position = pos; Changes.Add("Issues"); }
public void DeleteIssue(int index) { ReadlistIssue readlistIssue = (ReadlistIssue)Issues[index]; CC.SQL.ExecQuery("DELETE FROM readlist_issues WHERE id=" + readlistIssue.RowID); DeleteQueue.Add(readlistIssue); correctPositions(); SaveChanges(); }
public new int CompareTo(object o) { ReadlistIssue readlistIssue = (ReadlistIssue)o; return(Position.CompareTo(readlistIssue.Position)); }