示例#1
0
 partial void DeletetblSemafor(tblSemafor instance);
示例#2
0
 partial void InserttblSemafor(tblSemafor instance);
示例#3
0
 partial void UpdatetblSemafor(tblSemafor instance);
        protected void DodajSemafor_Click(object sender, EventArgs e)
        {
            /*
            dodajemo semafor
            Svaki semafor odmah dobije jednu stranicu i jedan red
            dignemo prozor sa nazivom semafora, upišemo ga i prikažemo sve na desnoj strani
            */

            SemaforiDataContext db = new SemaforiDataContext();
            string privremeniNaslovSemafora = "Novi Semafor";

            tblSemafor semafor = new tblSemafor();
            tblStranica stranica = new tblStranica();
            tblRedak redak = new tblRedak();

            // upisi semafor
            semafor.naziv = privremeniNaslovSemafora;
            db.tblSemafors.InsertOnSubmit(semafor);
            db.SubmitChanges();

            //upisi stranicu semafora
            stranica.semaforID = semafor.Id;
            stranica.naziv = "Privremeni naziv stranice";
            stranica.refreshPeriod = 10000;
            stranica.brojRedova = 1;
            db.tblStranicas.InsertOnSubmit(stranica);
            db.SubmitChanges();

            //upisi redove
            redak.stranicaID = stranica.Id;
            db.tblRedaks.InsertOnSubmit(redak);
            db.SubmitChanges();

            //dodaj retku 3 celije
            for (int i = 0; i < 3; ++i) {
                tblCelija celija = new tblCelija();
                celija.redakID = redak.id;
                celija.grafID = 9999;              //samo privremeno da ne bude problema kasnije !!!
                celija.upitID = 9999;
                db.tblCelijas.InsertOnSubmit(celija);
                db.SubmitChanges();
            }

            prikaziSemafor(semafor.Id);
        }