Example #1
0
        public static void PosejProjekcije()
        {
            try
            {
                List <Film> listaFilmova = Film.Svi();
                List <Sala> listaSala    = Sala.Sve();


                List <Projekcija> lista = new List <Projekcija> ( )
                {
                    new Projekcija(listaFilmova[Metode.VratiNasumicniInt(0, listaFilmova.Count - 1)], listaSala[Metode.VratiNasumicniInt(0, listaSala.Count - 1)], DateTime.Now.ToString("f")),
                    new Projekcija(listaFilmova[Metode.VratiNasumicniInt(0, listaFilmova.Count - 1)], listaSala[Metode.VratiNasumicniInt(0, listaSala.Count - 1)], DateTime.Now.ToString("f")),
                    new Projekcija(listaFilmova[Metode.VratiNasumicniInt(0, listaFilmova.Count - 1)], listaSala[Metode.VratiNasumicniInt(0, listaSala.Count - 1)], DateTime.Now.ToString("f")),
                    new Projekcija(listaFilmova[Metode.VratiNasumicniInt(0, listaFilmova.Count - 1)], listaSala[Metode.VratiNasumicniInt(0, listaSala.Count - 1)], DateTime.Now.ToString("f")),
                    new Projekcija(listaFilmova[Metode.VratiNasumicniInt(0, listaFilmova.Count - 1)], listaSala[Metode.VratiNasumicniInt(0, listaSala.Count - 1)], DateTime.Now.ToString("f"))
                };

                Console.WriteLine("Provera da li datoteka vec postoji:");
                if (Serijalizacija.DaLiJePrazanFajl(Serijalizacija.PrDat))
                {
                    Console.WriteLine("Fajl ne postoji. Kreira se...");
                }
                else
                {
                    Console.WriteLine("Fajl postoji, prebrisace se...");
                }
                Console.WriteLine("Upisivanje u datoteku: \n");
                Serijalizacija.WriteListToBinaryFile <Projekcija>(Serijalizacija.PrDat, lista, false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["movienum"] != null)
        {
            Film tempFilm = Metode.dohvatiFilm(Convert.ToInt32(Request.QueryString["movienum"]));

            if (tempFilm != null)
            {
                Label tempMovieGalleryLabel = new Label();

                tempMovieGalleryLabel.ID = "MovieGalleryLabel" + tempFilm.idFilma;

                tempMovieGalleryLabel.Text = Metode.napraviIspisGalerijeFilma(tempFilm, Server.MapPath("~/Images/MovieGalleries/" + tempFilm.nazivDatoteke + "/"));

                MainPanel.Controls.Add(tempMovieGalleryLabel);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Nepostojeći film.');", true);
            }
        }
        else
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Film nije izabran.');", true);
        }
    }
        private void dodajSalu()
        {
            List <Sala> sveSalePodaci = Sala.Sve();
            string      naziv         = this.nazivPolje.Text.Trim();
            int         brojRedova    = ( int )this.redovaPolje.Value;
            int         brojSedista   = ( int )this.sedistaPolje.Value;


            if (Metode.ProveriDuzinu(naziv, 5, 30))
            {
                if (sveSalePodaci.Find(x => x.Naziv == naziv) != null)
                {
                    new Obavestenje("Sala sa tim nazivom vec postoji!").ShowModal(this);
                    return;
                    // TODO: uradi ovu proveru u svim dodavanjima!
                }

                Sala s = new Sala(naziv, brojRedova, brojSedista);
                s.Sacuvaj();
                new Obavestenje("Uspesno ste dodali salu!").ShowModal(this);

                //MessageBox.Show( this , "Uspesno ste dodali film!" , MessageBoxType.Warning );
            }
            else
            {
                new Obavestenje("Izgleda da niste popunili sva polja, ili je duzina neodgovarajuca.").ShowModal();
            }
            //MessageBox.Show( this , "Izgleda da niste popunili sva polja, ili je duzina neodgovarajuca." , MessageBoxType.Warning );
        }
        /// <summary>
        /// makes rest service call and return the result as J object
        /// </summary>
        /// <typeparam name="J">the data type to return</typeparam>
        /// <param name="serviceUri">The uri of the rest service to invoke</param>
        /// <param name="callMethode">call methed can be POST or GET</param>
        /// <param name="headerParam">parametre used to filte needed data, used only when you need a filter in the server side, used only when callMethode is POST</param>
        /// <returns>return data as type J</returns>
        public static async Task <J> Invoke <J>(string serviceUri, Metode callMethode, object headerParam = null)
        {
            try
            {
                using (var client = new HttpClient())
                {
                    var serializedJsonRequest    = JsonConvert.SerializeObject(headerParam);
                    HttpResponseMessage response = new HttpResponseMessage();
                    switch (callMethode)
                    {
                    case Metode.POST:
                        HttpContent content = new StringContent(serializedJsonRequest, Encoding.UTF8, "application/json");
                        response = await client.PostAsync(serviceUri, content);

                        break;

                    case Metode.GET:
                        response = await client.GetAsync(serviceUri);

                        break;
                    }

                    response.EnsureSuccessStatusCode();
                    string dataResult = response.Content.ReadAsStringAsync().Result;
                    J      jResponse  = JsonConvert.DeserializeObject <J>(dataResult);
                    return(jResponse);
                }
            }
            catch (Exception ex)
            {
                return(default(J));
            }
        }
Example #5
0
 public void RemoveMetode(Metode metode)
 {
     using (var context = new Entities())
     {
         context.Database.Connection.ConnectionString = context.Database.Connection.ConnectionString.Replace("ELLYNDA", this.ServerName);
         context.Metodes.Remove(metode);
         context.SaveChanges();
     }
 }
Example #6
0
 public void TestSetup()
 {
     cf             = new ClientFactory();
     server         = new Serverr(cf, null);
     konzola        = new Konzola();
     m              = new Metode(server, konzola);
     mytuplefactory = new MyTupleFactory();
     queueFactory   = new QueueFactory();
     pfs            = new Pomocne_funkcijeSubscribe(mytuplefactory, queueFactory);
 }
Example #7
0
 public void TestSetup()
 {
     cf             = new ClientFactory();
     server         = new Serverr(cf, null);
     konzola        = new Konzola();
     m              = new Metode(server, konzola);
     mytuplefactory = new MyTupleFactory();
     queueFactory   = new QueueFactory();
     pfc            = new Pomocne_funkcijeCreate(mytuplefactory, queueFactory);
     client         = new Clientt("Klijent");
 }
Example #8
0
 public void TearDown()
 {
     cf             = null;
     server         = null;
     konzola        = null;
     m              = null;
     mytuplefactory = null;
     queueFactory   = null;
     pfc            = null;
     client         = null;
 }
Example #9
0
        public void EditMetode(Metode metode)
        {
            using (var context = new Entities())
            {
                context.Database.Connection.ConnectionString = context.Database.Connection.ConnectionString.Replace("ELLYNDA", this.ServerName);
                var editedMetode = context.Metodes.Where(m => m.Id == metode.Id).First();

                editedMetode.Nama  = metode.Nama;
                editedMetode.Harga = metode.Harga;

                context.SaveChanges();
            }
        }
        private void izmeniSalu()
        {
            string naziv = this.nazivPolje.Text.Trim();

            if (sala != null && Metode.ProveriDuzinu(naziv, 5, 30))
            {
                sala.Naziv = naziv;
                sala.Sacuvaj();
                new Obavestenje("Uspesno ste izmenili salu!").ShowModal(this);
            }
            else
            {
                new Obavestenje("Izgleda da niste popunili sva polja,\n ili je duzina neodgovarajuca.").ShowModal(this);
            }
        }
		private  void procesuirajPrijavu()
		{
			string korIme = korImePolje.Text;
			string lozinka = passPolje.Text;

			// provera 
			if ( Metode.ProveriDuzinu( korIme , 3 , 10 ) && Metode.ProveriDuzinu( lozinka , 3 , 10 ) )
			{
				prijavljeniKorisnik = Korisnik.ulogujSe( korIme , lozinka );

				if ( prijavljeniKorisnik != null && prijavljeniKorisnik.Tip == Korisnik.ADMIN )
				{
					ToolBar = new ToolBar ( );

					// TODO: popravi uklanjanje 
					Menu = inicijalizujAdminMeni();
					Menu.Dispose();

					glavniPanel.Content = Administratorski.VratiInstancu().VratiPanel();
					Administratorski.VratiInstancu().PostaviKorIme( prijavljeniKorisnik.KorIme );
					this.ClientSize = new Size ( 700 , 500 );
					glavniPanel.BackgroundColor = Color.FromArgb( 240 , 240 , 240 , 50 );
				}
				else if(prijavljeniKorisnik != null && prijavljeniKorisnik.Tip == Korisnik.KOR)
				{
					ToolBar = new ToolBar ( );

					// TODO: popravi uklanjanje 
					menu.Items.Clear();
					Menu = Projekcijski.VratiInstancu().VratiMeni();
					//Menu.Dispose();

					Projekcijski.VratiInstancu().PostaviKorisnika(prijavljeniKorisnik);
					glavniPanel.Content = Projekcijski.VratiInstancu().VratiPanel();
					this.ClientSize = new Size ( 700 , 500 );
					glavniPanel.BackgroundColor = Color.FromArgb( 240 , 240 , 240 , 50 );
				}
			}
			else
			{
				promeniBojePolja();
			}

	

		}
        public static void testiranjeSala()
        {
            Sala s = Sala.VratiPoID(159);


            Console.WriteLine(s);
            s.RezervisiMesto(0, 0);
            s.RezervisiMesto(0, 1);

            Console.WriteLine(s);
            Metode.ispisi <Sala>(Sala.Sve());
            s.UkiniRezervaciju(0, 0);

            s.Sacuvaj();
            Metode.ispisi <Sala>(Sala.Sve());

//
        }
        private void Registrovanje()
        {
            string ime      = this.korImeTextBox.Text.Trim();
            string prezime  = this.prezimeTextBox.Text.Trim();
            string korIme   = this.korImeTextBox.Text.Trim();
            string lozinka1 = this.lozinka1TextBox.Text.Trim();
            string lozinka2 = this.lozinka2TextBox.Text.Trim();

            List <Korisnik> sviKorisnici = Korisnik.Svi();

            if (Metode.ProveriDuzinu(ime, 3, 15) && Metode.ProveriDuzinu(prezime, 3, 15) &&
                Metode.ProveriDuzinu(korIme, 3, 15) && Metode.ProveriDuzinu(lozinka1, 5, 15) &&
                Metode.ProveriDuzinu(lozinka2, 5, 15))
            {
                if (lozinka1 != lozinka2)
                {
                    new Obavestenje("Лозинке се морају поклапати!").ShowModal(this);
                    return;
                }
                else
                {
                    Korisnik k = sviKorisnici.Find(x => x.ImePrezime == ime + " " + prezime &&
                                                   x.KorIme == korIme
                                                   );
                    if (k == null)
                    {
                        Korisnik noviKorisnik = new Korisnik(korIme, lozinka1, Korisnik.KOR, ime + " " + prezime);
                        noviKorisnik.Sacuvaj();
                        new Obavestenje("Успешно сте се регистровали. Можете да се пријавите.").ShowModal(this);
                        this.Close();
                    }
                    else
                    {
                        new Obavestenje("Корисник са истим именом и/или корисничким именом већ постоји. ").ShowModal(this);
                        return;
                    }
                }
            }
            else
            {
                new Obavestenje("Упс! Пропустили сте неко поље, или је неко поље неодговарајуће дужине. ").ShowModal(this);
            }
        }
Example #14
0
        public static void PosejKarte()
        {
            try
            {
                List <Projekcija> listaProjekcija = Projekcija.Sve();
                List <Korisnik>   listaKorisnika  = Korisnik.Svi();



                List <Karta> lista = new List <Karta> ( )
                {
//					new Karta(listaProjekcija[Metode.VratiNasumicniInt(0,listaProjekcija.Count-1)].ProjekcijaId, listaKorisnika[Metode.VratiNasumicniInt(0,listaKorisnika.Count-1)].KorisnikId, Metode.VratiNasumicniInt(300,700), Metode.VratiNasumicniInt(0,5), Metode.VratiNasumicniInt(0,10)),
//					new Karta(listaProjekcija[Metode.VratiNasumicniInt(0,listaProjekcija.Count-1)].ProjekcijaId, listaKorisnika[Metode.VratiNasumicniInt(0,listaKorisnika.Count-1)].KorisnikId, Metode.VratiNasumicniInt(300,700), Metode.VratiNasumicniInt(0,5), Metode.VratiNasumicniInt(0,10)),
//					new Karta(listaProjekcija[Metode.VratiNasumicniInt(0,listaProjekcija.Count-1)].ProjekcijaId, listaKorisnika[Metode.VratiNasumicniInt(0,listaKorisnika.Count-1)].KorisnikId, Metode.VratiNasumicniInt(300,700), Metode.VratiNasumicniInt(0,5), Metode.VratiNasumicniInt(0,10)),
//					new Karta(listaProjekcija[Metode.VratiNasumicniInt(0,listaProjekcija.Count-1)].ProjekcijaId, listaKorisnika[Metode.VratiNasumicniInt(0,listaKorisnika.Count-1)].KorisnikId, Metode.VratiNasumicniInt(300,700), Metode.VratiNasumicniInt(0,5), Metode.VratiNasumicniInt(0,10)),
//					new Karta(listaProjekcija[Metode.VratiNasumicniInt(0,listaProjekcija.Count-1)].ProjekcijaId, listaKorisnika[Metode.VratiNasumicniInt(0,listaKorisnika.Count-1)].KorisnikId, Metode.VratiNasumicniInt(300,700), Metode.VratiNasumicniInt(0,5), Metode.VratiNasumicniInt(0,10))
//
//
                    new Karta(listaProjekcija[Metode.VratiNasumicniInt(0, listaProjekcija.Count - 1)].ProjekcijaId, listaKorisnika[0].KorisnikId, Metode.VratiNasumicniInt(300, 700), Metode.VratiNasumicniInt(0, 5), Metode.VratiNasumicniInt(0, 10)),
                    new Karta(listaProjekcija[Metode.VratiNasumicniInt(0, listaProjekcija.Count - 1)].ProjekcijaId, listaKorisnika[0].KorisnikId, Metode.VratiNasumicniInt(300, 700), Metode.VratiNasumicniInt(0, 5), Metode.VratiNasumicniInt(0, 10)),
                    new Karta(listaProjekcija[Metode.VratiNasumicniInt(0, listaProjekcija.Count - 1)].ProjekcijaId, listaKorisnika[0].KorisnikId, Metode.VratiNasumicniInt(300, 700), Metode.VratiNasumicniInt(0, 5), Metode.VratiNasumicniInt(0, 10)),
                    new Karta(listaProjekcija[Metode.VratiNasumicniInt(0, listaProjekcija.Count - 1)].ProjekcijaId, listaKorisnika[0].KorisnikId, Metode.VratiNasumicniInt(300, 700), Metode.VratiNasumicniInt(0, 5), Metode.VratiNasumicniInt(0, 10)),
                    new Karta(listaProjekcija[Metode.VratiNasumicniInt(0, listaProjekcija.Count - 1)].ProjekcijaId, listaKorisnika[0].KorisnikId, Metode.VratiNasumicniInt(300, 700), Metode.VratiNasumicniInt(0, 5), Metode.VratiNasumicniInt(0, 10))
                };

                Console.WriteLine("Provera da li datoteka vec postoji:");

                if (Serijalizacija.DaLiJePrazanFajl(Serijalizacija.KaDat))
                {
                    Console.WriteLine("Fajl ne postoji. Kreira se...");
                }
                else
                {
                    Console.WriteLine("Fajl postoji, prebrisace se...");
                }

                Console.WriteLine("Upisivanje u datoteku: \n");
                Serijalizacija.WriteListToBinaryFile <Karta>(Serijalizacija.KaDat, lista, false);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }
Example #15
0
        private void dodajFilm()
        {
            string naziv = this.nazivPolje.Text.Trim();
            string opis  = this.opisPolje.Text.Trim();
            Zanr   zanr  = (Zanr)this.zanrList.SelectedIndex;

            if (Metode.ProveriDuzinu(naziv, 5, 30) &&
                Metode.ProveriDuzinu(opis, 5, 255))
            {
                Film f = new Film(naziv, zanr, opis, 0.0F);
                f.Sacuvaj();
                new Obavestenje("Uspesno ste dodali film!").ShowModal();

                //MessageBox.Show( this , "Uspesno ste dodali film!" , MessageBoxType.Warning );
            }
            else
            {
                new Obavestenje("Izgleda da niste popunili sva polja, ili je duzina neodgovarajuca.").ShowModal();
            }
            //MessageBox.Show( this , "Izgleda da niste popunili sva polja, ili je duzina neodgovarajuca." , MessageBoxType.Warning );
        }
        public static void Main(string[] args)
        {
//			new Application ( Platforms.Gtk3 ).Run( new MainForm ( ) );

            /// SEJANJE ///
            InicijalnoSejanje.posejSve();

            Console.WriteLine("\nIspis svih korisnika: ");
            Metode.ispisi <Korisnik>(Korisnik.Svi());

            Console.WriteLine("\nIspis svih filmova: ");
            Metode.ispisi <Film>(Film.Svi());

            //InicijalnoSejanje.PosejSale();
            Console.WriteLine("\nIspis svih sala: ");
            Metode.ispisi <Sala>(Sala.Sve());

            Console.WriteLine("\nIspis svih projekcija: ");
            Metode.ispisi <Projekcija>(Projekcija.Sve());

            Console.WriteLine("\nIspis svih karata: ");
            try{
                Metode.ispisi <Karta>(Karta.Sve());
            }catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }


            /// TESTIRANJA ///
//			testiranjeSala();

            //testiranjeProjekcija();

            //testiranjeKorisnika();

            new Application(Platforms.Gtk3).Run(new Prijavljivanje( ));
        }
        private void izmeniFilm()
        {
            string nazivF = this.nazivPolje.Text.Trim();
            string opisF  = this.opisPolje.Text.Trim();
            Zanr   zanr   = (Zanr)this.zanrList.SelectedIndex;

            if (Metode.ProveriDuzinu(nazivF, 5, 30) &&
                Metode.ProveriDuzinu(opisF, 4, 255))
            {
                film.Naziv = nazivF;
                film.Opis  = opisF;
                film.setZanr(zanr);
                film.Sacuvaj();
                new Obavestenje("Uspesno ste izmenili film!").ShowModal();
                //MessageBox.Show( this , "Uspesno ste izmenili film!" , MessageBoxType.Information );
                InitializeComponents();
            }
            else
            {
                new Obavestenje("Izgleda da imate praznih polja, ili je duzina neodgovarajuca.").ShowModal();
            }
            //MessageBox.Show( this , "Izgleda da imate praznih polja, ili je duzina neodgovarajuca." , MessageBoxType.Warning );
        }
Example #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["movienum"] != null)
        {
            Film tempFilm = Metode.dohvatiFilm(Convert.ToInt32(Request.QueryString["movienum"]));

            if (tempFilm != null)
            {
                Label tempMovieBlock = new Label();

                tempMovieBlock.ID = "MovieBlockLabel" + tempFilm.idFilma;

                tempMovieBlock.Text = Metode.napraviIspisFilma(tempFilm);

                MainPanel.Controls.Add(tempMovieBlock);
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Nepostojeći film.');", true);
            }
        }
        else
        {
            List <Film> tempListaFilmova = Metode.dohvatiListuFilmova();

            foreach (Film tempFilm in tempListaFilmova)
            {
                Label tempMovieBlock = new Label();

                tempMovieBlock.ID = "MovieBlockLabel" + tempFilm.idFilma;

                tempMovieBlock.Text = Metode.napraviIspisFilma(tempFilm);

                MainPanel.Controls.Add(tempMovieBlock);
            }
        }
    }
Example #19
0
 public void SetUp()
 {
     repozitorijum = new FakeMetodeRepozitorijum();
     metode        = new Metode(repozitorijum);
 }
Example #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Film tempFilm = Metode.dohvatiFilm(Convert.ToInt32(Request.QueryString["film"]));

        if (tempFilm != null)
        {
            NazivFilmaLabel.Text = tempFilm.nazivFilma;

            /* ***************** */

            int odabraniDan = Convert.ToInt32(Request.QueryString["dan"]);

            string odabraniDanString = "";

            switch (odabraniDan)
            {
            case 1: odabraniDanString = "Ponedeljak"; break;

            case 2: odabraniDanString = "Utorak"; break;

            case 3: odabraniDanString = "Sreda"; break;

            case 4: odabraniDanString = "Četvrtak"; break;

            case 5: odabraniDanString = "Petak"; break;

            case 6: odabraniDanString = "Subota"; break;

            case 7: odabraniDanString = "Nedelja"; break;

            default: return;
            }

            OdabraniDanLabel.Text = odabraniDanString;

            /* ***************** */

            int odabraniSat = Convert.ToInt32(Request.QueryString["sat"]);

            string odabraniSatString = "";

            switch (odabraniSat)
            {
            case 15: odabraniSatString = "15:00"; break;

            case 18: odabraniSatString = "18:00"; break;

            case 21: odabraniSatString = "21:00"; break;

            default: return;
            }

            OdabraniSatLabel.Text = odabraniSatString;

            /* ***************** */

            SalaLabel.Text = tempFilm.idFilma.ToString();

            /* ***************** */

            string tempFilmDanSat = tempFilm.idFilma + "+" + odabraniDan + "+" + odabraniSat;

            string tempStringSedista = Metode.dohvatiStringSedista(tempFilmDanSat);

            /* ***************** */

            bool spremanjeRezervacije = (Request.QueryString["sed"] != null);

            /* ***************** */

            if (spremanjeRezervacije)
            {
                string tempIndexiSedistaString = Request.QueryString["sed"];

                if (tempIndexiSedistaString.Length > 0)
                {
                    int tempMaxIndexSedista = tempStringSedista.Length - 1;

                    /* ******************* */

                    char[] tempNoviStringSedistaArray = tempStringSedista.ToCharArray();

                    foreach (string index in tempIndexiSedistaString.Split(','))
                    {
                        int tempIntIndex = Convert.ToInt32(index);

                        if ((tempIntIndex >= 0) && (tempIntIndex <= tempMaxIndexSedista))
                        {
                            if (tempNoviStringSedistaArray[tempIntIndex] != '|')
                            {
                                tempNoviStringSedistaArray[tempIntIndex] = 'X';
                            }
                            else
                            {
                                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Pogresno odabrana Sedista.');", true);

                                spremanjeRezervacije = false;

                                break;
                            }
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Pogresno odabrana Sedista.');", true);

                            spremanjeRezervacije = false;

                            break;
                        }
                    }

                    string tempNovoStanjeSale = new string(tempNoviStringSedistaArray);

                    /* ******************* */

                    string tempKreatorUser = HttpContext.Current.User.Identity.Name;

                    /* ******************* */

                    if (tempKreatorUser == string.Empty)
                    {
                        tempKreatorUser = "******";
                    }

                    /* ******************* */

                    if (spremanjeRezervacije)
                    {
                        if (Request.QueryString["rez"] != null)
                        {
                            if (Session["uredjivanaRezervacijaSed"] != null)
                            {
                                int tempIdUredjivaneRezervacije = Convert.ToInt32(Request.QueryString["rez"]);

                                Metode.urediRezervaciju(tempIdUredjivaneRezervacije, tempFilmDanSat, tempIndexiSedistaString, tempNovoStanjeSale);

                                Session.Remove("uredjivanaRezervacijaSed");

                                tempStringSedista = ""; //stanje sale neće biti ispisano
                            }
                            else
                            {
                                Response.Redirect("~/Default.aspx");
                            }
                        }
                        else
                        {
                            Metode.spremiRezervaciju(tempFilmDanSat, tempIndexiSedistaString, tempNovoStanjeSale, tempKreatorUser);

                            tempStringSedista = ""; //stanje Sale neće biti ispisano
                        }
                    }
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", "alert('Niste odabrali Sedista.');", true);

                    spremanjeRezervacije = false;
                }
            }
            else
            {
                if (Session["isUredjivanjeRezervacije"] != null)
                {
                    string tempIndexiSedistaString = Session["uredjivanaRezervacijaSed"].ToString();

                    /* ******************* */

                    char[] tempNoviStringSedistaArray = tempStringSedista.ToCharArray();

                    foreach (string index in tempIndexiSedistaString.Split(','))
                    {
                        try { tempNoviStringSedistaArray[Convert.ToInt32(index)] = 'W'; }
                        catch { }
                    }

                    tempStringSedista = new string(tempNoviStringSedistaArray);

                    /* ******************* */

                    Session.Remove("isUredjivanjeRezervacije");
                }
            }

            /* ***************** */

            Label tempSedistaIzbor = new Label();

            tempSedistaIzbor.ID = "MovieGalleryLabel" + tempFilm.idFilma;

            /* ***************** */

            string tempInnerHtml = "";

            /* ***************** */

            tempInnerHtml += "<div id=\"pregledSedista\">";

            for (int i = 0; i < tempStringSedista.Length; i++)
            {
                switch (tempStringSedista[i])
                {
                case 'W': tempInnerHtml += "<input type=\"checkbox\" class=\"freeSit\" name=\"strIndex" + i + "\" value=\"true\" checked>"; break;

                case 'O': tempInnerHtml += "<input type=\"checkbox\" class=\"freeSit\" name=\"strIndex" + i + "\" value=\"true\">"; break;

                case 'X': tempInnerHtml += "<input type=\"checkbox\" class=\"nonFreeSit\" name=\"strIndex" + i + "\" value=\"true\" disabled readonly checked>"; break;

                default: tempInnerHtml += "<br>"; break;
                }
            }

            tempInnerHtml += "</div>";

            /* ************************ */

            if (Session["uredjivanaRezervacijaId"] != null)
            {
                tempInnerHtml += "<input class=\"spremiRezervButton\" type=\"button\" value=\"Spremi rezervaciju\" onclick=\"spremiRezervaciju(" + tempFilm.idFilma + ", " + odabraniDan + ", " + odabraniSat + ", " + Session["uredjivanaRezervacijaId"] + ");\">";

                Session.Remove("uredjivanaRezervacijaId");
            }
            else if (spremanjeRezervacije)
            {
                tempInnerHtml += "<input class=\"spremiRezervButton\" type=\"button\" value=\"Rezervacija spremljena\" disabled>";
            }
            else
            {
                tempInnerHtml += "<input class=\"spremiRezervButton\" type=\"button\" value=\"Spremi rezervaciju\" onclick=\"spremiRezervaciju(" + tempFilm.idFilma + ", " + odabraniDan + ", " + odabraniSat + ", " + "null" + ");\">";
            }

            /* ************************ */

            tempSedistaIzbor.Text = tempInnerHtml;

            /* ************************ */

            CheckBoxSedistaPanel.Controls.Add(tempSedistaIzbor);
        }
    }
Example #21
0
        public void InitializeComponents()
        {
            meni = new MenuBar {
                Items =
                {
                    new ButtonMenuItem {
                        Text = "Почетна", Items ={ this.pocetnaCmd            }
                    },
                    new SeparatorMenuItem(),
                    new ButtonMenuItem {
                        Text = "Одјави се", Items ={ this.prijaviSeCmd          }
                    }
                }
            };

            // labele
            izdvajamoLabela = new Label {
                Text = "\tИздвајамо: ", Font = new Font(SystemFont.Bold, 14)
            };
            najnovijeLabela = new Label {
                Text = "\tНајновије: ", Font = new Font(SystemFont.Bold, 14)
            };
            kategorijeLabela = new Label {
                Text = "\tКатегорије: ", Font = new Font(SystemFont.Bold, 12)
            };
            separator = new Label {
                Text = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
                Font = new Font(SystemFont.Default, 10, FontDecoration.Strikethrough)
            };

            // pretraga
            lupaImg = new ImageView {
                Image = Icon.FromResource("search-icon")
            };
            lupaImg.Width       = 30;
            lupaImg.Height      = 30;
            lupaImg.MouseEnter += (sender, e) => {
                lupaImg.Width  += 10;
                lupaImg.Height += 10;
            };
            lupaImg.MouseLeave += (sender, e) => {
                lupaImg.Width  = 30;
                lupaImg.Height = 30;
            };
            pretragaBox = new TextBox( )
            {
                PlaceholderText = "Унесите назив филма..."
            };
            pretragaBox.ToolTip = "Притисните ентер за претрагу.";
            pretragaBox.KeyUp  += (sender, e) => {
                Console.WriteLine("Pretraga");
            };
            pretragaLayout = new DynamicLayout( )
            {
                Spacing = new Size(10, 10)
            };
            pretragaLayout.BeginVertical();
            pretragaLayout.EndBeginHorizontal();
            pretragaLayout.Add(null, true, false);
            pretragaLayout.Add(lupaImg);
            pretragaLayout.Add(pretragaBox);
            pretragaLayout.Add(null, true, false);
            pretragaLayout.EndHorizontal();
            pretragaLayout.EndVertical();

            // kategorije
            List <string> listaKategorija = ZanrC.VratiSveZanrove();
            List <Label>  listaLabela     = new List <Label> ( );

            listaKategorija.ForEach(x => listaLabela.Add(new Label {
                Text = x.ToString()
            }));

            listaLabela.ForEach(x => {
                x.MouseEnter += (sender, e) => {
                    x.Font = new Font(SystemFont.Default, 10, FontDecoration.Underline);
                };

                x.MouseLeave += (sender, e) => {
                    x.Font = new Font(SystemFont.Default, 10, FontDecoration.None);
                };
                x.MouseDown += (sender, e) => {
                    Console.WriteLine("Kliknuto: " + x.Text);
                };
            });
            kategorijePanel = new DynamicLayout( )
            {
                Spacing = new Size(10, 10),
                Padding = new Padding(10, 10)
            };
            kategorijePanel.BeginVertical();
            listaLabela.ForEach(x => {
                kategorijePanel.BeginHorizontal();
                kategorijePanel.Add(null, true, false);
                kategorijePanel.Add(x);
                //kategorijePanel.Add( null , true , false );
                kategorijePanel.EndHorizontal();
            });
            kategorijePanel.EndVertical();

            // pretraga i desni panel
            desniPanel = new DynamicLayout( )
            {
                Spacing         = new Size(10, 10),
                BackgroundColor = Color.FromArgb(255, 238, 91, 70),
                Size            = new Size(300, 500)
            };
            desniPanel.BeginVertical();
            desniPanel.Add(pretragaLayout);
            desniPanel.Add(kategorijeLabela);
            separator.Text = "\t\t\t\t\t\t\t";
            desniPanel.Add(separator);
            desniPanel.Add(kategorijePanel);
            desniPanel.EndVertical();

            izdvajamoPanel = new DynamicLayout( )
            {
                Padding         = new Padding(10, 10),
                BackgroundColor = Color.FromArgb(40, 40, 40, 50),
                Spacing         = new Size(5, 5),
            };
            izdvajamoPanel.BeginVertical();

            // inicijalizacija izdvajamo panela
            List <Projekcija> listaProjekcijaPodaci = Projekcija.Sve();

            for (int i = 0; i < listaProjekcijaPodaci.Count - 1; i++)
            {
                // nasumicno odabiranje projekcije
                if (i == Metode.VratiNasumicniInt(0, listaProjekcijaPodaci.Count))
                {
                    continue;
                }

                Label nazivFilma = new Label {
                    Text = "Назив филма: " + listaProjekcijaPodaci[i].Film.Naziv
                };
                Label nazivSale = new Label {
                    Text = "Назив сале:  " + listaProjekcijaPodaci[i].Sala.Naziv
                };
                Label vreme = new Label {
                    Text = "Време:\t  " + listaProjekcijaPodaci[i].Vreme
                };
                Button kupi = new Button {
                    Text = "Kупите карту"
                };
                Button vise = new Button {
                    Text = "Више информација"
                };
                var podPanel = new DynamicLayout( )
                {
                    Spacing = new Size(10, 10)
                };
                var dugmici = new DynamicLayout {
                    Spacing = new Size(10, 10)
                };

                kupi.Click += (sender, e) => KupiKartu(listaProjekcijaPodaci[i]);
                vise.Click += (sender, e) => PrikaziVise(listaProjekcijaPodaci[i]);

                podPanel.BeginVertical();
                podPanel.Add(nazivFilma);
                podPanel.Add(nazivSale);
                podPanel.Add(vreme);

                dugmici.BeginVertical();
                dugmici.BeginHorizontal();
                dugmici.Add(null, true, false);
                dugmici.Add(kupi);
                dugmici.Add(null, true, false);
                dugmici.EndHorizontal();

                dugmici.BeginHorizontal();
                dugmici.Add(null, true, false);
                dugmici.Add(vise);
                dugmici.Add(null, true, false);
                dugmici.EndHorizontal();
                dugmici.EndVertical();

                podPanel.Add(dugmici);
                podPanel.EndVertical();

                izdvajamoPanel.Add(podPanel);
            }
            izdvajamoPanel.EndVertical();

            najnovijePanel = new DynamicLayout()
            {
                Padding         = new Padding(10, 10),
                BackgroundColor = Color.FromArgb(40, 40, 40, 50),
                Spacing         = new Size(10, 10),
            };

            najnovijePanel.BeginVertical();
            for (int i = 0; i < listaProjekcijaPodaci.Count - 1; i++)
            {
                if (i == Metode.VratiNasumicniInt(0, listaProjekcijaPodaci.Count))
                {
                    continue;
                }

                Label nazivFilma = new Label {
                    Text = "Назив филма: " + listaProjekcijaPodaci[i].Film.Naziv
                };
                Label nazivSale = new Label {
                    Text = "Назив сале:  " + listaProjekcijaPodaci[i].Sala.Naziv
                };
                Label vreme = new Label {
                    Text = "Време:\t  " + listaProjekcijaPodaci[i].Vreme
                };
                Button kupi = new Button {
                    Text = "Kупите карту"
                };
                Button vise = new Button {
                    Text = "Више информација"
                };
                var podPanel = new DynamicLayout( )
                {
                    Spacing = new Size(10, 10)
                };
                var dugmici = new DynamicLayout {
                    Spacing = new Size(5, 5)
                };

                kupi.Click += (sender, e) => KupiKartu(listaProjekcijaPodaci[i]);
                vise.Click += (sender, e) => PrikaziVise(listaProjekcijaPodaci[i]);

                podPanel.BeginVertical();
                podPanel.Add(nazivFilma);
                podPanel.Add(nazivSale);
                podPanel.Add(vreme);

                dugmici.BeginVertical();
                dugmici.BeginHorizontal();
                dugmici.Add(null, true, false);
                dugmici.Add(kupi);
                dugmici.Add(null, true, false);
                dugmici.EndHorizontal();

                dugmici.BeginHorizontal();
                dugmici.Add(null, true, false);
                dugmici.Add(vise);
                dugmici.Add(null, true, false);
                dugmici.EndHorizontal();
                dugmici.EndVertical();


                podPanel.Add(dugmici);
                podPanel.EndVertical();

                najnovijePanel.Add(podPanel);
            }
            najnovijePanel.EndBeginVertical();


            leviPanel = new DynamicLayout()
            {
                Spacing = new Size(10, 10),
                Padding = new Padding(10, 10)
            };
            leviPanel.BeginVertical();
            leviPanel.Add(izdvajamoLabela);
            leviPanel.Add(separator);
            leviPanel.Add(izdvajamoPanel);
            leviPanel.Add(najnovijeLabela);
            leviPanel.Add(separator);
            leviPanel.Add(najnovijePanel);
            leviPanel.EndVertical();

            Scrollable scrollLeviPanel = new Scrollable {
                Content = leviPanel, Size = new Size(400, 500)
            };

            // try with table layout
            var mainPanel = new TableLayout()
            {
                Padding = new Padding(10),                // padding around cells
                Spacing = new Size(5, 5),                 // spacing between each cell
                Rows    =
                {
                    new TableRow(
                        new TableCell(scrollLeviPanel),
                        new TableCell(desniPanel)
                        )
                }
            };

            panel = mainPanel;
        }