Exemplo n.º 1
0
        static Database()
        {
            currentnDatabasePath = null;
            isOpen = false;

            projectsTableAdapter = null;
            milestonesTableAdapter = null;
            ticketReportersTableAdapter = null;
            ticketAssigneesTableAdapter = null;
            ticketsTableAdapter = null;
            attachmentsWithoutContentsTableAdapter = null;
            attachmentsTableAdapter = null;
            ticketsHistoryTableAdapter = null;
        }
Exemplo n.º 2
0
        public static string[] GetAssignees(IDatabaseProvider db)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }
            TicketAssigneesTableAdapter tableAdapter = db.DB.TicketAssigneesTableAdapter;

            PeygirDatabaseDataSet.TicketAssigneesDataTable rows = tableAdapter.GetData();

            // Create list.
            List <string> assignees = new List <string>();

            foreach (var row in rows)
            {
                // Add.
                string assignee = row.Assignee;
                assignees.Add(assignee);
            }

            return(assignees.ToArray());
        }
Exemplo n.º 3
0
        public static void Open(string databasePath)
        {
            if (databasePath == null)
            {
                throw new ArgumentNullException("databasePath");
            }

            // Close.
            if (isOpen)
            {
                Close();
            }

            PeygirDatabaseDataSet.ChangeDatabasePath(databasePath);

            projectsTableAdapter = new ProjectsTableAdapter();
            milestonesTableAdapter = new MilestonesTableAdapter();
            ticketReportersTableAdapter = new TicketReportersTableAdapter();
            ticketAssigneesTableAdapter = new TicketAssigneesTableAdapter();
            ticketsTableAdapter = new TicketsTableAdapter();
            attachmentsWithoutContentsTableAdapter = new AttachmentsWithoutContentsTableAdapter();
            attachmentsTableAdapter = new AttachmentsTableAdapter();
            ticketsHistoryTableAdapter = new TicketsHistoryTableAdapter();

            projectsTableAdapter.Connection.Open();
            milestonesTableAdapter.Connection.Open();
            ticketReportersTableAdapter.Connection.Open();
            ticketAssigneesTableAdapter.Connection.Open();
            ticketsTableAdapter.Connection.Open();
            attachmentsWithoutContentsTableAdapter.Connection.Open();
            attachmentsTableAdapter.Connection.Open();
            ticketsHistoryTableAdapter.Connection.Open();

            currentnDatabasePath = databasePath;
            isOpen = true;

            return;
        }
Exemplo n.º 4
0
        public static void Close()
        {
            if (!isOpen)
            {
                return;
            }

            projectsTableAdapter.Connection.Close();
            milestonesTableAdapter.Connection.Close();
            ticketReportersTableAdapter.Connection.Close();
            ticketAssigneesTableAdapter.Connection.Close();
            ticketsTableAdapter.Connection.Close();
            attachmentsWithoutContentsTableAdapter.Connection.Close();
            attachmentsTableAdapter.Connection.Close();
            ticketsHistoryTableAdapter.Connection.Close();

            projectsTableAdapter = null;
            milestonesTableAdapter = null;
            ticketReportersTableAdapter = null;
            ticketAssigneesTableAdapter = null;
            ticketsTableAdapter = null;
            attachmentsWithoutContentsTableAdapter = null;
            attachmentsTableAdapter = null;
            ticketsHistoryTableAdapter = null;

            currentnDatabasePath = null;
            isOpen = false;

            return;
        }