Example #1
0
        public static rit_info createRitInfo(rit_instantie ri)
        {
            opdracht od   = ContractManagement.getContract(ri.contract_rit);
            rit_info info = new rit_info();

            info.rit_instantie = ri;

            var chauffeur = ContractManagement.getChauffeursVanContract(od);

            if (chauffeur.Count() > 0)
            {
                info.chauffeur = chauffeur.First();
            }
            if (chauffeur.Count() > 1)
            {
                info.chauffeur1 = chauffeur.ElementAt(1);
            }
            else
            {
                info.chauffeur1 = chauffeur.First();
            }


            var opdrachtvoertuigen = OpdrachtManagement.getVoertuigenVanOpdracht(od);

            if (opdrachtvoertuigen.Count() > 0)
            {
                info.voertuig = opdrachtvoertuigen.First().voertuig;
            }

            if (opdrachtvoertuigen.Count() > 1)
            {
                info.voertuig1 = opdrachtvoertuigen.ElementAt(1).voertuig;
            }
            else
            {
                info.voertuig1 = info.voertuig;
            }

            info.rit1_vertrek = ri.contract_rit.rit1_vertrek;
            info.rit1_terug   = ri.contract_rit.rit1_terug;
            info.rit2_vertrek = ri.contract_rit.rit2_vertrek;
            info.rit2_terug   = ri.contract_rit.rit2_terug;

            ContractManagement.addRitInfo(info);
            return(info);
        }
Example #2
0
        public static rit_info CreateRitInfo(rit_instantie instantie, opdracht od)
        {
            //Bestaat er nog geen informatie? --> Aanmaken
            rit_info info = new rit_info();

            info.rit_instantie = instantie;

            var chauffeur = ContractManagement.getChauffeursVanContract(od);

            if (chauffeur.Count() > 0)
            {
                info.chauffeur = chauffeur.First();
            }
            if (chauffeur.Count() > 1)
            {
                info.chauffeur1 = chauffeur.ElementAt(1);
            }
            else
            {
                info.chauffeur1 = chauffeur.First();
            }


            var opdrachtVoertuigen = OpdrachtManagement.getVoertuigenVanOpdracht(od);

            if (opdrachtVoertuigen.Count() > 0)
            {
                info.voertuig = opdrachtVoertuigen.First().voertuig;
            }

            if (opdrachtVoertuigen.Count() > 1)
            {
                info.voertuig1 = opdrachtVoertuigen.ElementAt(1).voertuig;
            }
            else
            {
                info.voertuig1 = info.voertuig;
            }

            info.rit1_vertrek = instantie.contract_rit.rit1_vertrek;
            info.rit1_terug   = instantie.contract_rit.rit1_terug;
            info.rit2_vertrek = instantie.contract_rit.rit2_vertrek;
            info.rit2_terug   = instantie.contract_rit.rit2_terug;

            ContractManagement.addRitInfo(info);
            return(info);
        }
Example #3
0
        //Kijken of de leverancier in gebruik is bij een opdracht
        public static Boolean inUse(leverancier leverancier)
        {
            IEnumerable <opdracht> opdrachten = OpdrachtManagement.getOpdrachten();

            foreach (opdracht opdracht in opdrachten)
            {
                if (opdracht.leverancier == leverancier)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Example #4
0
        //Kijken of de klant in gebruik is in een opdracht
        public static Boolean inUse(klant klant)
        {
            IEnumerable <opdracht> opdrachten = OpdrachtManagement.getOpdrachten();

            foreach (opdracht opdracht in opdrachten)
            {
                if (opdracht.klant == klant)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }
Example #5
0
        //Kijken of het voertuig in gebruik is in een opdracht
        public static Boolean inUse(voertuig voertuig)
        {
            IEnumerable <opdracht> opdrachten = OpdrachtManagement.getOpdrachten();

            foreach (opdracht opdracht in opdrachten)
            {
                foreach (opdracht_voertuig vo in OpdrachtManagement.getVoertuigenVanOpdracht(opdracht))
                {
                    if (vo.voertuig == voertuig)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(false);
        }
Example #6
0
        //Kijken of de chauffeur in gebruik is in een opdracht
        public static Boolean inUse(chauffeur chauffeur)
        {
            IEnumerable <opdracht> opdrachten = OpdrachtManagement.getOpdrachten();


            foreach (opdracht opdracht in opdrachten)
            {
                foreach (chauffeur ch in OpdrachtManagement.getFirstChauffeurVanOpdracht(opdracht))
                {
                    if (ch == chauffeur)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(false);
        }
Example #7
0
        public static void fillOpdrachten(DataTable dt, DateTime selectedTime)
        {
            foreach (opdracht o in OpdrachtManagement.getOpdrachten(selectedTime))
            {
                rit_info info = ContractManagement.getRitInfo(null);
                DataRow  dr   = dt.NewRow();
                DataRow  dr2  = dt.NewRow();
                if (o.opdracht_id2 != null)
                {
                    dr["Type"] = "Opdracht";
                }
                else
                {
                    dr["Type"] = "Offerte";
                }
                dr["ID"] = o.opdracht_id_full;

                try
                {
                    dr["Vertrek"] = OpdrachtManagement.getVertrek(o.opdracht_id).FullAdress;
                }
                catch { }
                try
                {
                    dr2["Bestemming"] = OpdrachtManagement.getBestemming(o.opdracht_id).FullAdress;
                }
                catch { }

                dr["Passagiers"] = o.aantal_personen.ToString();
                dr["Datum"]      = o.vanaf_datum.ToShortDateString();
                dr2["Datum"]     = o.tot_datum.ToShortDateString();
                dr["Start Uur"]  = o.vanaf_uur;
                dr2["Eind Uur"]  = o.tot_uur;

                int       counter     = 0;
                chauffeur firstChauff = null;
                chauffeur secChauff   = null;
                foreach (opdracht_chauffeur cha in OpdrachtManagement.getChauffeursVanOpdract(o))
                {
                    if (counter == 0)
                    {
                        firstChauff = cha.chauffeur;
                    }
                    else if (counter == 1)
                    {
                        secChauff = cha.chauffeur;
                    }
                    counter++;
                }


                //IEnumerable<chauffeur> firstChauff = OpdrachtManagement.getFirstChauffeurVanOpdracht(o);
                //IEnumerable<chauffeur> secChauff = OpdrachtManagement.getSecondChauffeurVanOpdracht(o);
                IEnumerable <opdracht_voertuig> voertuigen  = OpdrachtManagement.getVoertuigenVanOpdracht(o);
                IEnumerable <leverancier>       leverancier = OpdrachtManagement.getLeverancierVanOpdracht(o);

                locatie vertrek    = ContractManagement.getLocatie(o.opdracht_id, "vertrek");
                locatie bestemming = ContractManagement.getLocatie(o.opdracht_id, "bestemming");


                try { dr["Chauffeur1"] = firstChauff.naam; }
                catch { };
                try { dr2["Chauffeur1"] = secChauff.naam; }
                catch { };
                try { dr["Voertuig1"] = voertuigen.First().voertuig.identificatie; }
                catch { };
                try { dr["Leverancier"] = leverancier.First().naam; }
                catch { };
                //try { dr["Vertrek"] = vertrek.FullAdress; }
                //catch { };
                //try { dr["Bestemming"] = bestemming.FullAdress; }
                //catch { };
                if (o.opdracht_id2 != null)
                {
                    dr["RID"]  = "O-" + o.opdracht_id;
                    dr2["RID"] = "O-" + o.opdracht_id;
                }
                else
                {
                    dr["RID"]  = "I-" + o.opdracht_id;
                    dr2["RID"] = "I-" + o.opdracht_id;
                }

                dt.Rows.Add(dr);
                dt.Rows.Add(dr2);
            }
        }