Ejemplo n.º 1
0
 private void addex(Travel_planned t)
 {
     if (excu_ids.Count > 0)
     {
         foreach (int x in excu_ids)
         {
             this.context.Excursion_planned.Add(new Excursion_planned {
                 Excursion = x, Travel_planned = t.Travel_plan_ID
             });
         }
         this.context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
        private double Calcu_price(Travel_planned t, List <int> excu_idss)
        {
            double prijs = this.context.Travel_product.SingleOrDefault(s => s.Trav_prod_ID == t.Travel_product).Price;

            if (excu_idss.Count > 0)
            {
                foreach (int i in excu_idss)
                {
                    prijs += this.context.Excursion.SingleOrDefault(s => s.Exc_ID == i).Price;
                }
            }



            return(prijs);
        }
Ejemplo n.º 3
0
        public ConfirmationForm(ReisForm f, OutdoorParadise context, List <string> gekozen_klanten, List <int> ids, Travel_planned travel_Planned, List <string> gekozen_ecur, List <int> excu_ids, double prijss)
        {
            InitializeComponent();
            this.gekozen_klanten.Clear();
            this.ids.Clear();
            this.form    = f;
            this.context = context;
            this.gekozen_klanten.AddRange(gekozen_klanten);
            this.ids.AddRange(ids);
            this.travel       = travel_Planned;
            this.gekozen_ecur = gekozen_ecur;
            this.excu_ids.AddRange(excu_ids);
            price_lbl.Text = prijss + "$ Per person!";

            tprice_lbl.Text = (prijss * gekozen_klanten.Count) + "$";

            displaydetails();
        }
Ejemplo n.º 4
0
        private void save_btn_Click(object sender, EventArgs e)
        {
            foreach (int i in ids)
            {
                Travel_planned t = new Travel_planned()
                {
                    Date_start     = travel.Date_start,
                    Date_end       = travel.Date_end,
                    Travel_product = travel.Travel_product,
                    Customer       = i
                };
                this.context.Travel_planned.Add(t);
                this.context.SaveChanges();

                addex(t);
            }



            MessageBox.Show("Done!");
        }
Ejemplo n.º 5
0
        private void conf_btn_Click(object sender, EventArgs e)
        {
            List <int>    ids      = new List <int>();
            List <string> f        = new List <string>();
            List <int>    excu_ids = new List <int>();
            List <string> f2       = new List <string>();


            if (gekozen_klanten.Count != 0 && gekozen_klanten.Count >= this.min_cap)
            {
                foreach (string s in gekozen_klanten)
                {
                    f.AddRange(s.Split(' '));
                }
                foreach (string s in f)
                {
                    Regex re = new Regex(@"^\d+$");

                    if (re.IsMatch(s))
                    {
                        ids.Add(int.Parse(s));
                    }
                }

                Travel_planned t = new Travel_planned();

                t.Date_start     = start_date.Value;
                t.Date_end       = end_date.Value;
                t.Travel_product = context.Travel_product.SingleOrDefault(s => s.Desciption.Equals(reis_type_cb.SelectedItem.ToString())).Trav_prod_ID;

                foreach (string s in gekozen_excur)
                {
                    f2.AddRange(s.Split(' '));
                }
                foreach (string s in f2)
                {
                    Regex re = new Regex(@"^\d+$");

                    if (re.IsMatch(s))
                    {
                        excu_ids.Add(int.Parse(s));
                    }
                }

                int aantal = (int)(t.Date_end - t.Date_start).TotalDays;

                if (aantal > lengte)
                {
                    MessageBox.Show("Change start or end date! You can only have " + lengte + " days");
                }
                else
                {
                    double           prijs = Calcu_price(t, excu_ids);
                    ConfirmationForm conf  = new ConfirmationForm(this, this.context, gekozen_klanten, ids, t, gekozen_excur, excu_ids, prijs);

                    conf.ShowDialog();
                }
            }

            else
            {
                MessageBox.Show("Add more people!");
            }
        }