Exemplo n.º 1
0
        public List <cVehicle> Register1_CreateVehicle(string pKey, string pTypeID, string pTRR, string pAddress = "")
        {
            //cConnect lc = new cConnect();
            //lc.Connect();

            cNonServiceLogic.Init(ref mTypes, ref mRoutesXML, ref mVehicles_sumo);
            try
            {
                int mNumberOfExistsingCars = cNonServiceLogic.returnCarsNumber(mVehicles);
                if (mVehicles == null)
                {
                    mVehicles = new List <cVehicle>();
                }
                cVehicle lVozilo = new cVehicle("", pTypeID, pTRR, mTypes, mNumberOfExistsingCars);
                mVehicles.Add(lVozilo);
                return(mVehicles);
            }
            catch (TimeoutException lTimeNapaka)
            {
                cNonServiceLogic.ThrowNapaka(lTimeNapaka.StackTrace, lTimeNapaka.Message);
                return(null);
            }
            catch (FaultException <FaultNapaka> lFENapaka)
            {
                cNonServiceLogic.ThrowNapaka(lFENapaka.StackTrace, lFENapaka.Message);
                return(null);
            }
            catch (CommunicationException lComNapaka)
            {
                cNonServiceLogic.ThrowNapaka(lComNapaka.StackTrace, lComNapaka.Message);
                return(null);
            }
            catch (Exception lEx)
            {
                cNonServiceLogic.ThrowNapaka(lEx.StackTrace, lEx.Message);
                return(null);
            }
        }
Exemplo n.º 2
0
        public bool Register1_RequestRegisterVehicle(cVehicle pVozilo, string pAddress = "")
        {
            try
            {
                if (mVehicles == null)
                {
                    mVehicles = new List <cVehicle>();
                }

                cNonServiceLogic.Init(ref mTypes, ref mRoutesXML, ref mVehicles_sumo);
                pVozilo       = new cVehicle("blabla0", mTypes[0].Id, "000-111", mTypes, mVehicles.Count());
                pVozilo.Route = mRoutesXML[10];
                mVehicles.Add(pVozilo);
                cLogic.RequestRegisterVehicle(pVozilo, mRoutesXML, ref mIP, pAddress);

                //cNonServiceLogic.Init(ref mTypes, ref mRoutesXML, ref mVehicles_sumo);
                //pVozilo = new cVehicle("blabla1", mTypes[1].Id, "000-111", mTypes,  mVehicles.Count());
                //pVozilo.Route = mRoutesXML[10];
                //cLogic.RequestRegisterVehicle(pVozilo, mRoutesXML, ref mIP, pAddress);
                //mVehicles.Add(pVozilo);
                //cNonServiceLogic.Init(ref mTypes, ref mRoutesXML, ref mVehicles_sumo);
                //pVozilo = new cVehicle("blabla2", mTypes[2].Id, "000-111", mTypes, mVehicles.Count());
                //pVozilo.Route = mRoutesXML[10];
                //cLogic.RequestRegisterVehicle(pVozilo, mRoutesXML, ref mIP, pAddress);
                //mVehicles.Add(pVozilo);
                //cNonServiceLogic.Init(ref mTypes, ref mRoutesXML, ref mVehicles_sumo);
                //pVozilo = new cVehicle("blabla3", mTypes[3].Id, "000-111", mTypes, mVehicles.Count());
                //pVozilo.Route = mRoutesXML[10];
                //cLogic.RequestRegisterVehicle(pVozilo, mRoutesXML, ref mIP, pAddress);
                //mVehicles.Add(pVozilo);
                //cNonServiceLogic.Init(ref mTypes, ref mRoutesXML, ref mVehicles_sumo);
                //pVozilo = new cVehicle("blabla4", mTypes[4].Id, "000-111", mTypes, mVehicles.Count());
                //pVozilo.Route = mRoutesXML[10];
                //cLogic.RequestRegisterVehicle(pVozilo, mRoutesXML, ref mIP, pAddress);
                //mVehicles.Add(pVozilo);
                //cNonServiceLogic.Init(ref mTypes, ref mRoutesXML, ref mVehicles_sumo);
                //pVozilo = new cVehicle("blabla5", mTypes[5].Id, "000-111", mTypes, mVehicles.Count());
                //pVozilo.Route = mRoutesXML[10];
                //cLogic.RequestRegisterVehicle(pVozilo, mRoutesXML, ref mIP, pAddress);
                //mVehicles.Add(pVozilo);
                //cNonServiceLogic.Init(ref mTypes, ref mRoutesXML, ref mVehicles_sumo);
                //pVozilo = new cVehicle("blabla6", mTypes[6].Id, "000-111", mTypes, mVehicles.Count());
                //pVozilo.Route = mRoutesXML[10];
                //cLogic.RequestRegisterVehicle(pVozilo, mRoutesXML, ref mIP, pAddress);
                //mVehicles.Add(pVozilo);


                return(true);
            }
            catch (TimeoutException lTimeNapaka)
            {
                cNonServiceLogic.ThrowNapaka(lTimeNapaka.StackTrace, lTimeNapaka.Message);
                return(false);
            }
            catch (FaultException <FaultNapaka> lFENapaka)
            {
                cNonServiceLogic.ThrowNapaka(lFENapaka.StackTrace, lFENapaka.Message);
                return(false);
            }
            catch (CommunicationException lComNapaka)
            {
                cNonServiceLogic.ThrowNapaka(lComNapaka.StackTrace, lComNapaka.Message);
                return(false);
            }
            catch (Exception lEx)
            {
                cNonServiceLogic.ThrowNapaka(lEx.StackTrace, lEx.Message);
                return(false);
            }
        }