Ejemplo n.º 1
0
        private void SendNewTicket_Click(object sender, EventArgs e)
        {
            //if (string.IsNullOrEmpty(NewTicketState.Text))
            //{
            //    MessageBox.Show("Selecteer een Ticketstatus.");
            //}
            //else
            //{
            //    if (string.IsNullOrEmpty(NewSubjectBox.Text))
            //    {
            //        MessageBox.Show("Het ticketonderwerp ontbreekt vul deze in a.u.b.");
            //    }
            //    else
            //    {
            //        if (string.IsNullOrEmpty(NewIssueBox.Text))
            //        {
            //            MessageBox.Show("Het issueveld is leeg vul dit in a.u.b.");
            //        }
            //        else
            //        {

            doTicket obj = new doTicket();

            obj.Issue   = NewIssueBox.Text;
            obj.Subject = NewSubjectBox.Text;

            if (obj.IsValid())
            {
                //Ticketinformatie naar de database sturen
                string     insertCmdText = obj.InsertStatement();// "INSERT INTO dbo.Tickets(ticket_subject, ticket_issue, ticket_state)values('" + this.NewSubjectBox.Text + "','" + this.NewIssueBox.Text + "','" + this.NewTicketState.Text + "');";
                SqlCommand sqlCom        = new SqlCommand(insertCmdText, con);
                sqlCom.ExecuteNonQuery();

                MessageBox.Show("De Ticket is aangemaakt, u ontvangt zo spoedig mogelijk terugkoppeling.");
            }
            //        }
            //    }
            //}
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <String> columnData = new List <String>();

            SqlConnection connection = con;
            {
                //connection.Open();
                string query = "SELECT * FROM Tickets";
                using (SqlCommand command = new SqlCommand(query, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            doTicket obj = new doTicket(reader);
                            obj.FillListViewItem(listView1.Items.Add(""));

                            String test = obj.InsertStatement();
                        }
                    }
                }
                // connection.Close();
            }
        }