Example #1
0
 partial void UpdatetblStranica(tblStranica instance);
Example #2
0
 partial void DeletetblStranica(tblStranica instance);
Example #3
0
 partial void InserttblStranica(tblStranica instance);
Example #4
0
		private void detach_tblStranicas(tblStranica entity)
		{
			this.SendPropertyChanging();
			entity.tblSemafor = null;
		}
        protected void LinkButtonDodajStranicu_Click(object sender, EventArgs e)
        {
            //upisi stranicu semafora
            SemaforiDataContext db = new SemaforiDataContext();

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

            stranica.semaforID = Convert.ToInt32(labelSemaforID.Text);
            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();

            //po defaultu nam graID i upitID ne postoje, pa nas onda strga u null vrijednosti kod prikaza !!!

            //upisi celije
            for (int i = 0; i < 3; ++i) {
                tblCelija celija = new tblCelija();
                celija.redakID = redak.id;
                celija.upitID = 9999;
                celija.grafID = 9999;
                db.tblCelijas.InsertOnSubmit(celija);
                db.SubmitChanges();
            }

            prikaziSemafor(stranica.semaforID);
            prikaziStranicu(stranica.Id);
            oznaciTabStranice(stranica.Id);
        }
        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);
        }
Example #7
0
        protected void buttonSnimiStranica_Click(object sender, EventArgs e)
        {
            switch (lblEditInsertDelete.Text) {

                case "insert":
                    // insert nove stranice
                    tblStranica stranicaInsert = new tblStranica {
                        naziv = textBoxNaslovStranice.Text,
                        refreshPeriod = Convert.ToInt32(textBoxRefreshStranice.Text),
                        semaforID = Convert.ToInt32(lblIdSemafora.Text),
                        brojRedova = 2
                    };

                    db.tblStranicas.InsertOnSubmit(stranicaInsert);

                    // submitaj u bazu
                    try {
                        db.SubmitChanges();
                    }
                    catch (Exception e1) {
                        Console.WriteLine(e1);

                        //db.SubmitChanges();
                    }
                    break;
                case "edit":
                    // update stranice
                    // pokupi podatke o stranici
                    var stranicaEdit = (from s in db.tblStranicas where s.Id == Convert.ToInt32(lblIdStranice.Text) select s).Single();

                    stranicaEdit.naziv = textBoxNaslovStranice.Text;
                    stranicaEdit.refreshPeriod = Convert.ToInt32(textBoxRefreshStranice.Text);

                    try {
                        db.SubmitChanges();
                    }
                    catch (Exception e1) {
                        Console.WriteLine(e1);

                        //db.SubmitChanges();
                    }

                    break;
                case "delete":
                    break;

            }

            // ugasi prozore
            ViewState["snimanje"] = "da";
            //Page_Load(this, null);
            modal.Visible = false;
            editorStranice.Visible = false;

            Response.Redirect(HttpContext.Current.Request.Path);
        }