예제 #1
0
 public Factuur(Ticket ticket)
 {
     this.ticket = ticket;
     prijs = 0;
 }
예제 #2
0
        public Ticket SaveTicket(int klantnr, double verwachteKosten, int verwachteReparatieTijd, TicketStatus status, Registratie registratie, string probleem, string afdelingsAfkorting, string categorie)
        {
            //try
            //{
                connection.Open();
                string query = "INSERT INTO ticket (ticketnr, status, opmerking, locatie, verw_oplostijd, verw_kosten, klantnr) VALUES " +
                    "(ticketseq.nextval, " + ((int)status).ToString() + ", '" + probleem + "', '" + afdelingsAfkorting + "', " + verwachteReparatieTijd.ToString() + ", " + verwachteKosten.ToString() + ", " + klantnr.ToString() + ")";
                OracleCommand command = new OracleCommand(query, connection);
                command.ExecuteNonQuery();

                string selectQuery = "SELECT Max(ticketnr) FROM ticket";
                command = new OracleCommand(selectQuery, connection);
                OracleDataReader reader = command.ExecuteReader();
                reader.Read();
                Ticket t = new Ticket(
                    Convert.ToInt32(reader["ticketnr"]),
                    klantnr,
                    verwachteReparatieTijd,
                    verwachteKosten,
                    status,
                    afdelingsAfkorting,
                    probleem,
                    categorie
                    );

            connection.Close();
            return t;
            //}
            //catch (Exception e)
            //{
            //    System.Windows.Forms.MessageBox.Show(e.ToString());
            //    return null;
            //}
            //finally
            //{
            //    connection.Close();
            //}
        }
        public bool WijzigTicket(Ticket ticket, int serienr)
        {
            if (database.WijzigTicket(ticket, serienr))
            {
                Klant k = database.GetKlantByTicketnr(Convert.ToInt32(ticket.Ticketnr));

                MailMessage mailmessage = new MailMessage();
                mailmessage.Body = "De nieuwe status is :" + ticket.Status.ToString();
                mailmessage.From = new MailAddress("*****@*****.**");
                mailmessage.Subject = "Status wijziging";
                mailmessage.To.Add(new MailAddress(k.Email));
                mailServer.SendMail(mailmessage);
                return true;
            }
            return false;
        }
예제 #4
0
 public List<Ticket> GetTicketsByKlant(int klantnr)
 {
     List<Ticket> result = new List<Ticket>();
     //try
     //{
         connection.Open();
         string query = "SELECT * FROM ticket WHERE klantnr = " + klantnr.ToString();
         OracleCommand command = new OracleCommand(query, connection);
         OracleDataReader reader = command.ExecuteReader();
         Ticket t;
         while (reader.Read())
         {
             t = new Ticket(
                 Convert.ToInt32(reader["ticketnr"]),
                 Convert.ToInt32(reader["klantnr"]),
                 Convert.ToInt32(reader["verw_oplostijd"]),
                 Convert.ToDouble(reader["verw_kosten"]),
                 (TicketStatus)Convert.ToInt32(reader["status"]),
                 (string)reader["locatie"],
                 (string)reader["opmerking"],
                 (string)reader["categorie"]
                 );
             result.Add(t);
         }
         connection.Close();
         return result;
     //}
     //catch (Exception e)
     //{
     //    System.Windows.Forms.MessageBox.Show(e.ToString());
     //    return null;
     //}
     //finally
     //{
     //    connection.Close();
     //}
 }
예제 #5
0
 public List<Ticket> GetTickets()
 {
     List<Ticket> result = new List<Ticket>();
     try
     {
         connection.Open();
         string query = "SELECT * FROM ticket";
         OracleCommand command = new OracleCommand(query, connection);
         OracleDataReader reader = command.ExecuteReader();
         Ticket t;
         while (reader.Read())
         {
             t = new Ticket(
                 Convert.ToInt32(reader["ticketnr"]),
                 Convert.ToInt32(reader["klantnr"]),
                 Convert.ToInt32(reader["verw_oplostijd"]),
                 Convert.ToDouble(reader["verw_kosten"]),
                 (TicketStatus)Convert.ToInt32(reader["status"]),
                 (string)reader["afdeling"],
                 (string)reader["probleem"],
                 (string)reader["categorie"]
                 );
             result.Add(t);
         }
         return result;
     }
     catch (Exception e)
     {
         System.Windows.Forms.MessageBox.Show(e.ToString());
         return null;
     }
     finally
     {
         connection.Close();
     }
 }