public bool UpdateNpc(int id, Pc npc) { using (var connection = new SqlConnection(conString)) { connection.Open(); var pcUpdate = connection.Execute(@"UPDATE [dbo].[Pc] SET [name] = @name,[characteristics] = @characteristics ,[description] = @description,[hit_points] = @hit_points ,[proficiency_score] = @proficiency_score ,[experience] = @experience,[level] = @level,[is_active] = @is_active ,[race_name] = @race_name WHERE Pc.id = @id", new { id = npc.id, name = npc.name, characteristics = npc.characteristics, description = npc.description, hit_points = npc.hit_points, proficiency_score = npc.proficiency_score, experience = npc.experience, level = npc.level, is_active = npc.is_active, race_name = npc.race_name }); _baseStorage.UpdateAbilityScores(npc.abilityScores); return(pcUpdate == 1); } }
public bool Remove(int id) { Pc pc = this.repositary.FindById(id); this.repositary.Remove(pc); return(true); }
public ActionResult DeleteConfirmed(int id) { Pc pc = db.Pcs.Find(id); db.Pcs.Remove(pc); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Configure(Pc pc) { pc.Box = PcFactory.CreateBox(); pc.MainBoard = PcFactory.CreateMainBoard(); pc.Processor = PcFactory.CreateProcessor(); pc.Hdd = PcFactory.CreateHdd(); pc.Memory = PcFactory.CreateMemory(); }
// Start is called before the first frame update void Start() { PcC = GameObject.Find("PcC").GetComponent <Canvas>(); objOpciones = GameObject.Find("PcC/OpcionesIniciales"); ObjCaja = GameObject.Find("PcC/pc"); selectorPos = GameObject.Find("PcC/OpcionesIniciales/Selector").GetComponent <RectTransform>(); Pcscript = FindObjectOfType <Pc>(); }
public override void OnInitialize(Unit _parent) { base.OnInitialize(_parent); if (!(_parent is Pc)) { Debug.LogError("you must have Pc Component!"); } pc = _parent as Pc; }
public void should_calculate_total_option_price() { Pc monPc = new Pc(new Dictionary <string, double> { { "Nvidia", 200 }, { "WD green", 75 } }, 150); Assert.AreEqual(monPc.getPrice(), 425); }
public void MergeFrom(Event other) { if (other == null) { return; } if (other.Created != 0L) { Created = other.Created; } if (other.Source.Length != 0) { Source = other.Source; } if (other.Instance.Length != 0) { Instance = other.Instance; } switch (other.MsgCase) { case MsgOneofCase.Ka: if (Ka == null) { Ka = new global::Monik.Common.KeepAlive(); } Ka.MergeFrom(other.Ka); break; case MsgOneofCase.Lg: if (Lg == null) { Lg = new global::Monik.Common.Log(); } Lg.MergeFrom(other.Lg); break; case MsgOneofCase.Pc: if (Pc == null) { Pc = new global::Monik.Common.PerfCounter(); } Pc.MergeFrom(other.Pc); break; case MsgOneofCase.Mc: if (Mc == null) { Mc = new global::Monik.Common.Metric(); } Mc.MergeFrom(other.Mc); break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
private ABS GetAbilityScores(Pc pc) { using (var connection = new SqlConnection(conString)) { connection.Open(); var abilityScores = connection.Query <ABS>(@"Select * from PcAs as p Where p.owner_id = @id", new { id = pc.id }); var pcAbs = abilityScores.ElementAt(0); return(pcAbs); } }
static void Main(string[] args) { // видео https://youtu.be/J4mD4mkTbog Mac air = new Mac(); Computer.Run(air.PowerOn, air.Power, air.Rendering, air.PowerOff); Pc pc = new Pc(); Computer.Run(pc.PowerOn, pc.Power, pc.PlayDota, null); }
public async Task <IHttpActionResult> GetPc(int id) { Pc pc = await db.Pcs.FindAsync(id); if (pc == null) { return(NotFound()); } return(Ok(pc)); }
// GET: api/ByteJpeg/5 public string Get(int id) { Pc pc = db.Pcs.Find(id); IPAddress iPAddress; if (pc == null) { return(null); } else if (string.IsNullOrWhiteSpace(pc.IP) || !IPAddress.TryParse(pc.IP, out iPAddress)) { return(null); } string retMess = ""; try { byte[] data = Encoding.UTF8.GetBytes("jpg"); TcpClient client = new TcpClient(); client.Connect(pc.IP, 1488); NetworkStream ns = client.GetStream(); ns.Write(data, 0, data.Length); data = new byte[64]; int bytes = 0; StringBuilder sb = new StringBuilder(); do { bytes = ns.Read(data, 0, data.Length); sb.Append(Encoding.UTF8.GetString(data, 0, bytes)); }while (ns.DataAvailable); ns.Close(); client.Close(); retMess = sb.ToString(); } catch (Exception e) { return(null); } /* * ByteJpeg byteJpeg = (ByteJpeg)JsonSerializer.Deserialize(retMess,typeof(ByteJpeg)); * * return byteJpeg; */ return(retMess); }
public IActionResult UpdateNpc(Pc npc, int id) { if (npc != null) { return(Ok(_pcStorage.UpdatePc(npc, id))); } else { return(BadRequest()); } }
public static PcDto ToDto(this Pc pc) { return(new PcDto { CPU = pc.CPU, GPU = pc.GPU, Name = pc.Name, Price = pc.Price, Id = pc.Id }); }
public async Task <IActionResult> Create([Bind("Id,IP,Adress_Mac,Name,ParcID,AD")] Pc pc) { if (ModelState.IsValid) { _context.Add(pc); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ParcID"] = new SelectList(_context.Parcs, "ID", "Name", pc.ParcID); return(View(pc)); }
public IActionResult AddPc(Pc pc) { if (pc != null && pc.type == "pc") { return(Ok(_pcStorage.AddPc(pc))); } else { string message = "Please use a valid character with type: pc"; return(BadRequest(message)); } }
void showWinPicture() { Text.text = "you win"; Pnon.SetActive(false); Pa.SetActive(false); Pb.SetActive(false); Pc.SetActive(false); Pd.SetActive(false); Pe.SetActive(false); Pwin.SetActive(false); KK = ShowPic(WINNUM + 1, WIN); }
public Pc CreatePc() { Pc pc; var factory = new DellFactory(); var ram = new Ram(8); var videoCard = new ColorfullVideoCard(); pc = new Pc(new Cpu64(4, ram, videoCard), ram, new[] { new HardDriver(1000) }, videoCard); return(pc); }
public async Task <IActionResult> Edit(int id, [Bind("HardWareId,Id,Model,SerialNumber,SoftWareId,EquipUserId,ManufactureId")] Pc pc) { if (id != pc.Id) { ModelState.AddModelError("", "pc not found"); return(RedirectToAction(nameof(Index))); } List <SelectListItem> selects = new SelectList(_context.EquipUsers, "Id", "FullName", pc.EquipUserId).ToList(); selects.Insert(0, (new SelectListItem { Text = "None", Value = "" })); ViewData["EquipUserId"] = selects; ViewData["SoftWareId"] = new SelectList(_context.SoftWares, "Id", "Name", pc.SoftWareId); ViewData["HardWareId"] = new SelectList(_context.HardWares, "Id", "HardType", pc.HardWareId); ViewData["Manufature"] = new SelectList(_context.Manufactures, "Id", "Name", pc.ManufactureId); if (ModelState.IsValid) { try { _context.Update(pc); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } catch (DbUpdateConcurrencyException ex) { if (!PcExists(pc.Id)) { ModelState.AddModelError("", "Unable to save changes, Try again"); _logger.LogError("DbUpdateException on created Pc: " + ex.Message); return(View(pc)); } } catch (DbUpdateException ex) { _logger.LogError("DbUpdateException on created Pc: " + ex.Message); ModelState.AddModelError("", "Unable to save changes, Try again"); return(View(pc)); } return(RedirectToAction(nameof(Index))); } ViewData["EquipUserId"] = new SelectList(_context.EquipUsers, "Id", "Discriminator", pc.EquipUserId); ViewData["SoftWareId"] = new SelectList(_context.SoftWares, "Id", "Id", pc.SoftWareId); ViewData["HardWareId"] = new SelectList(_context.HardWares, "Id", "Id", pc.HardWareId); ViewData["Manufature"] = new SelectList(_context.Manufactures, "Id", "Name", pc.ManufactureId); return(View(pc)); }
public override int GetHashCode() { unchecked { var hashCode = Label.GetHashCode(); hashCode = (hashCode * 397) ^ Instr.GetHashCode(); hashCode = (hashCode * 397) ^ Pc.GetHashCode(); hashCode = (hashCode * 397) ^ RawBytes.GetHashCode(); hashCode = (hashCode * 397) ^ Ia.GetHashCode(); hashCode = (hashCode * 397) ^ RealComment.GetHashCode(); return(hashCode); } }
public ActionResult Edit([Bind(Include = "PcID,FuncionarioID,ModPcID,NomePc,Série,PlaquetaID,Auditorado,DataCompra,Preço")] Pc pc) { if (ModelState.IsValid) { db.Entry(pc).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FuncionarioID = new SelectList(db.Funcionarios, "FuncionarioID", "Nome", pc.FuncionarioID); ViewBag.ModPcID = new SelectList(db.ModPcs, "ModPcID", "Modelo", pc.ModPcID); ViewBag.PlaquetaID = new SelectList(db.Plaquetas, "PlaquetaID", "PlaquetaID", pc.PlaquetaID); return(View(pc)); }
private void dbInit() { pc = InitPC().Result; if (pc == null) { return; } // Тут нужно создавать комп? хз пока SendGeneralInfo(); // Тут отправляем всю основную инфу о компе SendDrive(); // Тут все винты // Хз, возможно лучше объединить это все в один класс и отправлять его JSON'ом // А не плодить сразу три запроса на сервак }
public IActionResult AddNpc(Pc npc) { var race = npc.race; if (npc != null && npc.type == "npc") { return(Ok(_pcStorage.AddPc(npc))); } else { string message = "Please use a valid character with type: npc"; return(BadRequest(message)); } }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pc pc = db.Pcs.Find(id); if (pc == null) { return(HttpNotFound()); } return(View(pc)); }
public int Modifier(Pc model) { try { return(Gestion.Modifier(model.Id, model.Nom, model.Prix, model.PrixPromo, model.Processeur, model.CarteMere, model.Ram, model.CarteGraphique, model.DisqueDur1, model.DisqueDur2, model.Boitier, model.Alimentation, model.Refroidissement )); } catch (Exception e) { throw new Exception($"Impossible de modifier le pc {model.Id} : \n" + e.Message); } }
public Pc CreatePc() { Pc pc; var ram = new Ram(2); var videoCard = new ColorfullVideoCard(); pc = new Pc( new Cpu32(2, ram, videoCard), ram, new[] { new HardDriver(500) }, videoCard); return(pc); }
static void confi_pc() { string processador, placa_mae, gabinete; System.Console.Write("qual processador vc quer ?"); processador = System.Console.ReadLine(); System.Console.Write("qual placa mae vc quer ?"); placa_mae = System.Console.ReadLine(); System.Console.Write("qual gabinte vc quer ?"); gabinete = System.Console.ReadLine(); Pc Mypc = new Pc(gabinete, processador, placa_mae); }
public override void FromXml(XmlElement element) { base.FromXml(element); gametimeTicks = GetIntAttribute("gametime-ticks"); // TODO convert XML element and attribute names to constants pc = GetElement("pc") as Pc; LevelPersistencyHelper helper = new LevelPersistencyHelper(); helper.FromXml(element.SelectSingleNode("levels") as XmlElement); // TODO probably wrong level = helper.StartingLevel; fieldOfVision = GetElement("field-of-vision") as AbstractFieldOfVision; viewPort = GetElement("viewport") as ViewPort; //console = new SystemConsole(); viewPort.Console = console; viewPort.Map = Level.Map; }
public ActionResult eliminarPc(int id) { Pc objC = ListPc().Where(e => e.codigo == id).FirstOrDefault(); List <SqlParameter> lista = new List <SqlParameter>() { new SqlParameter() { ParameterName = "@ID_PC", SqlDbType = SqlDbType.Int, Value = objC.codigo } }; Crud("SP_ELIMINAPC", lista); return(RedirectToAction("listadoPc")); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pc pc = db.Pcs.Find(id); if (pc == null) { return(HttpNotFound()); } ViewBag.FuncionarioID = new SelectList(db.Funcionarios, "FuncionarioID", "Nome", pc.FuncionarioID); ViewBag.ModPcID = new SelectList(db.ModPcs, "ModPcID", "Modelo", pc.ModPcID); ViewBag.PlaquetaID = new SelectList(db.Plaquetas, "PlaquetaID", "PlaquetaID", pc.PlaquetaID); return(View(pc)); }
protected override void runTurn() { base.runTurn(); // display the whole game screen console.ForegroundColor = ConsoleColor.Gray; showStatus(); fieldOfVision.ComputeFieldOfVision(Map, pc.Position, (Pc as VhPc).VisionRange); viewPort.RenderMap(fieldOfVision); foreach (Item item in Level.Items) viewPort.Display(item, fieldOfVision, pc.Position); foreach (Monster monster in Level.Monsters) viewPort.Display(monster, fieldOfVision, pc.Position); viewPort.Display(pc, fieldOfVision, pc.Position); viewPort.Refresh(); // select next action GameController.Instance.Console.ClearBuffer(); char c = GameController.Instance.Console.ReadKey(); AbstractAction action = null; // resets the action on each turn command = keybindings[c]; // in-game actions. // these are actions performed by the pc. action = pc.Ai.SelectAction(); //MessageWindow.Clear(); // perform selected pc action, if there is one. if (action != null && action.Perform()) { gametimeTicks = (int)(action.TimeNeeded / pc.Speed); moveMonsters(); Pc.Move(); runBaseAction(Pc); } else { // out-of-game actions. // these are actions performed by the player. // these actions do not take up gametime. if (Command == "backpack") showPcInventory(); else if (Command == "show-equipment") showEquipment(); else if (Command == "show-stats") showAttributes(); else if (Command == "show-help") showHelp(); else if (Command == "message-log") showMessageLog(); else if (Command == "show-plan") showPlan(); else if (Command == "quit") quit(); else if (Command == "save") saveGame(); } }