public bool ExecuteLearningTime() { try { var sourceMachine = Machines.Single(_ => _.Name == "APP1"); var sourceUser = Users.Single(_ => _.Name == "triservice"); // Generate Samr for domainController learning time foreach (var domainController in DomainControllers) { ActivitiesList.Add(DocumentCreator.SamrCreator(sourceUser, sourceMachine, domainController, DomainList.Single(_ => _.Id == sourceUser.Domain).Name , DomainList.Single(_ => _.Id == sourceMachine.Domain).Name, SourceGateway, true, SamrQueryType.EnumerateUsers, SamrQueryOperation.EnumerateUsersInDomain, DomainList.Single(_ => _.Id == sourceMachine.Domain).Id, 35)); } InsertActivities(true); do { SamrReconnaissanceDetectorProfile = GetSamrDetectorProfile(); } while (SamrReconnaissanceDetectorProfile["DestinationComputerIdToDetectionStartTimeMapping"] .AsBsonArray.Count != DomainControllers.Count); foreach (var coupledSamr in SamrCouples) { var samrAmount = coupledSamr.RatingType == "Low" ? 10 : 21; for (var samrIndex = 0; samrIndex < samrAmount; samrIndex++) { var queriedObject = Users[_random.Next(Users.Count)]; ActivitiesList.Add(DocumentCreator.SamrCreator(coupledSamr.User, coupledSamr.Machine, DomainControllers.First(_ => _.Domain == DomainList.Single(__ => __.Id == coupledSamr.Machine.Domain).Id), DomainList.Single(_ => _.Id == coupledSamr.User.Domain).Name , DomainList.Single(_ => _.Id == coupledSamr.Machine.Domain).Name, SourceGateway, true, SamrQueryType.QueryUser, SamrQueryOperation.QueryInformationUser, DomainList.Single(_ => _.Id == coupledSamr.Machine.Domain).Id, 10, queriedObject)); } } InsertActivities(); do { SamrReconnaissanceDetectorProfile = GetSamrDetectorProfile(); } while (SamrReconnaissanceDetectorProfile["DateToQueryToSamrQueryDataMapping"] .AsBsonArray.Count == 0); return(true); } catch (Exception e) { Logger.Debug(e); return(false); } }
public async Task <List <Machines> > Change_Status_Machine([FromBody] Receiver receiver) { List <Machines> temp = new List <Machines>(); Machines machines = receiver.machines; User user = receiver.user; if (machines.Status == "Ready") { machines.Status = "Broken"; } else if (machines.Status == "Broken") { machines.Status = "Ready"; } foreach (User usere in usersController.GetUsers()) { if (usere.Login == user.Login) { foreach (Machines edit_machines in GetMachines()) { if (edit_machines.No == machines.No) { string query = "UPDATE Machines SET Status = @Status WHERE No = @No;"; SqlCommand command = new SqlCommand(query, cnn); command.Parameters.Add("@No", SqlDbType.Int).Value = machines.No; command.Parameters.Add("@Status", SqlDbType.VarChar, 40).Value = machines.Status; cnn.Open(); command.ExecuteNonQuery(); command.Dispose(); cnn.Close(); string userhistory = "You changed status " + machines.No + " to " + machines.Status; string machinehistoryall = "machine status changed to " + machines.Status; usersController.Insert_User_History(userhistory, user.Login); Insert_Machine_History_All(machines.No, user.Login, machinehistoryall); temp.Add(machines); return(temp); } } machines.Error_Message = "Id_no_exist"; temp.Add(machines); return(temp); } } machines.Error_Message = "User_no_exist"; temp.Add(machines); return(temp); }
public byte[] HandlerClientData(byte[] buff) { int resInt = 0, machineId = 0; byte[] byteResp = { 0, 0, 0 }; DbTableDbContext db = new DbTableDbContext(); DeviceSetting outInfo = this.DecodeData(buff); FactoryRoom tempRoom = db.FactoryRoom.FirstOrDefault(item => item.RoomNumber == outInfo.RoomNumber); Machines tempMachine = db.Machines.FirstOrDefault(item => item.Number == outInfo.DeviceNumber); Machines innerInfo; if (outInfo.DeviceId < 1) { resInt = tempRoom == null ? 3 : (tempMachine != null ? 4 : 0); if (resInt != 0) { byteResp[0] = (byte)resInt; return(byteResp); } innerInfo = this.exchangeData(tempRoom, outInfo); db.FactoryRoom.Attach(tempRoom); tempRoom.MachineCount += 1; //记录原始数据 db.Machines.Add(innerInfo); //最近心跳设备记录 db.LastHeartBreak.Add(new LastHeartBreak() { DateRefresh = DateTime.Now, FactoryName = tempRoom.FactoryName, MachineId = innerInfo.ID, RoomID = tempRoom.RoomID, RoomName = tempRoom.RoomName, MachineName = outInfo.DeviceNumber }); } else { innerInfo = db.Machines.FirstOrDefault(item => (item.IpAddress == outInfo.IPAddress || item.Number == outInfo.DeviceNumber) && item.ID != outInfo.DeviceId); if (innerInfo != null) { byteResp[0] = (byte)4; return(byteResp); } innerInfo = db.Machines.Find(outInfo.DeviceId); db.Machines.Attach(innerInfo); this.exchangeData(innerInfo, tempRoom, outInfo); machineId = innerInfo.ID; } db.SaveChanges(); machineId = innerInfo.ID; //生成返回结果 byte[] byteID = ConvertHelper.Int16ToBytes(machineId, true); Array.Copy(byteID, 0, byteResp, 1, 2); return(byteResp); }
private void SelectMachine() { Vector2 position = RoundVector(MouseWorldPosition()); Machine machine = Machines.At(position); if (machine.wasPlaced) { UI.Select.Select(machine); } }
public void CreateMachine() { var mch = new MachineViewModel(new Machine { MchCode = "#New Machine" }); Machines.Add(mch); SelectedMachine = Machines.LastOrDefault(); SelectedMachine.Dirty = true; }
public ActionResult Edit([Bind(Include = "Id,Address,City,State,ZipCode")] Machines machines) { if (ModelState.IsValid) { db.Entry(machines).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(machines)); }
/// <summary> /// 内外部数据转换 /// </summary> /// <param name="innerInfo"></param> /// <param name="room"></param> /// <param name="info"></param> private void exchangeData(Machines innerInfo, FactoryRoom room, DeviceSetting info) { innerInfo.RoomID = room.RoomID; innerInfo.RoomName = room.RoomName; innerInfo.RoomNumber = room.RoomNumber; innerInfo.IpAddress = info.IPAddress; innerInfo.Number = info.DeviceNumber; innerInfo.Name = info.DeviceName; innerInfo.Status = enumMachineStatus.Normal; }
/// <summary> /// Refreshes the machines list and subscribes to machine events. /// </summary> public void LoadMachinesServices() { var machineIdsList = Machines.ConvertAll(machine => machine.MachineId); foreach (var machine in machineIdsList.Select(GetMachineById).Where(machine => machine != null)) { OnMachineListChanged(machine, ListChangeType.AddByLoad); machine.LoadServicesParameters(false); } }
private bool CanSelectMachine() { if (IsPointerOverUI()) { return(false); } Vector2 position = RoundVector(MouseWorldPosition()); return(Machines.ElementAt(position)); }
private void BgLoad_DoWork(object sender, DoWorkEventArgs e) { if (e.Argument != null) { Machines m = (Machines)e.Argument; e.Result = m; } listLines = daoLin.GetLines(Global.planta_selected); }
/// <summary> /// 内外部数据转换 /// </summary> /// <param name="info"></param> /// <param name="machine"></param> /// <returns></returns> private Models.HeartBreak exchangeData(HeartBreak info, Machines machine) { return(new Models.HeartBreak() { DateCreate = DateTime.Now, ChannelInfo = info.ChannelInfo, MachineId = machine.ID, MachineName = machine.Number }); }
private async Task FetchData() { try { if (await _connectionService.CheckConnection()) { var strSector = _settingsService.UserSectorSettings; int sector = 0; if (strSector == "Confection") { sector = 1; } else if (strSector == "Stiro") { sector = 2; } else if (strSector == "Ramendo") { sector = 6; } else if (strSector == "Tessitura") { sector = 7; } else if (strSector == "Sartoria") { sector = 8; } Machines = (await _masiniService.GetMachinesAsync(sector, _settingsService.UserLineSettings)).ToObservableCollection(); Orders = (await _orderService.GetOrdersAsync(sector)).ToObservableCollection(); var machineId = _settingsService?.MachineIdSettings.ToInteger(); SelectedMachine = _machines.Any(m => m.Id == machineId) ? Machines?.FirstOrDefault(m => m.Id == machineId) : null; SelectedOrder = _settingsService != null && _settingsService.CommessaFromBarcode != string.Empty ? (await _orderService.GetOrderWithName(_settingsService.CommessaFromBarcode)) : null; } else { await _dialogService.ShowDialog( "Connection problem please connect your device to WIFI and try again.", "Internet connection problem", "OK"); } } catch (HttpRequestExceptionEx e) { await _dialogService.ShowDialog(e.HttpCode.ToString(), "HttpRequestExceptionEx: FetchData, Please login or press Refresh button.", "OK"); } catch (Exception) { //ignore } }
public wsSQLResult InsertNewMachine(Stream JSONdataStream) { wsSQLResult result = new wsSQLResult(); try { //Read JSON Stream into a String.. StreamReader reader = new StreamReader(JSONdataStream); string JSONdata = reader.ReadToEnd(); // Convert to New User record.. JavaScriptSerializer jss = new JavaScriptSerializer(); Machines machine = jss.Deserialize <Machines>(JSONdata); if (machine == null) { // Error: Couldn't deserialize JSON String result.WasSuccessful = 0; result.Exception = "Unable to deserialize the JSON data."; return(result); } HomeNetworkDataContext dc = new HomeNetworkDataContext(); //if (user.UserID == Convert.ToString(dc.Users_HNUs.Where(i => i.UserID == user.UserID).FirstOrDefault())) //{ // // User Already Exists // return -3; //} // Insert Record to SQL Server Table Machines_HNM newMachine = new Machines_HNM() { MachineID = machine.MachineID, MachineName = machine.MachineName, MacAddress = machine.MacAddress, IPaddress = machine.IPaddress, Static = Convert.ToBoolean(machine.Static), MachineTypeID = machine.MachineTypeID, NetworkDeviceID = machine.NetworkDeviceID, LocationID = machine.LocationID, HostName = machine.HostName }; dc.Machines_HNMs.InsertOnSubmit(newMachine); dc.SubmitChanges(); result.WasSuccessful = 1; result.Exception = ""; return(result); } catch (Exception ex) { result.WasSuccessful = 0; result.Exception = ex.Message; return(result); } }
public void setMachine(int ID) { try { Machine = Machines.Single(item => item.ID == ID); } catch { //int a = 0; } }
public int AddMaquina(Machines m) { int res = 0; if (m != null) { res = mta.Insert(m.nombre, m.foto, m.id_planta); } return(res); }
public CuisineTest() { stock = Stock.GetInstance(); machinesUn = new Machines("test1", 35); machinesDeux = new Machines("test3", 35); array = new Machines[2] { machinesDeux, machinesUn }; ustenciles = Ustenciles.GetInstance(); passePlat = PassePlat.GetInstance(); }
private bool CanPlaceMachine() { if (IsPointerOverUI() || !UI.Machines.toPlace || UI.Select.selectedMachineGob != null) { return(false); } Vector2 position = RoundVector(MouseWorldPosition()); return(!Machines.ElementAt(position)); }
public void Reload() { Orders.Load(); Machines.Load(); Tasks.Load(); Customers.Load(); Properties.Load(); Rules.Load(); Refreshed?.Invoke(new RefreshEventArgs(this)); }
public bool CanRotate(Vector3 spin) { // List<Vector2> toCheck = Rotator.GetSquaresToCheck(this.xy, spin); // foreach (Vector2 p in toCheck) { // // Debug.Log(p); // } // ------testing: // spin = new Vector3 (10, 10, 1); // Vector2 pos = new Vector3 (10, 20); // Debug.Log("GROUP:::::::"); // foreach (Crate crate in this.group.crates) { // Debug.Log(crate.xy); // } List <Vector2> toCheck = Rotator.GetSquaresToCheck(this.xy, spin); if (dot) { foreach (Vector2 v in toCheck) { GameObject dotGO = Instantiate(dotPrefab); dotGO.transform.position = v; } } // Debug.LogFormat("Crate: Can Rotate {0}", this.xy); foreach (Vector2 target in toCheck) { // Debug.LogFormat("Checking {0}",target); Machine targetMachine = Machines.At(target); bool blockedByObstacle = targetMachine && targetMachine.isObstacle; if (blockedByObstacle) { Debug.Log("blockedByObstacle"); return(false); } bool blockedByPusherArm = CheckPusherArms(target); if (blockedByPusherArm) { Debug.Log("blockedByPusherArm"); return(false); } Crate targetCrate = Crates.At(target); if (targetCrate) { if (targetCrate && !group.crates.Contains(targetCrate)) { Debug.Log("blockedByOtherCrateGroup"); return(false); } } } return(true); }
public ActionResult Create([Bind(Include = "Id,Address,City,State,ZipCode")] Machines machines) { if (ModelState.IsValid) { db.Machines.Add(machines); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(machines)); }
public void UpdateMachineStatus([FromBody] Machines model) { var machines = _machinesRepository.GetAll(); foreach (var item in machines) { _machinesRepository.Delete(item); } _machinesRepository.Create(model); }
public async Task <IActionResult> Add(Machines model) { if (!ModelState.IsValid) { return(View(model)); } var result = await _machinesService.CreateAsync(model); return(View()); }
// Start is called before the first frame update void Start() { nukeStuckBall = GameControl.gameControl.matchSettings.nukeStuckBall; if (GameControl.gameControl.matchSettings.matchType == 0) { isTimeMatch = true; remainingTimeText = remainingTimeGameObject.GetComponent <TextMeshProUGUI>(); remainingTimeGameObject.SetActive(true); remainingGameTimeInSeconds = GameControl.gameControl.matchSettings.duration * 60; } else { isTimeMatch = false; goalsToWin = GameControl.gameControl.matchSettings.goalsToWin; } goals = new int[playerCount]; Array.Clear(goals, 0, goals.Length); machinesScript = GameObject.Find("Machines").GetComponent <Machines>(); ballScript = GameObject.Find("Ball").GetComponent <Ball>(); ball = GameObject.FindGameObjectWithTag("Ball"); GameObject courtGameObject = GameObject.Find("Court"); court = courtGameObject.GetComponent <Court>(); GameObject cameraGameObject = GameObject.Find("Camera"); arenaCamera = cameraGameObject.GetComponent <ArenaCamera>(); audioSource = GetComponent <AudioSource>(); goalBackground = goalBackgroundGameObject.GetComponent <UnityEngine.UI.Image>(); goalLabel = goalLabelGameObject.GetComponent <UnityEngine.UI.Image>(); goalLabelRectTransform = goalLabelGameObject.GetComponent <RectTransform>(); winnerText = gameOverGameObject.transform.GetChild(1).GetComponent <Text>(); loserText = gameOverGameObject.transform.GetChild(2).GetComponent <Text>(); goalTexts = new TextMeshProUGUI[goalTextGameObjects.Length]; int i = 0; foreach (GameObject goalTextGameObject in goalTextGameObjects) { goalTexts[i++] = goalTextGameObject.GetComponent <TextMeshProUGUI>(); } ballRigidbody = ball.GetComponent <Rigidbody>(); }
public void PauseAll() { //ToList cast is a precaution for a situation where the list of machines changes //during pausing. It might happen on rare occasions. E.g. when a script loads them, and user //hits the pause button. //Otherwise it would crash. foreach (var machine in Machines.ToList()) { machine.Pause(); } ExternalsManager.Pause(); }
private void InnerStartAll() { //ToList cast is a precaution for a situation where the list of machines changes //during start up procedure. It might happen on rare occasions. E.g. when a script loads them, and user //hits the pause button. //Otherwise it would crash. ExternalsManager.Start(); foreach (var machine in Machines.ToList()) { machine.Start(); } }
private List <Generator> GetGenerators() { List <Generator> list = new List <Generator>(); Machines.ForEach((machine) => { if (machine is Generator) { list.Add((Generator)machine); } }); return(list); }
private List <DropZone> GetDropZones() { List <DropZone> list = new List <DropZone>(); Machines.ForEach((machine) => { if (machine is DropZone) { list.Add((DropZone)machine); } }); return(list); }
/// <summary> /// 内外部数据转换 /// </summary> /// <param name="info"></param> /// <param name="machine"></param> /// <returns></returns> private Models.MachineReport exchangeData(Machines machine) { return(new Models.MachineReport() { DateCreate = DateTime.Now, MachineNumber = machine.Number, MachineId = machine.ID, RoomId = machine.RoomID, RoomNumber = machine.RoomName, RoomName = machine.RoomName }); }
private void PushWork() { if (Machines.ContainsValue(true) && ReadyItems.Count() != 0) { var key = Machines.First(X => X.Value == true).Key; Machines.Remove(key); var m = new MachineAgent.Work(ReadyItems.Dequeue(), key); Machines.Add(key, false); _SimulationContext.Tell(m, Sender); } ; }
public wsSQLResult UpdateMachine(Stream JSONdataStream) { wsSQLResult result = new wsSQLResult(); try { //Read JSON Stream into a String.. StreamReader reader = new StreamReader(JSONdataStream); string JSONdata = reader.ReadToEnd(); // Convert to New User record.. JavaScriptSerializer jss = new JavaScriptSerializer(); Machines machine = jss.Deserialize <Machines>(JSONdata); if (machine == null) { // Error: Couldn't deserialize JSON String result.WasSuccessful = 0; result.Exception = "Unable to deserialize the JSON data."; return(result); } HomeNetworkDataContext dc = new HomeNetworkDataContext(); Machines_HNM currentMach = dc.Machines_HNMs.Where(m => m.MachineID == machine.MachineID).FirstOrDefault(); if (currentMach == null) { // Couldnt Find User to Update result.WasSuccessful = -3; result.Exception = "Could not find a [Machines_HNU] record with ID: " + machine.MachineID.ToString(); return(result); } // Update Record to SQL Server Table currentMach.MachineID = machine.MachineID; currentMach.MachineName = machine.MachineName; currentMach.MacAddress = machine.MacAddress; currentMach.IPaddress = machine.IPaddress; currentMach.Static = Convert.ToBoolean(machine.Static); currentMach.MachineTypeID = machine.MachineTypeID; currentMach.NetworkDeviceID = machine.NetworkDeviceID; currentMach.LocationID = machine.LocationID; currentMach.HostName = machine.HostName; dc.SubmitChanges(); result.WasSuccessful = 1; result.Exception = ""; return(result); //Success } catch (Exception ex) { result.WasSuccessful = -1; result.Exception = "An exception occurred: " + ex.Message; return(result); //Failed } }