private IBlok CreateObject(DataRow dr) { var item = new Blok { Id = int.Parse(dr["mikro_blok_id"].ToString()), Ime = dr["blok_ime"].ToString(), Namena = dr["namena"].ToString(), Povrshina = (dr["povrsina"] == null || dr["povrsina"].ToString() == "") ? (double?)null : double.Parse(dr["povrsina"].ToString()), PovrshinaPresmetana = (dr["povrsina_presmetana"] == null || dr["povrsina_presmetana"].ToString() == "") ? (double?)null : double.Parse(dr["povrsina_presmetana"].ToString()) }; try { item.GeoJson = dr["geojson"].ToString(); } catch { // ignored } return(item); }
void PlayerCollisionTest(Blok entity) { if (!collisionManager.CheckCollision(player, entity)) { return; } //Are we on top? if (player.CollisionRectangle.Y + 60 < entity.CollisionRectangle.Y) { player.Position = new Vector2(player.Position.X, entity.CollisionRectangle.Top - player.CollisionRectangle.Height); player.canJump = true; } //touching the sides? else if (player.CollisionRectangle.X > entity.CollisionRectangle.X || player.CollisionRectangle.X < entity.CollisionRectangle.X) { player.Position = new Vector2(player.Position.X - player.Velocity.X, player.Position.Y); } //if we're headcrushing ourselves if (player.CollisionRectangle.Y > entity.CollisionRectangle.Y) { player.Position = new Vector2(player.Position.X, entity.CollisionRectangle.Bottom); } }
public async Task <IActionResult> PutBlok(int id, Blok blok) { if (id != blok.Id) { return(BadRequest()); } BlokValid valid = new BlokValid(_context, blok); if (valid.Valid() == false) { return(BadRequest("This Block is already exist")); } _context.Entry(blok).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BlokExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
// POST api/<controller> public Base Post([FromBody] Blok blok) { KatData kd = new KatData(); Base b = kd.Katlar(blok); return(b); }
void Teken() { var blokjes = GameObject.FindGameObjectsWithTag("blokje"); foreach (var blokje in blokjes) { Destroy(blokje); } for (int i = 0; i < blokarray.GetLength(0); i++) { for (int j = 0; j < blokarray.GetLength(1); j++) { for (int k = 0; k < blokarray.GetLength(2); k++) { if (blokarray[i, j, k] != null) { Blok HuidigBlok = blokarray[i, j, k]; GameObject newCube = Instantiate(prefab, new Vector3(HuidigBlok.posX, HuidigBlok.posY, HuidigBlok.posZ), Quaternion.identity); newCube.transform.Find("Bovenblokje").GetComponent <Renderer>().material.color = Colors[HuidigBlok.KleurBoven]; newCube.transform.Find("Onderblokje").GetComponent <Renderer>().material.color = Colors[HuidigBlok.KleurOnder]; newCube.transform.Find("Voorblokje").GetComponent <Renderer>().material.color = Colors[HuidigBlok.KleurVoor]; newCube.transform.Find("Achterblokje").GetComponent <Renderer>().material.color = Colors[HuidigBlok.KleurAchter]; newCube.transform.Find("Linksblokje").GetComponent <Renderer>().material.color = Colors[HuidigBlok.KleurLinks]; newCube.transform.Find("Rechtsblokje").GetComponent <Renderer>().material.color = Colors[HuidigBlok.KleurRechts]; } } } } }
public Zatvorenik(string _ime, string _prezime, string _adresa, DateTime _datumRodjenja, int _id, Spol _spol, string _napomene, Blok _blok, int _brojCelije, DateTime _datumDolaska, DateTime _datumOdlaska, Image slika) : base(_ime, _prezime, _adresa, _datumRodjenja, _id, _spol, _napomene, slika) { Blok = _blok; BrojCelije = _brojCelije; DatumDolaska = _datumDolaska; DatumOdlaska = _datumOdlaska; }
static void Main(string[] args) { Codering codering = new Codering("Dit is een oefening op Desing Patterns"); Blok gecodeerd = new Blok(codering); Console.WriteLine(gecodeerd.Code()); string test = "abc"; }
public Odjel(Blok _blok, int _brojMjesta, List <Cuvar> _cuvari, UpravnikOdjela _upravnik, List <Zatvorenik> _zatvorenici) { Blok = _blok; BrojMjesta = _brojMjesta; Cuvari = _cuvari; Upravnik = _upravnik; Zatvorenici = _zatvorenici; }
public Cuvar(string _ime, string _prezime, string _adresa, DateTime _datumRodjenja, int _id, Spol _spol, string _napomene, Blok _blok, DateTime _datumZaposlenja, List <Prisustvo> _prisustva, string _zaduzenje, Image slika) : base(_ime, _prezime, _adresa, _datumRodjenja, _id, _spol, _napomene, slika) { Blok = _blok; DatumZaposlenja = _datumZaposlenja; Prisustva = _prisustva; Zaduzenje = _zaduzenje; }
public ActionResult Create(Blok form) { if (form.Id != null && form.SiteId != null && form.BlokAdi != null) { db.Blok.Add(form); db.SaveChanges(); } RedirectToAction("/Admin/Site"); return(View()); }
private void pretraziBlok(Blok b, WrapPanel w, string s) { w.Children.Clear(); foreach (Zatvorenik z in zatvorenici) { if (z.Blok == b && (z.Ime.Contains(s) || z.Prezime.Contains(s))) { w.Children.Add(new OsobaKontrola(z)); } } }
private void ubaciBlok(Blok b, List <String> s) { s.Add("Zatvorenici u odjelu naziva: " + b.ToString() + Environment.NewLine); foreach (Zatvorenik z in zatvorenici) { if (z.Blok == b) { s.Add(z.dajPodatkeOZatvoreniku()); } } s.Add("********************************************************************************"); }
public void CreateWorld() { for (int x = 0; x < 4; x++) { for (int y = 0; y < 6; y++) { if (tileArray[x, y] == 1) { blokArray[x, y] = new Blok(texture, new Vector2(y * 128, x * 64)); } } } }
public async Task <ActionResult <Blok> > PostBlok(Blok blok) { BlokValid valid = new BlokValid(_context, blok); if (valid.Valid() == false) { return(BadRequest("This blok is already exist")); } _context.Blok.Add(blok); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBlok", new { id = blok.Id }, blok)); }
public string dajPodatkeOZatvoreniku() { return("Ime: " + Ime + Environment.NewLine + "Prezime: " + Prezime + Environment.NewLine + "Adresa: " + Adresa + Environment.NewLine + "Datum rođenja: " + DatumRodjenja + Environment.NewLine + "ID: " + Id + Environment.NewLine + "Spol: " + Spol.ToString() + Environment.NewLine + "Blok: " + Blok.ToString() + Environment.NewLine + "Broj čelije: " + BrojCelije.ToString() + Environment.NewLine + "Datum dolaska: " + DatumDolaska.ToShortDateString() + Environment.NewLine + "Datum puštanja na slobodu: " + DatumOdlaska.ToShortDateString() + Environment.NewLine + "Aktivnosti i napomene: " + Environment.NewLine + " -" + Napomene); }
public static int AddBlok(DateTime eindtijd, DateTime starttijd, int evenementid, int nummer) { using (TimechasersEntities te = new TimechasersEntities()) { Blok blok = te.Blok.Add(new Blok() { EindTijd = eindtijd, StartTijd = starttijd, EvenementID = evenementid, Nummer = nummer, Complete = false }); te.SaveChanges(); return(blok.Id); } }
public int GenerisiZahtjev(int brojBloka, int brojVektora, int brojElementa) { int ret = -1; IIdentity id = Thread.CurrentPrincipal.Identity; IPrincipal principal = Thread.CurrentPrincipal; WindowsIdentity wId = id as WindowsIdentity; if (principal.IsInRole("Trazi")) { Audit.AuthorizationSuccess(Formatter.VratiIme((principal as CustomPrincipal).Identity.Name), OperationContext.Current.IncomingMessageHeaders.Action); Console.WriteLine("\n-------------------------------------------"); Console.WriteLine("Klijent je generisao brojeve: " + brojBloka.ToString() + "," + brojVektora.ToString() + "," + brojElementa.ToString()); Dictionary <int, Blok> blok = InterniModel.blokovi; Blok b = blok[brojBloka]; Dictionary <int, Vektor> vektor = b.GetVektori; Vektor v = vektor[brojVektora]; Dictionary <int, Alarm> alarm = v.GetElementi; Alarm a = alarm[brojElementa]; if (a == null) { Console.WriteLine("Na zadatoj poziciji nema alarma."); Console.WriteLine("-------------------------------------------\n"); ret = 0; } else { Console.WriteLine("\n-------------------------------------------"); Console.WriteLine("PRONADJENI ALARM: \nPoruka: {0} \nVreme generisanja : {1} \nRizik: {2}", a.PorukaOAlarmu, a.VrijemeGenerisanjaAlarma, a.Rizik); Console.WriteLine("-------------------------------------------\n"); new BazaPodataka().Upisi(a, Formatter.VratiIme((principal as CustomPrincipal).Identity.Name)); ret = 1; } } else { Audit.AuthorizationFailed(Formatter.VratiIme((principal as CustomPrincipal).Identity.Name), OperationContext.Current.IncomingMessageHeaders.Action, "Authorization failed."); MyException ex = new MyException(); ex.Message = "Nemate pravo 'Trazi'!"; throw new FaultException <MyException>(ex); } return(ret); }
/// <summary> /// Načte blok ze souboru do paměti, kde int i je pozice bloku v souboru. /// </summary> /// <param name="indexBloku">Pozice bloku v souboru.</param> private void CtiBlok(int indexBloku) { NastavPozici(indexBloku); // kdyz je ridici blok if (indexBloku == 0) { byte[] prozatimnibufferRB = new byte[velikostRB]; fs.Read(prozatimnibufferRB); rb = (RidiciBlok)ByteArrayToObject(prozatimnibufferRB); } else { byte[] prozatimniBufferBlok = new byte[rb.VelikostZaznamu * rb.BlokovyFaktor]; fs.Read(prozatimniBufferBlok); b = (Blok)ByteArrayToObject(prozatimniBufferBlok); seznamProchazenychBloku.Add(indexBloku); } rb.AktualniBlok = indexBloku; rb.AktualniZaznam = 0; }
// Returns a random blok from the array public GameObject GetRandomActiveBlock() { List <GameObject> active_blocks = new List <GameObject>(); foreach (var b in bloky) { Blok blok = b.GetComponent <Blok>(); if (b.activeSelf && !blok.Dead()) { active_blocks.Add(b); } } if (active_blocks.Count < 1) { return(null); } return(active_blocks[Random.Range(0, active_blocks.Count)]); }
public Base Katlar(Blok blok) { katListesi = new List <Kat>(); Base b = new Base(); db.prepareCommand("SELECT * FROM tbl_Kat WHERE intBlokId=@intBlokId", CommandType.Text, new SqlParameter[] { new SqlParameter() { ParameterName = "@intBlokId", Value = blok.blokId, SqlDbType = SqlDbType.Int } }); SqlDataReader dr = db.runCommandReturnReader(); while (dr.Read()) { katListesi.Add(new Kat { katid = Convert.ToInt32(dr["intKatId"]), blokId = Convert.ToInt32(dr["intBlokId"]), katAdi = dr["strAd"].ToString(), durum = Convert.ToBoolean(dr["blDurum"]), }); } if (katListesi.Count > 0) { b.result = true; b.data = katListesi; } else { b.result = false; b.errorId = 101; b.errorMsg = "Internal Server Error"; } return(b); }
/// <summary> /// Vytvori nový objekt bloku v paměti. /// </summary> private void InicializujBlok() { b = new Blok(rb.BlokovyFaktor); }
// Start is called before the first frame update void Start() { int KleurRechterkant, KleurLinkerkant, KleurOnderkant, KleurBovenkant, KleurAchterkant, KleurVoorkant; for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { for (int z = 0; z < 3; z++) { if (x == 0) { KleurRechterkant = 5; } else { KleurRechterkant = 0; } if (x == 2) { KleurLinkerkant = 4; } else { KleurLinkerkant = 0; } if (y == 0) { KleurOnderkant = 1; } else { KleurOnderkant = 0; } if (y == 2) { KleurBovenkant = 6; } else { KleurBovenkant = 0; } if (z == 0) { KleurAchterkant = 3; } else { KleurAchterkant = 0; } if (z == 2) { KleurVoorkant = 2; } else { KleurVoorkant = 0; } blokarray[x, y, z] = new Blok(x, y, z, KleurVoorkant, KleurAchterkant, KleurBovenkant, KleurOnderkant, KleurLinkerkant, KleurRechterkant); } } } Teken(); }
public static int dajIdBloka(Blok b) { return(Convert.ToInt32(b)); }
private void poszukuj() { while (true) { if (doposortowania.Count > 0) { zajety = true; ArrayList dane = (ArrayList)doposortowania[doposortowania.Count - 1]; int dlDanych = dane.Count; int dlPotokuMax = ((string)dane[0]).Length; int dlPotokuServera = int.Parse(textBox5.Text); int dlPotokuServera2 = (int)Math.Ceiling(Math.Log10(Double.Parse(textBox4.Text)+1)); int dl__ = (dlPotokuServera > dlPotokuServera2 ? dlPotokuServera : dlPotokuServera2); int dlPotoku = (dlPotokuMax < dl__ ? dlPotokuMax : dl__); int liczbaBlokow = (int)Math.Pow(10, dlPotoku); bloki = new Blok[liczbaBlokow]; for (int i = 0; i < liczbaBlokow; i++) { bloki[i] = new Blok(); } for (int i = 0; i < dlDanych; i++) { string dana = (string)dane[i]; int pol = int.Parse(dana.Substring(0, dlPotoku)); bloki[pol].elementy.Add(dana); } /// miejsce na funkcje przydzielania pracy /// bool koniec = false; ArrayList uz; do { int licz = 0; for (int i = 0; i<bloki.Length;i++ ) { if (bloki[i].koniec) licz++; else if (bloki[i].kto == "" || !mm.aktywny(bloki[i].kto)){ uz = mm.NieZajeciUrzytk(); if (uz.Count > 0) { mm.nadajWiadomosc("sortuj", "Server", (string)uz[0], getString(bloki[i].elementy), 0, i); bloki[i].kto = (string)uz[0]; } } } if (licz == bloki.Length) koniec = true; }while(!koniec); string dane2 = ""; for (int i = 0; i < bloki.Length; i++) { if (bloki[i] != null) for (int j = 0; j < bloki[i].elementy.Count; j++) { dane2 += (string)bloki[i].elementy[j] + " "; } } //wyslac i usunac mm.nadajWiadomosc("posortowano", "Server", (string)dokogo[doposortowania.Count - 1], dane2, 0, 0); dokogo.RemoveAt(doposortowania.Count - 1); doposortowania.RemoveAt(doposortowania.Count - 1); } } }
public Odjel(Blok blok) { Blok = blok; }
public UpravnikOdjela(string ime, string prezime, string adresa, DateTime datumRodjenja, int id, Spol spol, string napomene, DateTime datumZaposlenja, List <Prisustvo> prisustva, Blok blok, Image slika) : base(ime, prezime, adresa, datumRodjenja, id, spol, napomene, datumZaposlenja, prisustva, slika) { Blok = blok; }
private void InitialzeGameObjects() { hero = new Hero(texture, new KeyBoardReader()); blok = new Blok(blokTexture, new Vector2(300, 50)); }
public BlokValid(Lab2Context context, Blok blok) { _context = context; this.blok = blok; }