Exemple #1
0
        public bool Delete(AdresaBLL a)
        {
            bool isSucces = false;

            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                string     sql = "DELETE FROM ADRESA WHERE adresa_id=@adresa_id";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@adresa_id", a.Id_adresa);
                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSucces = true;
                }
                else
                {
                    isSucces = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(isSucces);
        }
        public frmUnosKupca()
        {
            InitializeComponent();
            kupac  = new KupacBLL();
            adresa = new AdresaBLL();
            combo  = new PopunaCmBox();
            table  = new DataTable();

            combo.popuniCmbAdresa(cmbAdresa);
        }
Exemple #3
0
        public frmUnosAdrese()
        {
            InitializeComponent();
            ulica  = new UlicaBLL();
            combo  = new PopunaCmBox();
            adresa = new AdresaBLL();
            table  = new DataTable();

            combo.popuniCmbUlica(cmbUl);
        }
Exemple #4
0
        public frmBrisanjeAzuriranjeAdrese()
        {
            InitializeComponent();
            combo  = new PopunaCmBox();
            ulica  = new UlicaBLL();
            adresa = new AdresaBLL();
            table  = new DataTable();

            combo.popuniCmbUlica(cmbUlica);
            combo.popuniCmbAdresa(cmbAdresa);
            table = (DataTable)cmbAdresa.DataSource;
        }
Exemple #5
0
        public bool Update(AdresaBLL a)
        {
            bool isSucces = false;

            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                string sql = "UPDATE ADRESA SET client_id=@client_id, oras=@oras, strada=@strada, numar=@numar, bloc=@bloc, scara=@scara, etaj=@etaj, apartament=@apartament WHERE adresa_id=@adresa_id";

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@adresa_id", a.Id_adresa);
                cmd.Parameters.AddWithValue("@client_id", a.Id_client);
                cmd.Parameters.AddWithValue("@oras", a.Oras);
                cmd.Parameters.AddWithValue("@strada", a.Strada);
                cmd.Parameters.AddWithValue("@numar", a.Numar);
                cmd.Parameters.AddWithValue("@bloc", a.Bloc);
                cmd.Parameters.AddWithValue("@scara", a.Scara);
                cmd.Parameters.AddWithValue("@etaj", a.Etaj);
                cmd.Parameters.AddWithValue("@apartament", a.Apartament);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSucces = true;
                }
                else
                {
                    isSucces = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(isSucces);
        }
Exemple #6
0
        public bool Insert(AdresaBLL a)
        {
            bool isSucces = false;

            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                string     sql = "INSERT INTO ADRESA (client_id, oras, strada, numar, bloc, scara, etaj, apartament) VALUES ( @client_id, @oras, @strada, @numar, @bloc, @scara, @etaj, @apartament)";
                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@client_id", a.Id_client);
                cmd.Parameters.AddWithValue("@oras", a.Oras);
                cmd.Parameters.AddWithValue("@strada", a.Strada);
                cmd.Parameters.AddWithValue("@numar", a.Numar);
                cmd.Parameters.AddWithValue("@bloc", a.Bloc);
                cmd.Parameters.AddWithValue("@scara", a.Scara);
                cmd.Parameters.AddWithValue("@etaj", a.Etaj);
                cmd.Parameters.AddWithValue("@apartament", a.Apartament);


                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSucces = true;
                }
                else
                {
                    isSucces = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
            return(isSucces);
        }