protected override bool IsRequireProcessing(SIM.Pipelines.Install.InstallArgs args)
 {
     if (!this.ProcessorDefinition.Param.EqualsIgnoreCase("archive", false))
         return true;
     if (args.Modules != null)
         return args.Modules.Any(m =>
             {
                 if (m != null)
                     return m.IsArchive;
                 return false;
             });
     return false;
 }
Example #2
0
        void OnDestroy()
        {
            if (Server != null)
            {
                Server.Stop();
                Server = null;
            }

            Instance = null;
            SimulatorManager.SetTimeScale(1.0f);
            SIM.LogAPI(SIM.API.SimulationDestroy);
            SIM.APIOnly = false;
            Loader.Instance.Network.MessagesManager?.UnregisterObject(this);
        }
Example #3
0
        public ActionResult Order(SIM sim)
        {
            if (IsNotLogin())
            {
                return(View(MUST_LOGIN_AREA));
            }

            if (sim.SimId == 0)
            {
                throw new HttpException(404, String.Empty);
            }

            if (Db.Order.IsCustomerOutOfOrderTimes(base.MaKH))
            {
                ViewBag.IsOrderReachLimit = true;

                return(View());
            }
            else if (Db.Order.IsOrdered(sim.SimId))
            {
                ViewBag.IsSIMOrdered = true;

                return(View());
            }

            SIM dbSIM = Db.SIM.Find(sim.SimId);

            if (dbSIM.SimId == 0)
            {
                throw new HttpException(404, String.Empty);
            }

            PhieuMua newOrder = new PhieuMua();

            newOrder.SimId = dbSIM.SimId;
            newOrder.MaKH  = MaKH;

            if (Db.Order.LittleSave(newOrder) <= 0)
            {
                return(RedirectToAction("OrderError"));
            }

            dbSIM.TinhTrang = SIM.NOT_PAID;

            Db.SIM.Save(dbSIM);

            Db.Customer.UpdateOrderAmount(base.MaKH, Increase: true);

            return(RedirectToAction("OrderSuccess"));
        }
 static void Main(string[] args)
 {
     try
     {
         Console.WriteLine("Inserisci un numero di telefono (10 caratteri) : ");
         long numero = long.Parse(Console.ReadLine());
         SIM  sim1   = new SIM(numero, 10, Valuta.Euro);
         Console.WriteLine(sim1.StampaSIM());
     } catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     Console.ReadLine();
 }
Example #5
0
 public static SIMView ConvertToView(this SIM sim)
 {
     return(new SIMView
     {
         Id = sim.Id.ToString(),
         CustomerName = sim.Customer.Name,
         CustomerCMND = sim.Customer.CMND,
         OpenTime = sim.OpenTime.ToString(),
         CloseTime = sim.CloseTime.ToString(),
         PhoneNumber = sim.PhoneNumber.Number,
         Bills = sim.Bills.ConvertToViews().ToList(),
         PhoneCalls = sim.PhoneCalls.ConvertToViews().ToList()
     });
 }
Example #6
0
        public static void StopAsync()
        {
            Debug.Assert(Instance.CurrentSimulation != null);

            Instance.Actions.Enqueue(() =>
            {
                var simulation = Instance.CurrentSimulation;
                using (var db = DatabaseManager.Open())
                {
                    try
                    {
                        simulation.Status = "Stopping";
                        NotificationManager.SendNotification("simulation", SimulationResponse.Create(simulation), simulation.Owner);

                        if (ApiManager.Instance != null)
                        {
                            SceneManager.MoveGameObjectToScene(ApiManager.Instance.gameObject, SceneManager.GetActiveScene());
                        }
                        SIM.LogSimulation(SIM.Simulation.ApplicationClick, "Exit");
                        var loader        = SceneManager.LoadSceneAsync(Instance.LoaderScene);
                        loader.completed += op =>
                        {
                            if (op.isDone)
                            {
                                AssetBundle.UnloadAllAssetBundles(true);
                                Instance.LoaderUI.SetLoaderUIState(LoaderUI.LoaderUIStateType.START);

                                simulation.Status = "Valid";
                                NotificationManager.SendNotification("simulation", SimulationResponse.Create(simulation), simulation.Owner);
                                Instance.CurrentSimulation = null;
                            }
                        };
                    }
                    catch (Exception ex)
                    {
                        Debug.Log($"Failed to stop '{simulation.Name}' simulation");
                        Debug.LogException(ex);

                        // NOTE: In case of failure we have to update Simulation state
                        simulation.Status = "Invalid";
                        simulation.Error  = ex.Message;
                        db.Update(simulation);

                        // TODO: take ex.Message and append it to response here
                        NotificationManager.SendNotification("simulation", SimulationResponse.Create(simulation), simulation.Owner);
                    }
                }
            });
        }
Example #7
0
        private void Awake()
        {
            stopWatch.Start();
            SIM.Identify();
            RenderLimiter.RenderLimitEnabled();
            if (!PlayerPrefs.HasKey("Salt"))
            {
                byte[] toReadBytes           = new byte[8];
                RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
                rng.GetBytes(toReadBytes);
                PlayerPrefs.SetString("Salt", ByteArrayToString(toReadBytes));
            }

            Config.salt = StringToByteArray(PlayerPrefs.GetString("Salt"));
        }
        // GET: SIMs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SIM sIM = db.SIMs.Find(id);

            if (sIM == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ID_CUSTOMER = new SelectList(db.CUSTOMERs, "ID_CUSTOMER", "NAME", sIM.ID_CUSTOMER);
            return(View(sIM));
        }
        public void Execute(JSONNode args)
        {
            var uid       = args["uid"].Value;
            var waypoints = args["waypoints"].AsArray;
            var loop      = args["loop"];
            var api       = ApiManager.Instance;

            if (waypoints.Count == 0)
            {
                api.SendError($"Waypoint list is empty");
                return;
            }

            if (api.Agents.TryGetValue(uid, out GameObject obj))
            {
                var npc = obj.GetComponent <NPCController>();
                if (npc == null)
                {
                    api.SendError($"Agent '{uid}' is not a NPC agent");
                    return;
                }

                var wp = new List <DriveWaypoint>();
                for (int i = 0; i < waypoints.Count; i++)
                {
                    var deactivate = waypoints[i]["deactivate"];

                    wp.Add(new DriveWaypoint()
                    {
                        Position        = waypoints[i]["position"].ReadVector3(),
                        Speed           = waypoints[i]["speed"].AsFloat,
                        Angle           = waypoints[i]["angle"].ReadVector3(),
                        Idle            = waypoints[i]["idle"].AsFloat,
                        Deactivate      = deactivate.IsBoolean ? deactivate.AsBool : false,
                        TriggerDistance = waypoints[i]["trigger_distance"].AsFloat
                    });;
                }

                var loopValue = loop.IsBoolean ? loop.AsBool : false;
                npc.SetFollowWaypoints(wp, loopValue);
                api.SendResult();
                SIM.LogAPI(SIM.API.FollowWaypoints, "NPC");
            }
            else
            {
                api.SendError($"Agent '{uid}' not found");
            }
        }
Example #10
0
        public void Execute(JSONNode args)
        {
            var api = ApiManager.Instance;
            var uid = args["uid"].Value;

            if (api.Agents.TryGetValue(uid, out GameObject obj))
            {
                api.Collisions.Add(obj);
                api.SendResult(this);
                SIM.LogAPI(SIM.API.OnCollisionSet, obj.tag);
            }
            else
            {
                api.SendError(this, $"Agent '{uid}' not found");
            }
        }
Example #11
0
        public void Execute(JSONNode args)
        {
            var api = ApiManager.Instance;
            var uid = args["uid"].Value;

            if (api.Agents.TryGetValue(uid, out GameObject obj))
            {
                api.LaneChange.Add(obj);
                api.SendResult();
                SIM.LogAPI(SIM.API.OnLaneChanged);
            }
            else
            {
                api.SendError($"Agent '{uid}' not found");
            }
        }
Example #12
0
        //
        // GET: /Admin/SIM/Details/5

        public ViewResult Details(int id)
        {
            if (IsNotLogin())
            {
                return(View(MUST_LOGIN_AREA));
            }

            SIM dbSIM = Db.SIM.Find(id);

            if (dbSIM.SimId == 0)
            {
                throw new HttpException(404, String.Empty);
            }

            return(View(dbSIM));
        }
Example #13
0
        public void Execute(JSONNode args)
        {
            var uid       = args["uid"].Value;
            var waypoints = args["waypoints"].AsArray;
            var loop      = args["loop"].AsBool;
            var api       = ApiManager.Instance;

            if (waypoints.Count == 0)
            {
                api.SendError(this, $"Waypoint list is empty");
                return;
            }

            if (api.Agents.TryGetValue(uid, out GameObject obj))
            {
                var ped = obj.GetComponent <PedestrianController>();
                if (ped == null)
                {
                    api.SendError(this, $"Agent '{uid}' is not a pedestrian agent");
                    return;
                }

                var wp = new List <WalkWaypoint>();
                for (int i = 0; i < waypoints.Count; i++)
                {
                    wp.Add(new WalkWaypoint()
                    {
                        Position        = waypoints[i]["position"].ReadVector3(),
                        Speed           = waypoints[i]["speed"].AsFloat,
                        Idle            = waypoints[i]["idle"].AsFloat,
                        TriggerDistance = waypoints[i]["trigger_distance"].AsFloat,
                        Trigger         = DeserializeTrigger(waypoints[i]["trigger"])
                    });
                }

                ped.FollowWaypoints(wp, loop);
                api.RegisterAgentWithWaypoints(ped.gameObject);
                api.SendResult(this);
                SIM.LogAPI(SIM.API.FollowWaypoints, "Pedestrian");
            }
            else
            {
                api.SendError(this, $"Agent '{uid}' not found");
            }
        }
Example #14
0
        public void Execute(JSONNode args)
        {
            var api = ApiManager.Instance;

            var timeScale = args["time_scale"];

            if (timeScale == null || timeScale.IsNull)
            {
                api.TimeScale = 1f;
            }
            else
            {
                api.TimeScale = timeScale.AsFloat;
            }

            SimulatorManager.SetTimeScale(api.TimeScale);

            var timeLimit = args["time_limit"].AsFloat;

            if (timeLimit != 0)
            {
                var frameLimit = (int)(timeLimit / Time.fixedDeltaTime);
                api.FrameLimit = api.CurrentFrame + frameLimit;
            }
            else
            {
                api.FrameLimit = 0;
            }

            //Start the scenario runner here
            var use_case_id  = args["use_case_id"].AsInt;
            var scenario_id  = args["scenario_id"].AsInt;
            var test_case_id = args["test_case_id"].AsInt;

            //ArrayList results;
            SimulatorManager.Instance.Scenario_Config(use_case_id, scenario_id, test_case_id);
            // var results_json = new JSONArray();

            // foreach(String result in results)
            // {
            //     results_json.Add(new JSONString(result));
            // }
            // api.SendResult(results_json);
            SIM.LogAPI(SIM.API.SimulationRun, timeLimit.ToString());
        }
        public ActionResult Create(PhieuMua NewOrder)
        {
            if (IsNotLogin())
            {
                return(View(MUST_LOGIN_AREA));
            }

            IEnumerable <SIM>       dbsSIM      = Db.SIM.All;
            IEnumerable <KhachHang> dbsCustomer = Db.Customer.All;

            if (!ModelState.IsValid)
            {
                ViewBag.SimId = new SelectList(dbsSIM, "SimId", "SoThueBao", NewOrder.SimId);
                ViewBag.MaKH  = new SelectList(dbsCustomer, "MaKH", "TenKH", NewOrder.MaKH);

                return(View(NewOrder));
            }

            if (Db.Order.IsOrdered(NewOrder.SimId))
            {
                ViewBag.FailMsg = "SIM này đã được đặt hàng";
                ViewBag.SimId   = new SelectList(dbsSIM, "SimId", "SoThueBao", NewOrder.SimId);
                ViewBag.MaKH    = new SelectList(dbsCustomer, "MaKH", "TenKH", NewOrder.MaKH);

                return(View(NewOrder));
            }

            if (Db.Order.Save(NewOrder) <= 0)
            {
                ViewBag.FailMsg = "Có lỗi trong quá trình xử lý";
                ViewBag.SimId   = new SelectList(dbsSIM, "SimId", "SoThueBao", NewOrder.SimId);
                ViewBag.MaKH    = new SelectList(dbsCustomer, "MaKH", "TenKH", NewOrder.MaKH);

                return(View(NewOrder));
            }

            SIM dbSIM = Db.SIM.Find(NewOrder.SimId);

            dbSIM.TinhTrang = SIM.NOT_PAID;

            Db.SIM.Save(dbSIM);
            Db.Customer.UpdateOrderAmount(NewOrder.MaKH, true);

            return(RedirectToAction("Index"));
        }
Example #16
0
        //
        // GET: /Admin/SIM/Edit/5

        public ActionResult Edit(int id)
        {
            if (IsNotLogin())
            {
                return(View(MUST_LOGIN_AREA));
            }

            SIM dbSIM = Db.SIM.Find(id);

            if (dbSIM.SimId == 0)
            {
                throw new HttpException(404, String.Empty);
            }

            ViewBag.TinhTrang = new SelectList(dbSIM.CacTinhTrang, "Value", "Text", dbSIM.TinhTrang);

            return(View(dbSIM));
        }
Example #17
0
        private void EditorInit()
        {
#if UNITY_EDITOR
            stopWatch.Start();
            var info = Resources.Load <BuildInfo>("BuildInfo");
            SIM.Init(info == null ? "Development" : info.Version);
            SIM.LogSimulation(SIM.Simulation.ApplicationStart);
            Instance = this;

            var sim = Instantiate(Instance.SimulatorManagerPrefab);
            sim.name = "SimulatorManager";
            bool useSeed    = false;
            int? seed       = null;
            bool enableNPCs = false;
            bool enablePEDs = false;

            var data = UnityEditor.EditorPrefs.GetString("Simulator/DevelopmentSettings");
            if (data != null)
            {
                try
                {
                    var json = JSONNode.Parse(data);

                    useSeed = json["UseSeed"];
                    if (useSeed)
                    {
                        seed = json["Seed"];
                    }

                    enableNPCs = json["EnableNPCs"];
                    enablePEDs = json["EnablePEDs"];
                }
                catch (System.Exception ex)
                {
                    Debug.LogException(ex);
                }
            }

            sim.Init(seed);
            sim.AgentManager.SetupDevAgents();
            sim.NPCManager.NPCActive = enableNPCs;
            sim.PedestrianManager.PedestriansActive = enablePEDs;
#endif
        }
 public bool SaveEntities(SIM sIM)
 {
     if (sIM.KeyId == 0)
     {
         if (simDAL.Add(sIM) != null)
         {
             return(true);
         }
         return(false);
     }
     else
     {
         if (simDAL.Update(sIM) != null)
         {
             return(true);
         }
         return(false);
     }
 }
Example #19
0
        public int Save(Entities.SIM Entity)
        {
            if (Entity.SimId != 0)
            {
                SIM original = Find(Entity.SimId);
                original.MaSIM     = Entity.MaSIM;
                original.SoThueBao = Entity.SoThueBao;
                original.GiaTien   = Entity.GiaTien;
                original.TinhTrang = Entity.TinhTrang;

                return(1);
            }

            int countBefore = sims.Count;

            sims.Add(Entity);

            return(sims.Count - countBefore);
        }
Example #20
0
        private void btnAddSim_Click(object sender, EventArgs e)
        {
            decimal quantity = nudViewSimQuantity.Value;

            for (decimal i = 0; i < quantity; i++)
            {
                SIM sim = new SIM();
                sim.KeyId         = 0;
                sim.PhoneNumberFK = null;

                if (!simBUS.SaveEntities(sim))
                {
                    return;
                }
            }

            LoadAll();
            GetComboboxActiveSim(cbxSimActive, simBUS.GetActiveSim());
        }
Example #21
0
        public void Display()
        {
            SIM   = SIM.Where(x => x != null).OrderBy(x => x.name).ToArray();
            Phone = Phone.Where(x => x != null).OrderBy(x => x.name).ToArray();

            Console.WriteLine("----------Printing Contacts from SIM----------");
            for (int i = 0; i < getCount(SIM); i++)
            {
                Contacts contactObject = SIM[i];
                Console.WriteLine("{0}. Name: {1}, Mobile Number: {2}, Email Id: {3}", i + 1, contactObject.name, contactObject.mobileNumber, contactObject.emailId);
            }
            Console.WriteLine();
            Console.WriteLine("----------Printing Contacts from Phone----------");
            for (int i = 0; i < getCount(Phone); i++)
            {
                Contacts contactObject = Phone[i];
                Console.WriteLine("{0}. Name: {1}, Mobile Number: {2}, Email Id: {3}", i + 1, contactObject.name, contactObject.mobileNumber, contactObject.emailId);
            }
        }
Example #22
0
    public GameObject SpawnAgent(AgentConfig config)
    {
        var go = Instantiate(config.Prefab);

        go.name = config.Name;
        var agentController = go.GetComponent <AgentController>();

        agentController.Config = config;
        SIM.LogSimulation(SIM.Simulation.VehicleStart, config.Name);
        ActiveAgents.Add(go);
        agentController.GTID = ++SimulatorManager.Instance.GTIDs;

        BridgeClient bridgeClient = null;

        if (config.Bridge != null)
        {
            bridgeClient = go.AddComponent <BridgeClient>();
            bridgeClient.Init(config.Bridge);

            if (config.Connection != null)
            {
                var split = config.Connection.Split(':');
                if (split.Length != 2)
                {
                    throw new Exception("Incorrect bridge connection string, expected HOSTNAME:PORT");
                }
                bridgeClient.Connect(split[0], int.Parse(split[1]));
            }
        }
        SIM.LogSimulation(SIM.Simulation.BridgeTypeStart, config.Bridge != null ? config.Bridge.Name : "None");
        if (!string.IsNullOrEmpty(config.Sensors))
        {
            SetupSensors(go, config.Sensors, bridgeClient);
        }

        agentController.AgentSensors.AddRange(agentController.GetComponentsInChildren <SensorBase>(true));

        go.transform.position = config.Position;
        go.transform.rotation = config.Rotation;
        agentController.Init();

        return(go);
    }
Example #23
0
        public static void Run()
        {
            var api = ApiManager.Instance;

            foreach (var kv in api.Agents)
            {
                var obj     = kv.Value;
                var sensors = obj.GetComponentsInChildren <SensorBase>();

                foreach (var sensor in sensors)
                {
                    var suid = api.SensorUID[sensor];
                    api.Sensors.Remove(suid);
                    api.SensorUID.Remove(sensor);
                }
            }

            api.Reset();
            SIM.LogAPI(SIM.API.SimulationReset);
        }
Example #24
0
    private void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }

        if (_instance != this)
        {
            DestroyImmediate(gameObject);
        }

        SIM.StartSession();

        var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);

        CurrentTime      = (DateTime.UtcNow - unixEpoch).TotalSeconds;
        SessionStartTime = CurrentTime;
        RenderLimiter.RenderLimitDisabled();
    }
Example #25
0
    private void OnDestroy()
    {
        controls.Disable();
        var elapsedTime = GetElapsedTime(SessionStartTime);

        SIM.LogSimulation(SIM.Simulation.HeadlessModeStop, value: elapsedTime, state: headless);
        SIM.LogSimulation(SIM.Simulation.InteractiveModeStop, value: elapsedTime, state: interactive);
        SIM.LogSimulation(SIM.Simulation.UsePredefinedSeedStop, state: useSeed);
        SIM.LogSimulation(SIM.Simulation.NPCStop, value: elapsedTime, state: npc);
        SIM.LogSimulation(SIM.Simulation.RandomPedestrianStop, value: elapsedTime, state: pedestrian);
        SIM.LogSimulation(SIM.Simulation.TimeOfDayStop, timeOfDay == "" ? string.Format("{0:hh}:{0:mm}", TimeSpan.FromHours(EnvironmentEffectsManager.currentTimeOfDay)) : timeOfDay, value: elapsedTime);
        SIM.LogSimulation(SIM.Simulation.RainStop, rain == 0f ? EnvironmentEffectsManager.rain.ToString() : rain.ToString(), elapsedTime);
        SIM.LogSimulation(SIM.Simulation.WetnessStop, wet == 0f ? EnvironmentEffectsManager.wet.ToString() : wet.ToString(), elapsedTime);
        SIM.LogSimulation(SIM.Simulation.FogStop, fog == 0f ? EnvironmentEffectsManager.fog.ToString() : fog.ToString(), elapsedTime);
        SIM.LogSimulation(SIM.Simulation.CloudinessStop, cloud == 0f ? EnvironmentEffectsManager.cloud.ToString() : cloud.ToString(), elapsedTime);
        SIM.LogSimulation(SIM.Simulation.MapStop, string.IsNullOrEmpty(mapName) ? UnityEngine.SceneManagement.SceneManager.GetActiveScene().name : mapName, elapsedTime);
        SIM.LogSimulation(SIM.Simulation.ClusterNameStop, clusterName, elapsedTime);
        SIM.LogSimulation(SIM.Simulation.SimulationStop, simulationName, elapsedTime);
        SIM.StopSession();
    }
Example #26
0
        //
        // GET: /SIM/Order/5

        public ActionResult Order(int id)
        {
            if (IsNotLogin())
            {
                return(View(MUST_LOGIN_AREA));
            }

            ViewBag.IsSIMSold         = false;
            ViewBag.IsSIMOrdered      = false;
            ViewBag.IsOrderReachLimit = false;

            SIM dbSIM = Db.SIM.Find(id);

            if (dbSIM.SimId == 0)
            {
                throw new HttpException(404, String.Empty);
            }

            if (dbSIM.TinhTrang == SIM.SOLD)
            {
                ViewBag.IsSIMSold = true;

                return(View());
            }
            else if (dbSIM.TinhTrang == SIM.NOT_PAID)
            {
                ViewBag.IsSIMOrdered = true;

                return(View());
            }
            else if (Db.Order.IsCustomerOutOfOrderTimes(base.MaKH))
            {
                ViewBag.IsOrderReachLimit = true;

                return(View());
            }

            ViewBag.KhachHang = Db.Customer.Find(MaKH);

            return(View(dbSIM));
        }
Example #27
0
        public void Execute(JSONNode args)
        {
            var uid = args["uid"].Value;
            var api = ApiManager.Instance;

            if (api.Agents.TryGetValue(uid, out GameObject obj))
            {
                var sensors = obj.GetComponentsInChildren <SensorBase>();

                if (SimulatorManager.InstanceAvailable)
                {
                    foreach (var sensor in sensors)
                    {
                        SimulatorManager.Instance.Sensors.UnregisterSensor(sensor);
                    }
                }

                SimulatorManager.Instance.AgentManager.DestroyAgent(obj);

                var npc = obj.GetComponent <NPCController>();
                if (npc != null)
                {
                    SimulatorManager.Instance.NPCManager.DespawnVehicle(npc);
                }

                var ped = obj.GetComponent <PedestrianController>();
                if (ped != null)
                {
                    SimulatorManager.Instance.PedestrianManager.DespawnPedestrianApi(ped);
                }

                api.Agents.Remove(uid);
                api.AgentUID.Remove(obj);
                api.SendResult(this);
                SIM.LogAPI(SIM.API.RemoveAgent, obj.name);
            }
            else
            {
                api.SendError(this, $"Agent '{uid}' not found");
            }
        }
Example #28
0
        private void Awake()
        {
            stopWatch.Start();
            RenderLimiter.RenderLimitEnabled();

            var info = Resources.Load <BuildInfo>("BuildInfo");

            SIM.Init(info == null ? "Development" : info.Version);

            if (PlayerPrefs.HasKey("Salt"))
            {
                Config.salt = StringToByteArray(PlayerPrefs.GetString("Salt"));
            }
            else
            {
                Config.salt = new byte[8];
                RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
                rng.GetBytes(Config.salt);
                PlayerPrefs.SetString("Salt", ByteArrayToString(Config.salt));
                PlayerPrefs.Save();
            }
        }
Example #29
0
        public static void Run()
        {
            var api = ApiManager.Instance;

            foreach (var kv in api.Agents)
            {
                var obj     = kv.Value;
                var sensors = obj.GetComponentsInChildren <SensorBase>();

                foreach (var sensor in sensors)
                {
                    var suid = api.SensorUID[sensor];
                    api.Sensors.Remove(suid);
                    api.SensorUID.Remove(sensor);
                }

                var sim = SimulatorManager.Instance;

                if (obj.GetComponent <VehicleController>() != null)
                {
                    sim.AgentManager.DestroyAgent(obj);
                }

                var npc = obj.GetComponent <NPCController>();
                if (npc != null)
                {
                    sim.NPCManager.DespawnVehicle(npc);
                }

                var ped = obj.GetComponent <PedestrianController>();
                if (ped != null)
                {
                    sim.PedestrianManager.DespawnPedestrianApi(ped);
                }
            }

            api.Reset();
            SIM.LogAPI(SIM.API.SimulationReset);
        }
Example #30
0
        public bool SaveEntities(InvoiceRegister invoiceRegister)
        {
            if (invoiceRegister.KeyId == 0)
            {
                if (invoiceRegisterDAL.Add(invoiceRegister) != null)
                {
                    PhoneNumber phoneNumber = phoneNumberDAL.GetById(invoiceRegister.PhoneNumberFK);
                    phoneNumber.Status = true;
                    if (phoneNumberDAL.Update(phoneNumber) != null)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else
            {
                if (invoiceRegisterDAL.Update(invoiceRegister) != null)
                {
                    PhoneNumber phoneNumber = phoneNumberDAL.GetById(invoiceRegister.PhoneNumberFK);
                    phoneNumber.Status = false;

                    SIM sIM = simDAL.GetTheLastestSIM(phoneNumber.PhoneNo);
                    sIM.Status = false;

                    if (invoiceRegisterDAL.Update(invoiceRegister) != null)
                    {
                        if (phoneNumberDAL.Update(phoneNumber) != null)
                        {
                            if (simDAL.Update(sIM) != null)
                            {
                                return(true);
                            }
                        }
                    }
                }
                return(false);
            }
        }
Example #31
0
        public IEnumerable <SIM> FindCustomerOrderSIMs(int CustomerId)
        {
            try
            {
                DbDataReader dbReader = DbContext.RecordSets("findPhieuMuaOrderdByMaKH",
                                                             new SqlParameter(PARAM_MA_KH, CustomerId),
                                                             new SqlParameter(SimRepository.PARAM_TINH_TRANG, String.Empty)
                                                             );

                if (!dbReader.HasRows)
                {
                    return(new List <SIM>());
                }

                SIM        rSIM;
                List <SIM> rsSIMs = new List <SIM>();

                while (dbReader.Read())
                {
                    rSIM       = new SIM();
                    rSIM.SimId = dbReader.GetInt32(dbReader.GetOrdinal(COL_SIM_ID));

                    SIM tmp = new SimRepository(DbFactory).Find(rSIM.SimId);

                    rSIM.SoThueBao = tmp.SoThueBao;
                    rSIM.TinhTrang = tmp.TinhTrang;

                    rsSIMs.Add(rSIM);
                }

                return(rsSIMs);
            }
            catch (Exception)
            {
            }

            return(new List <SIM>());
        }
 protected override void Process(SIM.Pipelines.Install.InstallArgs args)
 {
     Assert.ArgumentNotNull(args, "args");
     Assert.IsNotNull(args.Instance, "Instance", true);
     ConfigurationActions.ExecuteActions(args.Instance, args.Modules.ToArray(), this.done, this.ProcessorDefinition.Param, args.ConnectionString, this.Controller, null);
 }