Ejemplo n.º 1
0
 private void controlsToDistributer(DistributerDTO distributer)
 {
     distributer.Naziv = tbxNaziv.Text;
     distributer.Adresa = tbxAdresa.Text;
     distributer.Telefon = tbxBrojTelefona.Text;
     distributer.Email = tbxEmail.Text;
 }
Ejemplo n.º 2
0
 public static DistributerDTO readerToDistributer(MySqlDataReader reader)
 {
     DistributerDTO distributer = new DistributerDTO();
     distributer.Id = reader.GetInt32("idDistributer");
     distributer.Naziv = reader["nazivDistributer"].ToString();
     distributer.Adresa = reader["adresaDistributer"].ToString();
     distributer.Telefon = reader["telefonDistributer"].ToString();
     distributer.Email = reader["e_mailDistributer"].ToString();
     return distributer;
 }
Ejemplo n.º 3
0
        public DistributerDodajForm(DistributerDTO distributer)
        {
            InitializeComponent();

            this.Text = "Izmjena distributera";
            tbxNaziv.Text = distributer.Naziv;
            tbxAdresa.Text = distributer.Adresa;
            tbxEmail.Text = distributer.Email;
            tbxBrojTelefona.Text = distributer.Telefon;
            this.distributer = distributer;
        }
Ejemplo n.º 4
0
 private bool insertDistributer()
 {
     if (validate())
     {
         DistributerDTO distributer = new DistributerDTO();
         controlsToDistributer(distributer);
        long id=BioskopUtil.getDAOFactory().getDistributerDAO().insert(distributer);
        if (id > 0)
            return true;
        else
            return false;
     }
     return false;
 }
Ejemplo n.º 5
0
 public List<FilmDTO> getAllByDistributer(DistributerDTO distributer)
 {
     MySqlConnection connection = ConnectionPool.checkOutConnection();
     MySqlCommand command = connection.CreateCommand();
     command.CommandText = getByDistributerQuerry;
     command.Parameters.AddWithValue("idDistributer", distributer.Id);
     MySqlDataReader reader = command.ExecuteReader();
     List<FilmDTO> lista = new List<FilmDTO>();
     while(reader.Read())
     {
         FilmDTO film = readerToFilmDTO(reader);
         film.Zanr = MySqlZanrDAO.readerToZanrDTO(reader);
         film.Status = MySqlStatusFilmDAO.readerToStatusFilmDTO(reader);
         film.Distributer = distributer;
         lista.Add(film);
     }
     reader.Close();
     ConnectionPool.checkInConnection(connection);
     return lista;
 }
Ejemplo n.º 6
0
        private void prikaziDetalje(DistributerDTO distributer)
        {
            lblNazivDist.Text = distributer.Naziv;
            lblAdresaDist.Text = distributer.Adresa;
            lblEmailDist.Text = distributer.Email;
            lblBrojTelefonaDist.Text = distributer.Telefon;

            List<FilmDTO> filmovi = BioskopUtil.getDAOFactory().getFilmDAO().getAllByDistributer(distributer);
            dgvFilmovi.Rows.Clear();
            foreach (FilmDTO film in filmovi)
            {
                dgvFilmovi.Rows.Add(film.Naziv, film.Zanr.Naziv, film.Trajanje, film.Status.Naziv, film.Id);
            }

            showDistributer();
        }
Ejemplo n.º 7
0
 public long insert(DistributerDTO distributer)
 {
     if (distributer == null)
     {
         throw new MySqlDAOException();
     }
     MySqlConnection connection = ConnectionPool.checkOutConnection();
     MySqlCommand command = connection.CreateCommand();
     command.CommandText = insertQuerry;
     command.Parameters.AddWithValue("naziv", distributer.Naziv);
     command.Parameters.AddWithValue("adresa", distributer.Adresa);
     command.Parameters.AddWithValue("telefon", distributer.Telefon);
     command.Parameters.AddWithValue("eMail", distributer.Email);
     command.ExecuteNonQuery();
     long id = command.LastInsertedId;
     ConnectionPool.checkInConnection(connection);
     return id;
 }
Ejemplo n.º 8
0
 public bool update(DistributerDTO distributer)
 {
     if (distributer == null)
     {
         throw new MySqlDAOException();
     }
     MySqlConnection connection = ConnectionPool.checkOutConnection();
     MySqlCommand command = connection.CreateCommand();
     command.CommandText = updateQuerry;
     command.Parameters.AddWithValue("naziv", distributer.Naziv);
     command.Parameters.AddWithValue("adresa", distributer.Adresa);
     command.Parameters.AddWithValue("telefon", distributer.Telefon);
     command.Parameters.AddWithValue("eMail", distributer.Email);
     command.Parameters.AddWithValue("id", distributer.Id);
     int rows=command.ExecuteNonQuery();
     ConnectionPool.checkInConnection(connection);
     return rows>0;
 }