Beispiel #1
0
 private void pictureBox4_Click(object sender, EventArgs e)
 {
     if (Telefoni.Count() > 1)
     {
         this.telInd++;
         telInd           = telInd % Telefoni.Count();
         lblListaTel.Text = Telefoni[telInd];
     }
 }
Beispiel #2
0
        private void PopolniTelefoni()
        {
            this.telInd   = 0;
            this.Telefoni = new List <string>();

            string        sqlPozicii = @"SELECT TELEFON FROM IMENIK WHERE RESTORAN_ID= :REST_ID ";
            OracleCommand cmd        = new OracleCommand(sqlPozicii, this.Conn);

            cmd.CommandType = CommandType.Text;
            try
            {
                OracleParameter prm = new OracleParameter("REST_ID", OracleDbType.Int64);
                prm.Value = this.RestoranID;
                cmd.Parameters.Add(prm);
                OracleDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    if (!dr.IsDBNull(0))
                    {
                        this.Telefoni.Add(dr.GetString(0));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxForm mbf = new MessageBoxForm("Настана грешка при поврзувањето со базата!", false);
                if (mbf.ShowDialog() == DialogResult.Yes)
                {
                    this.Close();
                }
                else
                {
                    this.Close();
                }
            }

            if (Telefoni.Count() != 0)
            {
                lblListaTel.Text = Telefoni[0];
            }
            else
            {
                lblListaTel.Text = "";
            }
        }