Пример #1
0
        public void adresGuncelle()
        {
            for (int i = 0; i < panel9.Controls.Count; i++)
            {
                panel9.Controls.RemoveAt(i);
            }
            con.Open();
            using (var command = new NpgsqlCommand("SELECT adres_baslik,adres_adres From adres WHERE adres_kid=@id ", con))
            {
                command.Parameters.AddWithValue("id", kID);
                NpgsqlDataReader dr = command.ExecuteReader();


                while (dr.Read())
                {
                    UserControl3 uc3 = new UserControl3(dr["adres_baslik"].ToString(), dr["adres_adres"].ToString());
                    uc3.Dock = DockStyle.Top;
                    panel9.Controls.Add(uc3);
                }
                con.Close();
            }
        }
Пример #2
0
        public anasayfa(int k)
        {
            InitializeComponent();
            kID = k;
            string connString =
                String.Format(
                    "Server=localhost;User Id=postgres;Database=yemegimigetir;Port=5432;Password=benbuyum123;SSLMode=Prefer");

            con = new NpgsqlConnection(connString);

            con.Open();

            using (var command = new NpgsqlCommand("SELECT kullanici_adi,kullanici_soyadi,kullanici_bakiye From kullanici WHERE kullanici_id=@id ", con))
            {
                command.Parameters.AddWithValue("id", kID);
                NpgsqlDataReader dr = command.ExecuteReader();


                if (dr.Read())
                {
                    label_isim.Text    = dr["kullanici_adi"].ToString() + " " + dr["kullanici_soyadi"].ToString();
                    label_bakiye.Text += dr["kullanici_bakiye"].ToString();
                    bakiye             = int.Parse(dr["kullanici_bakiye"].ToString());
                }
                con.Close();
            }

            con.Open();
            using (var command = new NpgsqlCommand("SELECT adres_baslik,adres_adres From adres WHERE adres_kid=@id ", con))
            {
                command.Parameters.AddWithValue("id", kID);
                NpgsqlDataReader dr = command.ExecuteReader();


                while (dr.Read())
                {
                    UserControl3 uc3 = new UserControl3(dr["adres_baslik"].ToString(), dr["adres_adres"].ToString());
                    uc3.Dock = DockStyle.Top;
                    panel9.Controls.Add(uc3);
                }
                con.Close();
            }

            con.Open();
            using (var command = new NpgsqlCommand("SELECT magaza_isim,magaza_puan From magaza ", con))
            {
                NpgsqlDataReader dr = command.ExecuteReader();


                while (dr.Read())
                {
                    UserControl4 uc4 = new UserControl4(dr["magaza_isim"].ToString(), dr["magaza_puan"].ToString());
                    uc4.Dock        = DockStyle.Top;
                    uc4.MouseHover += new EventHandler(this.mh);
                    uc4.MouseLeave += new EventHandler(this.ml);
                    uc4.Click      += new EventHandler(this.click);
                    panel11.Controls.Add(uc4);
                }
                con.Close();
            }
        }