Example #1
0
        public Attachments GetAttachments(long issueID, long actionID)
        {
            //Get attachments for the specified action
            Attachments attachments = null;

            try {
                //Filter attachments
                attachments = new Attachments();
                if (issueID != 0)
                {
                    DataSet ds = fillDataset(USP_ATTACHMENTS, TBL_ATTACHMENTS, new object[] { issueID });
                    if (ds.Tables[TBL_ATTACHMENTS].Rows.Count != 0)
                    {
                        IssueDS attachmentsDS = new IssueDS();
                        attachmentsDS.Merge(ds);
                        for (int i = 0; i < attachmentsDS.AttachmentTable.Rows.Count; i++)
                        {
                            Attachment attachment = new Attachment(attachmentsDS.AttachmentTable[i]);
                            if (attachment.ActionID == actionID)
                            {
                                attachments.Add(attachment);
                            }
                        }
                    }
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading issue attachments.", ex); }
            return(attachments);
        }
Example #2
0
        public Issue GetIssue(long issueID)
        {
            //Get an existing issue
            Issue issue = null;

            try {
                //New or existing?
                if (issueID == 0)
                {
                    //Build a new issue object
                    issue = new Issue();
                }
                else
                {
                    //Build an issue object (including actions and attachments)
                    IssueDS issues = new IssueDS();
                    DataSet ds     = fillDataset(USP_ISSUE_GET, TBL_ISSUE, new object[] { issueID });
                    if (ds.Tables[TBL_ISSUE].Rows.Count == 0)
                    {
                        throw new ApplicationException("Issue not found.");
                    }
                    else
                    {
                        issues.Merge(ds);
                    }
                    issue = new Issue(issues.IssueTable[0]);
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading issue.", ex); }
            return(issue);
        }
Example #3
0
        public Actions GetIssueActions(long issueID)
        {
            //Get all actions for the specified issue
            Actions actions = null;

            try {
                //New or existing?
                actions = new Actions();
                if (issueID > 0)
                {
                    DataSet ds = fillDataset(USP_ACTIONS, TBL_ACTIONS, new object[] { issueID });
                    if (ds.Tables[TBL_ACTIONS].Rows.Count == 0)
                    {
                        throw new ApplicationException("No actions found for this issue.");
                    }
                    else
                    {
                        DataSet _ds = new DataSet();
                        _ds.Merge(ds.Tables[TBL_ACTIONS].Select("", "Created DESC"));
                        IssueDS actionsDS = new IssueDS();
                        actionsDS.Merge(_ds);
                        for (int i = 0; i < actionsDS.ActionTable.Rows.Count; i++)
                        {
                            Action action = new Action(actionsDS.ActionTable[i]);
                            actions.Add(action);
                        }
                    }
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading issue actions.", ex); }
            return(actions);
        }
Example #4
0
        public IssueDS SearchIssues(string searchText)
        {
            //Get issue search data
            IssueDS search = new IssueDS();

            try {
                //Validate data access
                DataSet ds = fillDataset(USP_ISSUES_SEARCH, TBL_ISSUES, new object[] { searchText });
                if (ds.Tables[TBL_ISSUES].Rows.Count > 0)
                {
                    search.Merge(ds);
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while searching issues.", ex); }
            return(search);
        }
Example #5
0
        public IssueDS GetIssues(DateTime fromDate)
        {
            //Get issues
            IssueDS issues = new IssueDS();

            try {
                DateTime toDate = DateTime.Today.AddDays(1).AddSeconds(-1);
                DataSet  ds     = fillDataset(USP_ISSUES, TBL_ISSUES, new object[] { fromDate, toDate });
                if (ds.Tables[TBL_ISSUES].Rows.Count > 0)
                {
                    DataSet _ds = new DataSet();
                    _ds.Merge(ds.Tables[TBL_ISSUES].Select("", "LastActionCreated DESC"));
                    issues.Merge(_ds);
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading issues.", ex); }
            return(issues);
        }