public bool MusteriKontrolByGuncelle(cMusteriSatici ms)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("Select * from MusteriSatici where Silindi=0 and MusteriSaticiAd=@MusteriSaticiAd and MusteriSaticiSoyad=@MusteriSaticiSoyad and Telefon=@Telefon and MusteriSaticiID != @MusteriSaticiID", conn);

            comm.Parameters.Add("@MusteriSaticiAd", SqlDbType.VarChar).Value    = ms.MusteriSaticiAd;
            comm.Parameters.Add("@MusteriSaticiSoyad", SqlDbType.VarChar).Value = ms.MusteriSaticiSoyad;
            comm.Parameters.Add("@Telefon", SqlDbType.VarChar).Value            = ms.Telefon;
            comm.Parameters.Add("@MusteriSaticiID", SqlDbType.Int).Value        = ms.MusteriSaticiID;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                SqlDataReader dr;
                dr = comm.ExecuteReader();
                while (dr.Read())
                {
                    Sonuc = true;
                }
                dr.Close();
            }
            catch (SqlException hata)
            {
                string Mesaj = hata.Message;
            }

            finally { conn.Close(); }
            return(Sonuc);
        }
        public bool MusteriGuncelle(cMusteriSatici ms)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("update MusteriSatici set MusteriSaticiAd=@MusteriSaticiAd, MusteriSaticiSoyad=@MusteriSaticiSoyad, Telefon=@Telefon, Mail=@Mail where MusteriSaticiID=@MusteriSaticiID", conn);

            comm.Parameters.Add("@MusteriSaticiAd", SqlDbType.VarChar).Value    = ms.MusteriSaticiAd;
            comm.Parameters.Add("@MusteriSaticiSoyad", SqlDbType.VarChar).Value = ms.MusteriSaticiSoyad;
            comm.Parameters.Add("@Telefon", SqlDbType.VarChar).Value            = ms.Telefon;
            comm.Parameters.Add("@Mail", SqlDbType.VarChar).Value        = ms.Mail;
            comm.Parameters.Add("@MusteriSaticiID", SqlDbType.Int).Value = ms.MusteriSaticiID;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                Sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
            return(Sonuc);
        }
 private void btnSil_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("Silmek istiyor musunuz?", "Silinsin mi?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             cMusteriSatici ms    = new cMusteriSatici();
             bool           Sonuc = Convert.ToBoolean(ms.MusteriSaticiSil(Convert.ToInt32(txtMusteriSaticiID.Text)));
             if (Sonuc)
             {
                 MessageBox.Show("Müşteri bilgileri silindi!", "Dikkat!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 dgvMusteriSatici.DataSource = ms.MusteriSaticiGoster();
                 Temizle();
                 btnEkle.Enabled = true;
             }
             else
             {
                 MessageBox.Show("Silme gerçekleşmedi!", "  HATA !!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (SqlException hata)
     {
         string mesaj = hata.Message;
     }
 }
        public List <cMusteriSatici> MusteriSaticiGoster()
        {
            SqlCommand            comm  = new SqlCommand("select MusteriSaticiID,MusteriSaticiAd,MusteriSaticiSoyad,Telefon,Mail from MusteriSatici where Silindi=0", conn);
            List <cMusteriSatici> liste = new List <cMusteriSatici>();

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr = comm.ExecuteReader();

            while (dr.Read())
            {
                cMusteriSatici ms = new cMusteriSatici();
                ms.MusteriSaticiID    = Convert.ToInt32(dr["MusteriSaticiID"]);
                ms.MusteriSaticiAd    = dr["MusteriSaticiAd"].ToString();
                ms.MusteriSaticiSoyad = dr["MusteriSaticiSoyad"].ToString();
                ms.Telefon            = dr["Telefon"].ToString();
                ms.Mail = dr["Mail"].ToString();
                liste.Add(ms);
            }
            dr.Close();
            conn.Close();
            return(liste);
        }
        public bool MusteriSaticiKontrol(cMusteriSatici ms)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("select * from MusteriSatici where Silindi=0 and MusteriSaticiAd=@MusteriSaticiAd and MusteriSaticiSoyad=@MusteriSaticiSoyad and MusteriSaticiID != @MusteriSaticiID", conn);

            comm.Parameters.Add("@MusteriSaticiAd", SqlDbType.VarChar).Value    = ms.MusteriSaticiAd;
            comm.Parameters.Add("@MusteriSaticiSoyad", SqlDbType.VarChar).Value = ms.MusteriSaticiSoyad;
            comm.Parameters.Add("@MusteriSaticiID", SqlDbType.Int).Value        = ms.MusteriSaticiID;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                SqlDataReader dr = comm.ExecuteReader();
                if (dr.HasRows)
                {
                    Sonuc = true;
                }
                dr.Close();
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }

            conn.Close();
            return(Sonuc);
        }
Exemple #6
0
        private void btnEmlakSahibiGit_Click(object sender, EventArgs e)
        {
            frmMusteriSatici frm = new frmMusteriSatici();

            frm.ShowDialog();
            cMusteriSatici ms = new cMusteriSatici();

            cbEmlakSahibi.Items.Clear();
            ms.EmlakSahibiGetir(cbEmlakSahibi);
        }
Exemple #7
0
        private void frmArsaKayit_Load(object sender, EventArgs e)
        {
            cMusteriSatici ms = new cMusteriSatici();

            ms.EmlakSahibiGetir(cbEmlakSahibi);

            txtIlanID.Text             = cGenel.ilanID.ToString();
            cbEmlakSahibi.SelectedItem = cGenel.emlakSahibi;
            txtAdres.Text         = cGenel.adres;
            txtil.Text            = cGenel.il;
            txtFiyat.Text         = cGenel.fiyat.ToString();
            dtpEklenmeTarihi.Text = cGenel.eklenmeTarihi;
            txtMetrekare.Text     = cGenel.metrekare.ToString();
        }
        private void frmIsyeriKayit_Load(object sender, EventArgs e)
        {
            cMusteriSatici m = new cMusteriSatici();

            m.MusteriSaticiGoster(cbEmlakSahibi);


            txtIlanID.Text             = (cGenel.ilanID).ToString();
            cbEmlakSahibi.SelectedItem = cGenel.emlakSahibi;
            cbIslemTuru.SelectedItem   = cGenel.islemTuru;
            txtMetrekare.Text          = (cGenel.metrekare).ToString();
            txtil.Text            = cGenel.il;
            txtAdres.Text         = cGenel.adres;
            txtFiyat.Text         = (cGenel.fiyat).ToString();
            dtpEklenmeTarihi.Text = cGenel.eklenmeTarihi;
        }
 private void btnGuncelle_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtAdi.Text) || string.IsNullOrEmpty(txtSoyadi.Text) || string.IsNullOrEmpty(mtxtTelefon.Text))
     {
         MessageBox.Show("Emlak Sahibi adı, soyadı ve telefonu boş geçemezsiniz!", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtAdi.Focus();
     }
     else
     {
         cMusteriSatici ms = new cMusteriSatici();
         ms.MusteriSaticiID    = Convert.ToInt32(txtMusteriSaticiID.Text);
         ms.MusteriSaticiAd    = txtAdi.Text;
         ms.MusteriSaticiSoyad = txtSoyadi.Text;
         ms.Telefon            = mtxtTelefon.Text;
         ms.Mail = txtMail.Text;
         if (ms.MusteriKontrolByGuncelle(ms))
         {
             MessageBox.Show("Bu emlak sahibi önceden kayıtlı.", "Zaten Mevcut!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtAdi.Focus();
         }
         else
         {
             if (ms.MusteriGuncelle(ms))
             {
                 MessageBox.Show("Emlak sahibi güncellendi.", "Değişiklik Gerçekleştirildi.");
                 dgvMusteriSatici.DataSource = ms.MusteriSaticiGoster();
                 Temizle();
                 btnGuncelle.Enabled = false;
                 btnSil.Enabled      = false;
                 btnEkle.Enabled     = true;
                 txtAdi.Focus();
             }
             else
             {
                 MessageBox.Show("Güncelleme gerçekleşmedi!"); txtAdi.Focus();
             }
         }
     }
 }
        private void btnEkle_Click_1(object sender, EventArgs e)
        {
            if (txtAdi.Text.Trim() != "" && txtSoyadi.Text.Trim() != "" && mtxtTelefon.Text.Trim() != "")
            {
                cMusteriSatici ms = new cMusteriSatici();

                ms.MusteriSaticiAd    = txtAdi.Text;
                ms.MusteriSaticiSoyad = txtSoyadi.Text;
                ms.Telefon            = mtxtTelefon.Text;
                ms.Mail = txtMail.Text;

                if (ms.MusteriSaticiKontrol(ms))
                {
                    MessageBox.Show("Bu müşteri zaten kayıtlı.");
                    txtAdi.Focus();
                }
                else
                {
                    if (ms.MusteriSaticiEkle(ms))
                    {
                        MessageBox.Show("Müşteri kayıt işlemi gerçekleştirildi!", "KAYIT EDİLDİ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Temizle();
                        dgvMusteriSatici.DataSource = ms.MusteriSaticiGoster();
                    }
                    else
                    {
                        MessageBox.Show("Kayıt gerçekleştirilemedi.", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtAdi.Focus();
                    }
                }
            }
            else
            {
                MessageBox.Show("Emlak Sahibi adı, soyadı ve telefonu boş geçemezsiniz!", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAdi.Focus();
            }
        }
        public bool MusteriSaticiEkle(cMusteriSatici ms)
        {
            bool       Sonuc = false;
            SqlCommand comm  = new SqlCommand("insert into MusteriSatici(MusteriSaticiAd,MusteriSaticiSoyad,Telefon,Mail) values(@MusteriSaticiAd,@MusteriSaticiSoyad,@Telefon,@Mail)", conn);

            comm.Parameters.Add("@MusteriSaticiAd", SqlDbType.VarChar).Value    = ms.MusteriSaticiAd;
            comm.Parameters.Add("@MusteriSaticiSoyad", SqlDbType.VarChar).Value = ms.MusteriSaticiSoyad;
            comm.Parameters.Add("@Telefon", SqlDbType.VarChar).Value            = ms.Telefon;
            comm.Parameters.Add("@Mail", SqlDbType.VarChar).Value = ms.Mail;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                Sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());
            }
            catch (SqlException ex)
            {
                string Hata = ex.Message;
            }
            finally { conn.Close(); }
            return(Sonuc);
        }
        private void frmIsyeriKayit_Load(object sender, EventArgs e)
        {
            cMusteriSatici m = new cMusteriSatici();

            m.MusteriSaticiGoster(cbEmlakSahibi);
        }
        private void frmMusteriSatici_Load(object sender, EventArgs e)
        {
            cMusteriSatici cm = new cMusteriSatici();

            dgvMusteriSatici.DataSource = cm.MusteriSaticiGoster();
        }