Esempio n. 1
0
        public bool musteriBilgileriGüncelle(cMusteriler m)
        {
            bool result = false;


            SqlConnection con = new SqlConnection(gnl.conString);
            SqlCommand    cmd = new SqlCommand("Update musteriler set AD=@ad,SOYAD=@soyad,TELEFON=@telefon,ADRES=@adres,EMAIL=@email where ID=@musteriId ", con);

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                cmd.Parameters.Add("@ad", SqlDbType.VarChar).Value      = m._musteriad;
                cmd.Parameters.Add("@soyad", SqlDbType.VarChar).Value   = m._musterisoyad;
                cmd.Parameters.Add("@telefon", SqlDbType.VarChar).Value = m._telefon;
                cmd.Parameters.Add("@adres", SqlDbType.VarChar).Value   = m._adres;
                cmd.Parameters.Add("@email", SqlDbType.VarChar).Value   = m._email;
                cmd.Parameters.Add("@email", SqlDbType.VarChar).Value   = m._musteriid;
                result = Convert.ToBoolean(cmd.ExecuteNonQuery());
            }
            catch (Exception ex)
            {
                string hata = ex.Message;
            }
            finally
            {
                con.Dispose();
                con.Close();
            }

            return(result);
        }
Esempio n. 2
0
        public int musteriEkle(cMusteriler m)
        {
            int result = 0;


            SqlConnection con = new SqlConnection(gnl.conString);
            SqlCommand    cmd = new SqlCommand("Insert Into musteriler(AD,SOYAD,TELEFON,ADRES,EMAIL) " +
                                               "values(@ad,@soyad,@telefon,@adres,@email); select SCOPE_IDENTITY()", con);

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                cmd.Parameters.Add("@ad", SqlDbType.VarChar).Value      = m._musteriad;
                cmd.Parameters.Add("@soyad", SqlDbType.VarChar).Value   = m._musterisoyad;
                cmd.Parameters.Add("@telefon", SqlDbType.VarChar).Value = m._telefon;
                cmd.Parameters.Add("@adres", SqlDbType.VarChar).Value   = m._adres;
                cmd.Parameters.Add("@email", SqlDbType.VarChar).Value   = m._email;
                result = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                string hata = ex.Message;
            }
            finally
            {
                con.Dispose();
                con.Close();
            }

            return(result);
        }
Esempio n. 3
0
        private void btnGuncelle_Click(object sender, EventArgs e)
        {
            if (txtTelefon.Text.Length > 6)
            {
                if (txtMusteriAd.Text == " " || txtMusteriSoyad.Text == "")
                {
                    MessageBox.Show("Lütfen Müşterinin Ad ve Soyad Alanlarını doldurunuz.");
                }
                else
                {
                    cMusteriler c = new cMusteriler();

                    c.Musteriad    = txtMusteriAd.Text;
                    c.Musterisoyad = txtMusteriSoyad.Text;
                    c.Telefon      = txtTelefon.Text;
                    c.Email        = txtEmail.Text;
                    c.Adres        = txtAdres.Text;
                    c.Musteriid    = Convert.ToInt32(txtMusteriNo.Text);
                    bool result = c.musteriBilgileriGüncelle(c);


                    if (!result)
                    {
                        if (txtMusteriNo.Text != "")
                        {
                            MessageBox.Show("Müşteri güncellendi");
                        }
                        else
                        {
                            MessageBox.Show("Müşteri güncellenemedi!!!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Bu isimde bir kayıt var!!!");
                    }
                }
            }
            else
            {
                MessageBox.Show("Lütfen En az 7 haneli bir telefon numarası giriniz.");
            }
        }
Esempio n. 4
0
        private void frmMusteriAra_Load(object sender, EventArgs e)
        {
            cMusteriler c = new cMusteriler();

            c.musterileriGetir(lvMusteriler);
        }