Esempio n. 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        BLPeriode         blPeriode         = new BLPeriode();
        BLKamp            blKamp            = new BLKamp();
        BLContract        blContract        = new BLContract();
        BLContractPersoon blContractPersoon = new BLContractPersoon();
        BLVereniging      blVereniging      = new BLVereniging();
        BLPersoon         blPersoon         = new BLPersoon();
        BLBetaling        blBetaling        = new BLBetaling();
        Vereniging        vereniging        = new Vereniging();
        Periode           periode           = new Periode();
        Kamp            kamp            = new Kamp();
        Contract        contract        = new Contract();
        ContractPersoon contractpersoon = new ContractPersoon();

        periode.BeginPeriode = Convert.ToDateTime(TextBoxBegin.Text);
        periode.EindePeriode = Convert.ToDateTime(TextBoxEinde.Text);
        if (CheckBoxDefinitief.Checked)
        {
            //optie toegekend
            periode.StatusId = 3;
        }
        else
        {
            //optie in aanvraag
            periode.StatusId = 2;
        }
        //type standaard
        periode.TypeId = 4;
        int periodeId = blPeriode.InsertPeriode(periode);

        kamp.AantalPersonen   = Convert.ToInt32(TextBoxPersonen.Text);
        kamp.AantalTenten     = Convert.ToInt32(TextBoxTenten.Text);
        kamp.TijdstipAankomst = TextBoxAankomst.Text;
        kamp.TijdstipVertrek  = TextBoxVertrek.Text;
        kamp.Opmerkingen      = TextBoxOpmerkingen.Text;
        int kampId = blKamp.InsertKamp(kamp);

        vereniging.Naam = TextBoxVereniging.Text;
        int verenigingId = blVereniging.InsertVereniging(vereniging);
        int persoonId    = ((Persoon)Session["persoon"]).Id;

        contract.KampId    = kampId;
        contract.PeriodeId = periodeId;
        int contractId = blContract.InsertContract(contract);

        contractpersoon.ContractId = contractId;
        contractpersoon.PersoonId  = persoonId;
        int contractPersoonId = blContractPersoon.InsertContractpersoon(contractpersoon, 1); //1 voor kamporganisator

        blPersoon.UpdatePersoonVerenigingId(persoonId, verenigingId);
        int aantalNachten = (int)Convert.ToDateTime(TextBoxEinde.Text).Subtract(Convert.ToDateTime(TextBoxBegin.Text)).TotalDays;

        blBetaling.InsertBetalingenBijContract(aantalNachten, Convert.ToInt32(TextBoxPersonen.Text), Convert.ToInt32(TextBoxTenten.Text), contractId);

        //==================================================mail sturen====================================================
        if (periode.StatusId == 3)
        {
            Session["melding"] = "De periode is voorlopig gereserveerd. Vergeet ze niet binnen de 7 dagen definitief te maken! In uw mailbox zit een e-mail met het overzicht van uw aanvraag.";
        }
        else
        {
            Session["melding"] = "De periode is definitief gereserveerd. In uw mailbox zit een e-mail met het overzicht van uw aanvraag. Gelieve het voorschot en de waarborg spoedig te betalen.";
        }
        //sessie met begin en einddatum leegmaken
        Session["begin"] = null;
        Session["einde"] = null;
        Response.Redirect("Default.aspx");
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["persoon"] == null)
        {
            Session["melding"] = "Meld u eerst aan om uw reservaties te bekijken";
        }
        else
        {
            //reservaties ophalen
            BLContractPersoon      blContractPersoon = new BLContractPersoon();
            List <ContractPersoon> contractPersonen  = blContractPersoon.GetContractPersonenByPersoonId(((Persoon)Session["persoon"]).Id);
            if (contractPersonen.Count == 0)
            {
                Session["melding"] = "U heeft nog geen reservaties.";
            }
            else
            {
                Panel1.Controls.Add(new LiteralControl("<h1>Totaal:" + contractPersonen.Count + " periodes </h1>"));
                int i = 0;
                foreach (ContractPersoon contractPersoon in contractPersonen)
                {
                    i++;
                    //rol + periode
                    Panel1.Controls.Add(new LiteralControl("<h2>" + i + ") " + contractPersoon.Rol.Naam + " van periode:</h2>"));
                    Label labelPeriode = new Label();
                    labelPeriode.Text = Convert.ToDateTime(contractPersoon.Contract.Periode.BeginPeriode).ToShortDateString() + " - " + Convert.ToDateTime(contractPersoon.Contract.Periode.EindePeriode).ToShortDateString();
                    AddAndNewLine(labelPeriode);
                    Label("Status:", 100);
                    Label(contractPersoon.Contract.Periode.Status.Naam, 300);

                    //betalingen
                    Panel1.Controls.Add(new LiteralControl("<h2>Betalingen</h2>"));
                    foreach (Betaling betaling in contractPersoon.Contract.Betalings)
                    {
                        Label l1 = new Label();
                        l1.Width = 150;
                        l1.Text  = betaling.TypeBetaling.Naam;
                        AddControl(l1);

                        Label l2 = new Label();
                        l2.Width = 80;
                        l2.Text  = betaling.Bedrag.ToString();
                        AddControl(l2);

                        Label l3 = new Label();
                        l3.Width = 180;
                        l3.Text  = betaling.StatusBetaling.Naam;
                        AddAndNewLine(l3);
                    }

                    //informatie kamp en vereniging
                    Panel1.Controls.Add(new LiteralControl("<h2>Informatie kamp</h2>"));
                    if (contractPersoon.Persoon.Vereniging != null)
                    {
                        Label("Vereniging:", 150);
                        Label(contractPersoon.Persoon.Vereniging.Naam.ToString(), 300);
                    }
                    NewLine();
                    Label("Aantal personen:", 150);
                    Label(contractPersoon.Contract.Kamp.AantalPersonen.ToString(), 300);
                    NewLine();
                    Label("Aantal tenten:", 150);
                    Label(contractPersoon.Contract.Kamp.AantalTenten.ToString(), 300);
                    NewLine();
                    Label("Uur aankomst:", 150);
                    Label(contractPersoon.Contract.Kamp.TijdstipAankomst, 300);
                    NewLine();
                    Label("Uur vertrek:", 150);
                    Label(contractPersoon.Contract.Kamp.TijdstipVertrek, 300);
                    NewLine();
                    Label("Opmerkingen:", 150);
                    Label(contractPersoon.Contract.Kamp.Opmerkingen, 300);
                }
            }
        }
        if (Session["melding"] != null)
        {
            LabelMelding.Visible = true;
            LabelMelding.Text    = Session["melding"].ToString();
            Session["melding"]   = null;
        }
        else
        {
            LabelMelding.Visible = false;
        }
    }