private void frmMusteriSorgulama_Load(object sender, EventArgs e)
 {
     this.Top = 0;
     this.Left = 0;
     cMusteri m = new cMusteri();
     m.MusterileriGoster(lvMusteriler);
 }
        private void btnSil_Click(object sender, EventArgs e)
        {
            cMusteri m = new cMusteri();

            m.MusteriNo = Convert.ToInt32(txtNo.Text);
            m.MusteriAd = txtAdi.Text;
            m.MusteriSoyad = txtSoyadi.Text;
            m.Telefon = txtTelefon.Text;
            m.Adres = txtAdres.Text;

            if ((MessageBox.Show("Silmek istiyor musunuz ?", "Silinsin Mi ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) == DialogResult.Yes)
            {
                bool sonuc = m.MusteriSil(m);

                if (sonuc)
                {
                    MessageBox.Show("Film Türü Silindi");
                    Temizle();
                    btnSil.Enabled = false;
                    btnKaydet.Enabled = false;
                    btnDegistir.Enabled = false;
                    m.MusterileriGoster(lvMusteriler);
                }
            }
            else
            {

            }
        }
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            cMusteri m = new cMusteri();
            m.MusteriAd = txtAdi.Text;
            m.MusteriSoyad = txtSoyadi.Text;
            m.Telefon = txtTelefon.Text;
            m.Adres = txtAdres.Text;

            if (txtAdi.Text.Trim() == string.Empty || txtSoyadi.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Müşterinin ismini ve soyismini girmek zorundasin", "Uyarı !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                //TODO - Müşteri var mı kontrol
                if (m.MusteriKontrol(txtTelefon.Text))
                    MessageBox.Show("Müşteri Daha Once Kayıt Edilmiş");
                else
                {
                    bool sonuc = m.MusteriEkle(m);
                    //bool sonuc = m.MusteriEkle(txtAdi.Text, txtSoyadi.Text, txtTelefon.Text, txtAdres.Text);
                    if (sonuc)
                    {
                        MessageBox.Show("Müşteri Kayıt Edildi");
                        Temizle();
                        btnKaydet.Enabled = false;
                        m.MusterileriGoster(lvMusteriler);
                    }
                }
            }
        }
        private void btnDegistir_Click(object sender, EventArgs e)
        {
            cMusteri m = new cMusteri();
            m.MusteriNo = Convert.ToInt32(txtNo.Text);
            m.MusteriAd = txtAdi.Text;
            m.MusteriSoyad = txtSoyadi.Text;
            m.Telefon = txtTelefon.Text;
            m.Adres = txtAdres.Text;

            bool sonuc = m.MusteriGuncelle(m);
            if (sonuc)
            {
                MessageBox.Show("Müşteri Güncellendi");
                Temizle();
                btnSil.Enabled = false;
                btnKaydet.Enabled = false;
                btnDegistir.Enabled = false;
                m.MusterileriGoster(lvMusteriler);
            }
        }
示例#5
0
        public bool MusteriEkle(cMusteri m)
        {
            bool sonuc = false;

            SqlConnection conn = new SqlConnection(gnl.connStr);

            SqlCommand comm = new SqlCommand("Insert into Musteriler(MusteriAd, MusteriSoyad, Telefon, Adres) values (@MusteriAd, @MusteriSoyad, @Telefon, @Adres)", conn);
            comm.Parameters.Add("@MusteriAd", SqlDbType.VarChar).Value = m._musteriAd;
            comm.Parameters.Add("@MusteriSoyad", SqlDbType.VarChar).Value = m._musteriSoyad;
            comm.Parameters.Add("@Telefon", SqlDbType.VarChar).Value = m._telefon;
            comm.Parameters.Add("@Adres", SqlDbType.VarChar).Value = m._adres;

            if (conn.State == ConnectionState.Closed)
                conn.Open();

            sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());

            conn.Close();

            return sonuc;
        }
示例#6
0
        public bool MusteriSil(cMusteri m)
        {
            bool sonuc = false;

            SqlConnection conn = new SqlConnection(gnl.connStr);

            SqlCommand comm = new SqlCommand("Update Musteriler Set Silindi = 1 Where MusteriNo = @MusteriNo", conn);
            comm.Parameters.Add("@MusteriNo", SqlDbType.Int).Value = m._musteriNo;

            if (conn.State == ConnectionState.Closed)
                conn.Open();

            sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());

            conn.Close();

            return sonuc;
        }
示例#7
0
        public bool MusteriGuncelle(cMusteri m)
        {
            bool sonuc = false;

            SqlConnection conn = new SqlConnection(gnl.connStr);

            SqlCommand comm = new SqlCommand("Update Musteriler Set MusteriAd = @MusteriAd , MusteriSoyad = @MusteriSoyad, Telefon = @Telefon, Adres = @Adres Where MusteriNo = @MusteriNo", conn);
            comm.Parameters.Add("@MusteriNo", SqlDbType.Int).Value = m._musteriNo;
            comm.Parameters.Add("@MusteriAd", SqlDbType.VarChar).Value = m._musteriAd;
            comm.Parameters.Add("@MusteriSoyad", SqlDbType.VarChar).Value = m._musteriSoyad;
            comm.Parameters.Add("@Telefon", SqlDbType.VarChar).Value = m._telefon;
            comm.Parameters.Add("@Adres", SqlDbType.VarChar).Value = m._adres;

            if (conn.State == ConnectionState.Closed)
                conn.Open();

            sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());

            conn.Close();

            return sonuc;
        }
 private void txtAdaGore_TextChanged(object sender, EventArgs e)
 {
     cMusteri m = new cMusteri();
     m.MusterileriGetirByAdaGore(txtAdaGore.Text, lvMusteriler);
 }