예제 #1
0
 public IssueViewModel()
 {
     this.Issue = new Issue();
     validator = new UserDataValidator();
 }
예제 #2
0
 public IssueViewModel(Issue issue)
 {
     this.Issue = issue;
     validator = new UserDataValidator();
 }
예제 #3
0
 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();
 }
예제 #4
0
        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());
        }
예제 #5
0
        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;
                }
            }
        }
예제 #6
0
        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;
                }
            }
        }
예제 #7
0
        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();
        }