Exemple #1
0
 private void pictureBox4_Click(object sender, EventArgs e)
 {
     if (Telefoni.Count() > 1)
     {
         this.telInd++;
         telInd           = telInd % Telefoni.Count();
         lblListaTel.Text = Telefoni[telInd];
     }
 }
Exemple #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 = "";
            }
        }
Exemple #3
0
        public static void dodajTelefon(TelefonPregled t)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Telefoni telefon = new Telefoni();
                telefon.Staratelj_Id = s.Load <Staratelj>(t.idStaratelja);
                telefon.BrojTelefona = t.BrojTelefona;
                s.Save(telefon);
                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
        }
Exemple #4
0
        public static void obrisiTelefon(int idTelefona)
        {
            try
            {
                ISession s = DataLayer.GetSession();

                Telefoni  o         = s.Load <Telefoni>(idTelefona);
                Staratelj staratelj = new Staratelj();
                staratelj = o.Staratelj_Id;
                staratelj.ListaTelefona.Remove(o);
                s.Delete(o);
                s.Flush();

                s.Close();
            }
            catch (Exception ec)
            {
                //handle exceptions
            }
        }