Пример #1
0
        private void silbtn_Click(object sender, EventArgs e)
        {
            Sube sube = new Sube();

            bool kayitarama = false;

            sube.BaglantiAc();
            OleDbCommand    aramasorgusu = new OleDbCommand("select * from marketler where mid='" + midbox.Text + "'", sube.baglan);
            OleDbDataReader kayitokuma   = aramasorgusu.ExecuteReader();

            while (kayitokuma.Read())
            {
                kayitarama = true;
                OleDbCommand deletesorgu = new OleDbCommand("delete from marketler where mid='" + midbox.Text + "'", sube.baglan);
                deletesorgu.ExecuteNonQuery();
                break;
            }
            if (kayitarama == false)
            {
                MessageBox.Show("Silinecek kayıt bulunamadı!", "SAS Marketler Zinciri", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            sube.BaglantiKapat();
            SubeGoster();
            Temizle();
        }
Пример #2
0
        private void kydtbtn_Click(object sender, EventArgs e)
        {
            bool kayitkontrol = false;

            Sube sube = new Sube();

            sube.BaglantiAc();
            OleDbCommand    selectsorgu = new OleDbCommand("select * from marketler where mid='" + midbox.Text + "'", sube.baglan);
            OleDbDataReader kayitokuma  = selectsorgu.ExecuteReader();

            while (kayitokuma.Read())
            {
                kayitkontrol = true;
                break;
            }
            sube.BaglantiKapat();

            if (kayitkontrol == false)
            {
                if (midbox.Text.Length < 4 || midbox.Text == "")
                {
                    mid.ForeColor = Color.Red;
                }
                else
                {
                    mid.ForeColor = Color.Black;
                }

                try
                {
                    sube.BaglantiAc();
                    OleDbCommand eklekomutu = new OleDbCommand("insert into marketler values('" + midbox.Text + "','" + madbox.Text + "','" + msubebox.Text + "','" + madresbox.Text + "','" + mtelefonbox.Text + "','" + mverginobox.Text + "','" + mvergidairesibox.Text + "','" + mersisnobox.Text + "')", sube.baglan);
                    eklekomutu.ExecuteNonQuery();
                    sube.BaglantiKapat();

                    MessageBox.Show("Yeni kayıt oluşturuldu!", "SAS Marketler Zinciri", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    SubeGoster();
                    Temizle();
                }
                catch (Exception hatamsj)
                {
                    MessageBox.Show(hatamsj.Message, "SAS Marketler Zinciri", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    sube.BaglantiKapat();
                }
            }
            else
            {
                MessageBox.Show("Girilen Market numarası daha önceden kayıtlıdır!!", "SAS Marketler Zincirleri", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
        private void SubeGoster()
        {
            Sube sube = new Sube();

            try
            {
                sube.BaglantiAc();
                OleDbDataAdapter tedarikcilerilistele = new OleDbDataAdapter
                                                            ("select mid AS[ŞUBE ID],mad AS[ŞUBE ADI],msube AS[BULUNDUĞU İLÇE],madres AS[ADRES],mtelefon AS[TELEFON],mvergino AS[VERGİ NO],mvergidairesi AS[VERGİ DAİRESİ],mmersisno AS[MERSİS NO] from marketler Order By mad ASC", sube.baglan);
                DataSet dshafiza = new DataSet();
                tedarikcilerilistele.Fill(dshafiza);
                dataGridView1.DataSource = dshafiza.Tables[0];
                sube.BaglantiKapat();
            }
            catch (Exception hatamsj)
            {
                MessageBox.Show(hatamsj.Message, "SAS Market Zinciri", MessageBoxButtons.OK, MessageBoxIcon.Error);
                sube.BaglantiKapat();
            }
        }
Пример #4
0
        private void gnclbtn_Click(object sender, EventArgs e)
        {
            Sube sube = new Sube();

            try
            {
                sube.BaglantiAc();
                OleDbCommand guncellekomutu = new OleDbCommand("update marketler set mid='" + midbox.Text + "',mad='" + madbox.Text + "',msube='" + msubebox.Text + "',madres='" + madresbox.Text + "',mtelefon='" + mtelefonbox.Text + "',mvergino='" + mverginobox.Text + "',mvergidairesi='" + mvergidairesibox.Text + "',mmersisno='" + mersisnobox.Text + "'where mid='" + midbox.Text + "'", sube.baglan);
                guncellekomutu.ExecuteNonQuery();
                sube.BaglantiKapat();

                MessageBox.Show("Kayıt Güncellendi!", "SAS Marketler Zinciri", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                SubeGoster();
                Temizle();
            }
            catch (Exception hatamsj)
            {
                MessageBox.Show(hatamsj.Message, "SAS Marketler Zinciri", MessageBoxButtons.OK, MessageBoxIcon.Error);
                sube.BaglantiKapat();
            }
        }