コード例 #1
0
ファイル: TicketsPanel.cs プロジェクト: VonM/proiectBD
        private void button3_Click(object sender, EventArgs e)
        {
            string priority;

            if (this.comboBox4.Text == "")
            {
                priority = "";
            }
            else
            {
                priority = ((int)(Priority)Enum.Parse(typeof(Priority), this.comboBox4.Text)).ToString();
            }
            if (LocalStore.currentUser.Role == Role.Admin)
            {
                filteredTickets_ = DatabaseAPI.SelectTickets(
                    this.comboBox6.Text,
                    this.comboBox7.Text,
                    priority,
                    this.comboBox8.Text,
                    this.comboBox9.Text);
            }
            else if (LocalStore.currentUser.Role == Role.Ticket_Editor)
            {
                filteredTickets_ = DatabaseAPI.SelectTicketsToUser(
                    this.comboBox6.Text,
                    this.comboBox7.Text,
                    priority,
                    this.comboBox8.Text,
                    this.comboBox9.Text,
                    LocalStore.currentUser.Username);

                filteredTickets_.AddRange(DatabaseAPI.SelectTicketsFromUser(
                                              this.comboBox6.Text,
                                              this.comboBox7.Text,
                                              priority,
                                              this.comboBox8.Text,
                                              this.comboBox9.Text,
                                              LocalStore.currentUser.Username));
            }
            else if (LocalStore.currentUser.Role == Role.Employee)
            {
                filteredTickets_ = DatabaseAPI.SelectTicketsFromUser(
                    this.comboBox6.Text,
                    this.comboBox7.Text,
                    priority,
                    this.comboBox8.Text,
                    this.comboBox9.Text,
                    LocalStore.currentUser.Username);
            }

            ClearTable(tableLayoutPanel1);
            foreach (Ticket t in filteredTickets_)
            {
                AddTicketToTable(t, tableLayoutPanel1);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: VonM/proiectBD
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            FormStorer.Add("Login", new Login());

            Database.Instance().SetConnection("C:\\Madalin\\TicketManager\\database.mdf");
            Database.Instance().ExecuteQueryFromFile("..\\..\\PopulateUsersTable.sql");
            Database.Instance().ExecuteQueryFromFile("..\\..\\PopulateTicketsTable.sql");

            ArrayList users = DatabaseAPI.SelectUsers();

            foreach (User u in users)
            {
                Console.Write(u);
            }
            DatabaseAPI.SelectTickets();

            Application.Run(FormStorer.Get("Login"));
        }