public IssueViewModel() { this.Issue = new Issue(); validator = new UserDataValidator(); }
public IssueViewModel(Issue issue) { this.Issue = issue; validator = new UserDataValidator(); }
private void UpdateIssueInDB(Issue issue, int userID) { new SQLiteCommand(SQLFixedQueries.UpdateIssue(issue.IssueID, issue.Description, userID, issue.DateClosed.ToString(), issue.PlantContact, issue.IssueState, issue.IssueResolution, issue.Priority, issue.Severity), conn).ExecuteNonQuery(); }
private int InsertIssueInDBAndGetID(Issue issue, int userID) { new SQLiteCommand(SQLFixedQueries.InsertIssue(issue.Description, userID, issue.DateCreated.ToString(), issue.PlantContact, issue.IssueType, issue.IssueState, issue.IssueResolution, issue.Priority, issue.Severity), conn).ExecuteNonQuery(); return Convert.ToInt32(new SQLiteCommand(SQLFixedQueries.GetRowID(), conn) .ExecuteScalar()); }
int IDataAccess.SaveChangeRequest(Issue issue, ChangeRequest changeRequest) { using (conn = new SQLiteConnection(connectionString)) { conn.Open(); if (issue.IssueID == 0 || !IssueExists(issue.IssueID)) { int ID = InsertIssueInDBAndGetID(issue, GetUserID(issue.UserCreated)); InsertChangeRequestInDB(changeRequest, ID); return ID; } else { UpdateIssueInDB(issue, GetUserID(issue.UserClosed)); UpdateChangeRequestInDB(changeRequest); return issue.IssueID; } } }
int IDataAccess.SaveBug(Issue issue, Bug bug) { using (conn = new SQLiteConnection(connectionString)) { conn.Open(); if (issue.IssueID == 0 || !IssueExists(issue.IssueID)) { int ID = InsertIssueInDBAndGetID(issue, GetUserID(issue.UserCreated)); InsertBugInDB(bug, ID); return ID; } else { UpdateIssueInDB(issue, GetUserID(issue.UserClosed)); UpdateBugInDB(bug); return issue.IssueID; } } }
public TabBugViewModel(Messenger messenger, DialogCoordinator dialogCoordinator, IDataAccess dataAccess, Bug bug, Issue issue) : base(issue) { this.messenger = messenger; this.dialogCoordinator = dialogCoordinator; this.dataAccess = dataAccess; this.Bug = bug; this.ID = bug.ID; ShowCloseButton = true; TabHeader = "Bug #" + IssueID.ToString(); }