public async Task <IActionResult> Edit(string id, [Bind("Idgrupy,Nazwagrupy")] Grupa grupa) { if (id != grupa.Idgrupy) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(grupa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GrupaExists(grupa.Idgrupy)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(grupa)); }
public virtual MesecnaClanarina getVazecaClanarinaForGrupa(Grupa g) { try { IQuery q = Session.CreateQuery(@"from MesecnaClanarina mc left join fetch mc.Grupa g where g = :grupa order by mc.VaziOd desc"); q.SetEntity("grupa", g); IList <MesecnaClanarina> result = q.List <MesecnaClanarina>(); if (result.Count > 0) { return(result[0]); } else { return(null); } } catch (HibernateException ex) { string message = String.Format( "{0} \n\n{1}", Strings.DatabaseAccessExceptionMessage, ex.Message); throw new InfrastructureException(message, ex); } }
private void AddGroupCommand(object parameter) { AddGroup frm = new AddGroup(); Nullable <bool> dialogResult = frm.ShowDialog(); GroupName = Grupa.GetGrupas(); }
private void HandleFilter() { Donatii.Clear(); IEnumerable <Donatie> donations; var paramEtapa = Etapa; int?paramGrupa; if (Etapa.Equals("Toate")) { paramEtapa = null; } if (Grupa.Equals("Toate")) { paramGrupa = null; } else { paramGrupa = AppService.Instance.GrupaDeSangeService.GetAll().First(d => d.Nume == Grupa).Id; } donations = AppService.Instance.DonatieService.Filter(paramEtapa, paramGrupa); foreach (var d in donations) { Donatii.Add(new DonatieViewModel(d)); } }
public async Task Join(Poruka por) { EF.Baza DB = new EF.Baza(); var kor = DB.Users.Where(u => u == por.Posiljaoc).First(); var gru = DB.Grupas.Where(g => g.Naziv == por.Sadrzaj).FirstOrDefault(); if (gru == null) { gru = new Grupa(por.Sadrzaj); DB.Grupas.Add(gru); DB.UG.Add(new UserGrupa(kor, gru)); } else { DB.UG.Add(new UserGrupa(kor, gru)); } try { await DB.SaveChangesAsync(); await Groups.AddToGroupAsync(Context.ConnectionId, por.Sadrzaj); await Clients.Group(por.Sadrzaj).SendAsync("PorukaKaKlijentu", new Poruka($"Korisnik {por.Posiljaoc.Username} se prikljucuje grupi :).", null, por.Sadrzaj)); await Clients.Group(por.Sadrzaj).SendAsync("OsveziGrupu", gru.Naziv, DB.UG.Where(ug => ug.Gru.Naziv == gru.Naziv).Count()); } catch { } }
private void drawGrupaHeader(Graphics g) { Pen pen = tabela.HeaderBorderPen; Brush brush = tabela.HeaderGrupaTextBrush; Font f = tabela.HeaderGrupaFont; Point autoScrollPosition = panelTabela.AutoScrollPosition; RectangleF rect = new RectangleF( new PointF(xMargin, tezineHeaderHeightPxl), new SizeF(tabela.getScaledTabelaSize(selectedSprava(), selectedGrupa(), zoom / 100).Width, grupaHeaderHeightPxl)); rect.Offset(autoScrollPosition.X, 0); g.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); string text = "GRUPA ELEMENATA " + selectedGrupa() + ": "; Grupa grupa = findGrupa(selectedSprava(), selectedGrupa()); if (grupa != null) { string naziv = "" + grupa.Naziv; if (naziv != "") { naziv += " - "; } naziv += grupa.EngNaziv; text += naziv; } StringFormat fmt = new StringFormat(); fmt.LineAlignment = StringAlignment.Center; g.DrawString(text, f, brush, rect, fmt); }
static public Grupa GenereazaGrupaRandom() { Grupa grupa = new Grupa(); grupa.Nume = random.Next(100, 500).ToString(); grupa.An = (int)grupa.Nume.ToCharArray()[0]; return(grupa); }
protected override void saveOriginalData(DomainObject entity) { Grupa g = (Grupa)entity; oldSifra = g.Sifra; oldNaziv = g.Naziv; oldImaGodisnjuClanarinu = g.ImaGodisnjuClanarinu; }
public ActionResult DeleteConfirmed(int id) { Grupa grupa = db.Grupy.Find(id); db.Grupy.Remove(grupa); db.SaveChanges(); return(RedirectToAction("Index")); }
public Zajecia(string dzien_tygodnia, string godzina, string sala, string nazwa_zajec, Grupa grupa) { this.dzien_tygodnia = dzien_tygodnia; this.godzina = godzina; this.sala = sala; this.nazwa_zajec = nazwa_zajec; this.grupa = grupa; }
protected override void initUI() { base.initUI(); this.Text = "Promeni uplatu"; cmbGrupa.DropDownStyle = ComboBoxStyle.DropDownList; setGrupe(grupe); SelectedGrupa = null; }
public async Task <IActionResult> RegisterFromFridge(RegisterViewModel model) { if (ModelState.IsValid) { var user = new Uzytkownik { UserName = model.Email, Email = model.Email }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { var lodowka = new Lodowka { Pojemnosc = 15, DataAktualizacji = DateTime.Now }; var grupa = new Grupa { Nazwa = user.Email, Lodowka = lodowka, Uzytkownicy = new List <Uzytkownik> { user } }; var uzytGrupa = new UzytkownikGrupa { Grupa = grupa, Uzytkownik = user }; _context.Grupy.Add(grupa); _context.UzytkownicyGrupy.Add(uzytGrupa); _context.SaveChanges(); _logger.LogInformation("User created a new account with password."); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme); await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl); await _signInManager.SignInAsync(user, isPersistent : false); _logger.LogInformation("User created a new account with password."); return(Ok()); } else { return(NotFound()); } } // If we got this far, something failed, redisplay form return(BadRequest()); }
private void radioButtonMojeGrupe_CheckedChanged(object sender, EventArgs e) { btnPridruziSeNapusti.Text = "Napusti grupu"; panelMojeGrupeKomande.Visible = true; grupa = Grupa.Moje; String jmbg = pomocna.GetJmbgKorisnika(lblNazivKorisnika.Text, konekcija); radSaGrupama.prikaziMojeGrupe(dataGridViewGrupeUser, jmbg, konekcija); }
private List <object> loadCenovnikForGrupa(Grupa g) { MesecnaClanarinaDAO mesecnaClanarinaDAO = DAOFactoryFactory.DAOFactory.GetMesecnaClanarinaDAO(); return(new List <MesecnaClanarina>(mesecnaClanarinaDAO.findForGrupa(g)).ConvertAll <object>( delegate(MesecnaClanarina mc) { return mc; })); }
protected override void updateUIFromEntity(DomainObject entity) { Grupa g = (Grupa)entity; txtSifra.Text = g.Sifra.Value; txtNaziv.Text = g.Naziv; chbImaGodisnjuClanarinu.Checked = g.ImaGodisnjuClanarinu; SelectedKategorija = g.Kategorija; SelectedFinCelina = g.FinansijskaCelina; }
protected override void updateUIFromEntity(DomainObject entity) { UplataClanarine uplata = (UplataClanarine)entity; SelectedGrupa = uplata.Grupa; lblSummary.Text = uplata.PrezimeImeBrojDatumRodj + "\n" + uplata.SifraGrupeCrtaNazivGrupe + "\n" + uplata.VaziOd.Value.ToString("dd.MM.yyyy") + "\n" + uplata.IznosDin; }
protected override void updateEntityFromUI(DomainObject entity) { Grupa g = (Grupa)entity; g.Sifra = SifraGrupe.Parse(txtSifra.Text.Trim()); g.Naziv = txtNaziv.Text.Trim(); g.Kategorija = SelectedKategorija; g.FinansijskaCelina = SelectedFinCelina; g.ImaGodisnjuClanarinu = chbImaGodisnjuClanarinu.Checked; }
public ActionResult Edit([Bind(Include = "ID,NumerGrupy")] Grupa grupa) { if (ModelState.IsValid) { db.Entry(grupa).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(grupa)); }
public void EdycjaGrupy() { PanelLogowania a = new PanelLogowania(); Uczen uczen = new Uczen("Jakub2015", "qwerty", "Stanislaw", "Marek", 1); Prowadzacy prowadzacy = new Prowadzacy("Squirtle123", "pikachu", "Grzegorz", "Adamiakowa", 1); Grupa grupa = new Grupa("angielski", "podstawowy", "podstawowy", prowadzacy, new List <Uczen>()); a.admin.edytujGrupe(grupa, null, null, "innanazwa", null); Assert.AreEqual(grupa.nazwa, "innanazwa"); }
public ActionResult Create([Bind(Include = "ID,NumerGrupy")] Grupa grupa) { if (ModelState.IsValid) { db.Grupy.Add(grupa); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(grupa)); }
private void button2_Click(object sender, EventArgs e) { ISession s = DataLayer.GetSession(); Grupa g = s.Load <Grupa>(grupa.GrupaID); g.Naziv = textBox2.Text; s.Update(g); s.Flush(); s.Close(); }
private void btnPrikaziGrupe_Click(object sender, EventArgs e) { grupa = Grupa.Sve; panelPrikazKolekcijaUser.Visible = false; panelGrupeUser.Visible = true; String jmbg = pomocna.GetJmbgKorisnika(lblNazivKorisnika.Text, konekcija); radSaGrupama.prikaziSveGrupe(dataGridViewGrupeUser, jmbg, konekcija); radioButtonMojeGrupe.Checked = false; radioButtonSveGrupe.Checked = true; }
public async Task <IActionResult> Create([Bind("Idgrupy,Nazwagrupy")] Grupa grupa) { if (ModelState.IsValid) { _context.Add(grupa); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(grupa)); }
public GrupaView(Grupa g) { this.Id = g.Id; this.Naziv = g.Naziv; //this.Projekti = new List<ProjekatView>(); //foreach(Projekat Projekat in g.Projekti) //{ // this.Projekti.Add(new ProjekatView(Projekat)); //} }
public void Izvrsi(GrupaDto request) { _validator.ValidateAndThrow(request); var grupa = new Grupa { Naziv = request.Naziv }; _context.Grupe.Add(grupa); _context.SaveChanges(); }
public RegistrationGroupVM(Guid studentId) { _studentId = studentId; ExecuteAddKierunekCommand = new Commanding(AddKierunekCiagGroupCommand, CanAddKierunekCiagGroupCommand); ExecuteAddKierunek = new Commanding(AddKierunekCommand, CanAddKierunekCommand); ExecuteAddCiag = new Commanding(AddCiagCommand, CanAddCiagCommand); ExecuteAddGroup = new Commanding(AddGroupCommand, CanAddGroupCommand); SemesterName = Semestr.GetSemestersNames(); KierunekName = Kierunek.GetKieruneks(); CiagName = Ciag.GetCiags(); GroupName = Grupa.GetGrupas(); }
public void DodawanieDoGrupy() { PanelLogowania a = new PanelLogowania(); Uczen uczen = new Uczen("Jakub2015", "qwerty", "Stanislaw", "Marek", 1); Prowadzacy prowadzacy = new Prowadzacy("Squirtle123", "pikachu", "Grzegorz", "Adamiakowa", 1); Grupa grupa = new Grupa("angielski", "podstawowy", "podstawowy", prowadzacy, new List <Uczen>()); a.admin.dodajDoGrupy(uczen, grupa); Assert.AreEqual(uczen, grupa.listaUczniow[0]); Assert.AreEqual(grupa, uczen.grupa[0]); }
private void txtSifraGrupe_TextChanged(object sender, System.EventArgs e) { SifraGrupe sifra; if (SifraGrupe.TryParse(txtSifraGrupe.Text.Trim(), out sifra)) { SelectedGrupa = findGrupa(sifra); } else { SelectedGrupa = null; } }
private void button1_Click(object sender, EventArgs e) { ISession s = DataLayer.GetSession(); Grupa g = new Grupa(); g.Naziv = textBox1.Text; g.Projekti.Add((Projekat)comboBox1.SelectedItem); s.SaveOrUpdate(g); s.Flush(); s.Close(); Close(); }
/// <summary> /// SELECT Job AS Praca, COUNT(1) LiczbaPracownikow FROM Emps GROUP BY Job; /// </summary> private void Przyklad7Button_Click(object sender, EventArgs e) { var res = (from emp in Emps group emp by emp.Job into Grupa select new { Praca = Grupa.Key, LiczbaPracownikow = Grupa.Count() }); //ResultsDataGridView.DataSource = result; }
/// <summary> /// Calculates motion between two images /// </summary> /// <param name="FirstImage">Firs image</param> /// <param name="SecondImage">Second image</param> /// <param name="Sensitivity">Minimum color difference</param> /// <param name="Preciseness">Pixel size</param> /// <returns>Motion detected</returns> public bool DetectMotion(Bitmap FirstImage, Bitmap SecondImage, int Sensitivity, int Preciseness, bool Pixelize) { if (FirstImage.Size != SecondImage.Size) throw new Exception("Image sizes must be the same."); int l = Sensitivity; try { Bitmap original = (Bitmap)((Bitmap)SecondImage).GetThumbnailImage(SecondImage.Width, SecondImage.Height, null, new IntPtr()); FirstImage = ImageManipulation.ToBlackAndWhite(FirstImage); SecondImage = ImageManipulation.ToBlackAndWhite(SecondImage); int b = Preciseness; if (Pixelize) { ImageManipulation.Pixelate(FirstImage, b); ImageManipulation.Pixelate(SecondImage, b); } byte[] rgb1 = ImageManipulation.GetBytes(FirstImage); byte[] rgb2 = ImageManipulation.GetBytes(SecondImage); Graphics grp = Graphics.FromImage(original); Objekti.Clear(); Grupe.Clear(); //Copy Start for (int y = 0; y < FirstImage.Height - 4; y += b) for (int x = 0; x < FirstImage.Width - 4; x += b) { byte barva1 = GetColor(x, y, rgb1, FirstImage.Width); byte barva2 = GetColor(x, y, rgb2, SecondImage.Width); int raz = Math.Abs(barva1 - barva2); if (raz > l) { Objekt obj = new Objekt(); obj.Rect = new Rectangle(x - b, y - b, b + b, b + b); obj.Jakost = raz; Objekti.Add(obj); } } for (int i = 0; i < Objekti.Count; i++) { if (Objekti[i].Group == null) { Grupa grupa = new Grupa(); Objekt o1 = Objekti[i]; grupa.Objekti.Add(o1); o1.Group = grupa; Ujemanje(o1); Grupe.Add(grupa); } } Najdeno.Clear(); foreach (Grupa grupa in Grupe) { int miX = grupa.Objekti[0].Rect.X; int miY = grupa.Objekti[0].Rect.Y; int maX = grupa.Objekti[0].Rect.X; int maY = grupa.Objekti[0].Rect.Y; foreach (Objekt o in grupa.Objekti) { if (o.Rect.X < miX) miX = o.Rect.X; if (o.Rect.X + o.Rect.Width > maX) maX = o.Rect.X + o.Rect.Width; if (o.Rect.Y < miY) miY = o.Rect.Y; if (o.Rect.Y + o.Rect.Height > maY) maY = o.Rect.Y + o.Rect.Height; } Najdeno.Add(new Rectangle(miX, miY, maX - miX, maY - miY)); } for (int i = 0; i < Grupe.Count; i++) { foreach (Objekt obj in Grupe[i].Objekti) { if (i == 0) grp.DrawRectangle(Pens.Blue, obj.Rect); //grp.DrawRectangle(new Pen(Color.FromArgb(obj.Jakost, 0, 0)), obj.Rect); else if (i == 1) grp.DrawRectangle(Pens.Red, obj.Rect); else if (i == 2) grp.DrawRectangle(Pens.Green, obj.Rect); else if (i == 3) grp.DrawRectangle(Pens.Pink, obj.Rect); else if (i == 4) grp.DrawRectangle(Pens.Blue, obj.Rect); else if (i == 5) grp.DrawRectangle(Pens.Orange, obj.Rect); else if (i == 6) grp.DrawRectangle(Pens.Orchid, obj.Rect); else if (i == 7) grp.DrawRectangle(Pens.Snow, obj.Rect); else if (i == 8) grp.DrawRectangle(Pens.LightYellow, obj.Rect); else if (i == 9) grp.DrawRectangle(Pens.LightYellow, obj.Rect); else if (i == 10) grp.DrawRectangle(Pens.Gainsboro, obj.Rect); else if (i == 11) grp.DrawRectangle(Pens.Purple, obj.Rect); else if (i == 12) grp.DrawRectangle(Pens.HotPink, obj.Rect); else grp.DrawRectangle(Pens.White, obj.Rect); } } //for (int i = 0; i < Najdeno.Count; i++) // grp.DrawRectangle(Pens.Yellow, Najdeno[i]); //double Sens = 10; for (int i = 0; i < Najdeno.Count; i++) { grp.DrawRectangle(Pens.Yellow, Najdeno[i]); } MotionRectangles.Clear(); MotionRectangles.AddRange(Najdeno); //Copy End grp.Save(); ProcessedImage = original; if (MotionRectangles.Count > 0) return true; else return false; } catch { throw new Exception("There was an error while trying to calculate motion detection."); } }