Exemplo n.º 1
0
 public string getPersonen(int Ticketid)
 {
     TicketAccess t = new TicketAccess();
     DataTable table = t.getPersonenPerTicket(Ticketid);
     int atl = table.Rows.Count;
     string str = "";
     for (int i = 0; i < atl; i++)
     {
         str += "<li> " + table.Rows[i][2] + " " + table.Rows[i][3] + " </li>";
     }
     return str;
 }
Exemplo n.º 2
0
    protected void btnAnnuleer_Click(object sender, EventArgs e)
    {
        Button btn = (Button)sender;
        int TicketID = Int32.Parse(btn.ToolTip.ToString());
        TicketAccess t = new TicketAccess();
        DataTable table = t.getDatum(TicketID);
        string date = table.Rows[0][0].ToString();
        DateTime d = DateTime.Parse(date);
        DateTime today = new DateTime();

        if (d.AddDays(3) >= today)
        {
            t.AnnuleerTicket(TicketID);
            updateRitten();
        }
        else
        {
            Response.Write("<script LANGUAGE='JavaScript'>alert('Deze Rit kan niet worden geannuleerd!');</script>");
        }
    }
Exemplo n.º 3
0
    protected void btnBevestig_Click(object sender, EventArgs e)
    {
        TicketAccess tktacc = new TicketAccess();
        PersoonAccess persacc = new PersoonAccess();
        CapaciteitAccess capacc = new CapaciteitAccess();
        GridView grdRitten = (GridView)Session["VPR_grdRitten"];
        DataTable rit = (DataTable)Session["VPR_tempRit"];

        mail = new StringBuilder();
        mail.Append("Beste "+ (String)Session["VPR_fullnaam"]+",");
        mail.AppendLine("<br/>");
        mail.AppendLine("<br/>");
        mail.Append("U heeft volgende reis bij VPRtravel geboekt:");
        mail.AppendLine("<br/>");

        // rij id in het sessionobject met de bestellingstabel
        int i = 0;
        foreach (DataRow r in bestelling.Rows)
        {
            //mail opstellen
            mail.Append(r.ItemArray[6].ToString() +" - "+r.ItemArray[7].ToString());
            mail.AppendLine("<br/>");

            TicketData t = new TicketData();
            t.gebruikerID = (int)Session["VPR_id"];
            t.totalePrijs = Convert.ToDouble(r.ItemArray[1].ToString());
            String s = r.ItemArray[2].ToString();
            t.aankomstdatum = DateTime.Parse(r.ItemArray[2].ToString());
            t.vertrekdatum = DateTime.Parse(r.ItemArray[3].ToString());
            t.typeID = Convert.ToInt32(r.ItemArray[4].ToString());
            t.treinID = Convert.ToInt32(r.ItemArray[5].ToString());

            tktacc.addTicket(t);
            int tID = Convert.ToInt32(tktacc.getTicket(t).Rows[0].ItemArray[0]);
            int tRowID = i;
            i++;

            DataTable pers = (DataTable)Session["VPR_personen"];

            //mail opstellen
            mail.Append("met volgende personen als reizigers:");
            mail.AppendLine("<br/>");

            foreach (DataRow pr in pers.Rows)
            {
                if(pr.ItemArray[0].ToString().Equals(tRowID.ToString()))
                {
                    PersoonData p = new PersoonData();
                    p.ticketID = tID;
                    p.voornaam = pr.ItemArray[1].ToString();
                    p.naam = pr.ItemArray[2].ToString();
                    p.stoelnr = pr.ItemArray[3].ToString();

                    persacc.addPersoon(p);

                    //mail opstellen
                    mail.Append(p.naam +" "+p.voornaam);
                    mail.AppendLine("<br/>");
                }

            }

            for (int j = 0; j < rit.Rows.Count; j++)
            {
                DateTime datum = DateTime.Parse(grdRitten.Rows[j].Cells[0].Text);
                DataTable d = new CapaciteitAccess().getCapa(datum, Convert.ToInt32(rit.Rows[j].ItemArray[0].ToString()));
                CapaciteitData c = new CapaciteitData();
                c.datum = datum;
                c.ritID = Convert.ToInt32(rit.Rows[j].ItemArray[0].ToString());
                double extraCapa= specialeDagen(datum, Convert.ToInt32(rit.Rows[j].ItemArray[1].ToString()));
                if (d.Rows.Count != 0)
                {
                    c.capaciteit = Convert.ToInt32((extraCapa*Convert.ToInt32(d.Rows[0].ItemArray[0].ToString())) - pers.Rows.Count);
                    capacc.updateCapa(c);
                }
                else
                {
                    DataTable ritTabel = new RitAccess().getRitById(Convert.ToInt32(rit.Rows[j].ItemArray[0].ToString()));
                    c.capaciteit = Convert.ToInt32((extraCapa*Convert.ToInt32(ritTabel.Rows[0].ItemArray[2].ToString()))  - pers.Rows.Count);
                    capacc.addCapa(c);
                }
            }
        }

            //mail opstellen
            mail.AppendLine("<br/>");
            mail.AppendLine("<br/>");
            mail.Append("Mvg");
            mail.AppendLine("<br/>");
            mail.Append("Het VPRtravel team");
            String emailAdress = new GebruikersAccess().getMailByID(Convert.ToInt32(Session["VPR_id"].ToString()));
            Mail.sendMail(mail.ToString(),emailAdress ,Session["VPR_fullnaam"].ToString());
            Response.Redirect("BoekSucces.aspx");
    }