public override void updateVezaColumn() { disableAutomaticGridFooterUpdate(); int vezaCol = gridElementi.Columns["VezaSaPrethodnim"].Index; List <int> veze = Vezba.getVeze(); int row = 0; for (int i = 0; i < veze.Count / 2; i++) { int firstElement = veze[2 * i]; int lastElement = veze[2 * i + 1]; while (row < firstElement) { gridElementi.Rows[row++].Cells[vezaCol] = new DataGridViewTextBoxCell(); } for (int j = firstElement; j <= lastElement; j++) { gridElementi.Rows[j].Cells[vezaCol] = new VMergedCell( firstElement, lastElement, StringAlignment.Center, StringAlignment.Center); } gridElementi.Rows[firstElement].Cells[vezaCol].Value = Vezba.Elementi[lastElement].VezaSaPrethodnim; row = lastElement + 1; } while (row < Vezba.Elementi.Count) { gridElementi.Rows[row++].Cells[vezaCol] = new DataGridViewTextBoxCell(); } enableAutomaticGridFooterUpdate(); }
private void btnOtvori_Click(object sender, EventArgs e) { if (gridView.Rows.Count > 0) { Vezba vezba = (Vezba)entities[gridView.CurrentRow.Index]; vezbaId = vezba.Id; } }
public VezbaTabela(PointF tableHeaderTopLeft, float tableWidth, Graphics g, int numEmptyRows, Vezba vezba) : this(tableHeaderTopLeft, tableWidth, RED_BROJ_WIDTH, NAZIV_ELEMENATA_WIDTH, TEZINA_WIDTH, GRUPA_BROJ_WIDTH, VREDNOST_WIDTH, VEZA_SA_PRETHODNIM_WIDTH, ZAHTEV_WIDTH, ODBITAK_WIDTH, PENALIZACIJA_WIDTH, g, numEmptyRows, vezba) { }
private void updateIzvedbaRow() { DataGridViewRow rowIzvedba = gridElementi.Rows[Vezba.Elementi.Count + numEmptyRows + 2]; rowIzvedba.Cells["Vrednost"].Value = Vezba.getIzvedba(); rowIzvedba.Cells["Odbitak"].Value = Vezba.getOcena(); }
public void initialize() { try { using (ISession session = NHibernateHelper.OpenSession()) using (session.BeginTransaction()) { CurrentSessionContext.Bind(session); if (vezbaId == null) { OsnovniPodaciVezbeForm f = new OsnovniPodaciVezbeForm(); if (f.ShowDialog() == DialogResult.OK) { vezba = new Vezba(); vezba.Gimnasticar = f.Gimnasticar; vezba.Sprava = f.Sprava; vezba.Pravilo = f.Pravilo; vezba.Naziv = f.Naziv; view.Vezba = vezba; view.updateUI(); existsInDatabase = false; modified = false; view.setCaption(getCaption()); view.Initialized = true; } else { view.Initialized = false; } } else { vezba = DAOFactoryFactory.DAOFactory.GetVezbaDAO().FindById(vezbaId.Value); vezba.sortirajElementeByRedBroj(); saveOrigData(vezba); view.Vezba = vezba; view.updateUI(); existsInDatabase = true; modified = false; view.setCaption(getCaption()); if (vezba.Elementi.Count > 0) { view.selectElementCell(1, 0); } view.Initialized = true; // TODO: Treba hvatati database izuzetke i postaviti initalized na false } } } finally { CurrentSessionContext.Unbind(NHibernateHelper.SessionFactory); } }
private void updatePocetnaOcenaRow() { DataGridViewRow rowPocetnaOcena = gridElementi.Rows[Vezba.Elementi.Count + numEmptyRows + 1]; rowPocetnaOcena.Cells["Vrednost"].Value = Vezba.getPocetnaOcena(); rowPocetnaOcena.Cells["Odbitak"].Value = Vezba.getOdbitakUkupno() + Vezba.getPenalizacijaUkupno(); }
public static Vezba Procitaj(ObjectId id) { MongoCollection <Vezba> vezbeCollection = Connection <Vezba> .getCollection("vezbe"); Vezba vezba = (from v in vezbeCollection.AsQueryable <Vezba>() where v.Id == id select v).FirstOrDefault(); return(vezba); }
private void updateUkupnoRow() { DataGridViewRow rowUkupno = gridElementi.Rows[Vezba.Elementi.Count + numEmptyRows]; rowUkupno.Cells["Vrednost"].Value = Vezba.getVrednostUkupno(); rowUkupno.Cells["VezaSaPrethodnim"].Value = Vezba.getVezaUkupno(); rowUkupno.Cells["Zahtev"].Value = Vezba.getZahtevUkupno(); rowUkupno.Cells["Odbitak"].Value = Vezba.getOdbitakUkupno(); rowUkupno.Cells["Penalizacija"].Value = Vezba.getPenalizacijaUkupno(); }
public static void Dodaj(Vezba Item) { try { var collection = Connection <Vezba> .getCollection("vezbe"); collection.Insert(Item); } catch (Exception e) { Console.WriteLine(e); } }
// TODO: Izgleda da ne radi otvaranje menija desnim klikom misem (dodavanje elementa) kada je vezba prazna private void checkBusinessRulesOnAdd(DomainObject entity) { Vezba v = (Vezba)entity; Notification notification = new Notification(); VezbaDAO vezbaDAO = DAOFactoryFactory.DAOFactory.GetVezbaDAO(); if (vezbaDAO.postojiVezba(v.Sprava, v.Naziv, v.Gimnasticar)) { notification.RegisterMessage("Naziv", "Vezba sa datim nazivom i za datu spravu vec postoji " + "za datog gimnasticara."); throw new BusinessException(notification); } }
public ActionResult DodajVezbu(HttpPostedFileBase file, string naziv, string tekst, string misicna_partija) { Vezba v = new Vezba() { Naziv = naziv, Tekst = tekst, Misicna_Partija = misicna_partija, Prosecna_Ocena = 9.0, Broj_Ocenjivanja = 0 }; if (file != null && file.ContentLength > 0) { v.Slika = file.FileName; string path = Path.Combine(Server.MapPath("~/Content/slikeVezbi/" + misicna_partija), Path.GetFileName(file.FileName)); file.SaveAs(path); } Vezbe.Dodaj(v); return(ListaVezbi(false, false, false, false, false, false, false, true)); }
private void checkBusinessRulesOnUpdate(DomainObject entity) { Vezba v = (Vezba)entity; Notification notification = new Notification(); VezbaDAO vezbaDAO = DAOFactoryFactory.DAOFactory.GetVezbaDAO(); bool spravaChanged = (v.Sprava != oldSprava) ? true : false; bool nazivChanged = (v.Naziv != oldNaziv) ? true : false; bool gimnasticarChanged = v.Gimnasticar == null && oldGimnasticar != null || v.Gimnasticar != null && oldGimnasticar == null || v.Gimnasticar != null && oldGimnasticar != null && v.Gimnasticar.Id != oldGimnasticar.Id; if (nazivChanged || spravaChanged || gimnasticarChanged) { if (vezbaDAO.postojiVezba(v.Sprava, v.Naziv, v.Gimnasticar)) { notification.RegisterMessage("Naziv", "Vezba sa datim nazivom i za datu spravu vec postoji " + "za datog gimnasticara."); throw new BusinessException(notification); } } }
public VezbaTabela(PointF tableHeaderTopLeft, float tableWidth, int redBrojWidth, int nazivElementaWidth, int tezinaWidth, int grupaBrojWidth, int vrednostWidth, int vezaSaPrethodnimWidth, int zahtevWidth, int odbitakWidth, int penalizacijaWidth, Graphics g, int numEmptyRows, Vezba vezba) { this.tableHeaderTopLeft = tableHeaderTopLeft; this.tableWidth = tableWidth; initXOffsets(tableWidth, redBrojWidth, nazivElementaWidth, tezinaWidth, grupaBrojWidth, vrednostWidth, vezaSaPrethodnimWidth, zahtevWidth, odbitakWidth, penalizacijaWidth); this.vezba = vezba; this.numEmptyRows = numEmptyRows; createFonts(); tableHeaderHeight = 2 * tableHeaderFont.GetHeight(g) * 1.2f; tableItemHeight = tableHeaderFont.GetHeight(g) * 1.4f; calculateElementRowHeights(g); if (vezba.Elementi.Count > 0) { int lastElementRow = vezba.Elementi.Count - 1; footerTop = getElementRowTop(lastElementRow) + getElementRowHeight(lastElementRow) + tableItemHeight * numEmptyRows; } else { footerTop = tableHeaderTopLeft.Y + tableHeaderHeight + tableItemHeight * numEmptyRows; } ukupnoRowHeight = ukupnoCaptionFont.GetHeight(g) * 1.2f; pocetnaOcenaRowHeight = pocetnaOcenaCaptionFont.GetHeight(g) * 1.2f; izvedbaRowHeight = footerFontBold.GetHeight(g) * 1.2f; }
private void saveOrigData(Vezba v) { oldSprava = v.Sprava; oldNaziv = v.Naziv; oldGimnasticar = v.Gimnasticar; }