private void button3_Click(object sender, EventArgs e)
        {
            KullaniciTanimlari kullaniciTanimlari = new KullaniciTanimlari();

            kullaniciTanimlari.Show();
            this.Hide();
        }
Ejemplo n.º 2
0
        private void pictureBox8_Click(object sender, EventArgs e)
        {
            KullaniciTanimlari ktanimlari = new KullaniciTanimlari();

            ktanimlari.Show();
            this.Hide();
        }
        private void btn_guncelle_Click(object sender, EventArgs e)
        {
            Regex reg = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");

            if (!reg.IsMatch(textBox3.Text))
            {
                MessageBox.Show("Geçersiz Mail Adresi");
                return;
            }
            string    kontrol  = "Select KullaniciAdi,Resim from Kullanici where KullaniciId='" + kid + "'";
            DataTable kntrltbl = DataBase.select(kontrol);



            if (textBox4.Text != kntrltbl.Rows[0]["KullaniciAdi"].ToString())
            {
                string kullaniciadivarmi = "Select * from Kullanici where KullaniciAdi='" + textBox4.Text + "'";
                if (DataBase.select(kullaniciadivarmi).Rows.Count > 0)
                {
                    MessageBox.Show("Kullanıcı Adı Mevcut");
                    return;
                }
            }

            if (textBox6.Text != kntrltbl.Rows[0]["Resim"].ToString())
            {
                string        path    = Application.StartupPath + @"\resimler\";
                DirectoryInfo di      = new DirectoryInfo(path);
                FileInfo[]    rgFiles = di.GetFiles();
                foreach (FileInfo fi in rgFiles)
                {
                    //fi.Name bize dosyanın adını dönüyor.
                    //fi.FullName ise bize dosyasının dizin bilgisini döner.


                    if (fi.Name == kntrltbl.Rows[0]["Resim"].ToString())
                    {
                        File.Delete(path + kntrltbl.Rows[0]["Resim"].ToString());
                    }
                }
            }



            dosyaAdi = Path.GetFileName(dosyaYolu); //Dosya adını alma
            string kaynak = dosyaYolu;
            string hedef  = Application.StartupPath + @"\resimler\";
            string yeniad = textBox4.Text + ".jpg"; //Benzersiz isim verme

            if (textBox6.Text != "")
            {
                if (kyet.Checked && uyet.Checked && uyet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Resim='" + yeniad + "',Kyet=1,Uyet=1,Myet=1 where KullaniciId=" + kid;
                }
                else if (kyet.Checked && uyet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Resim='" + yeniad + "',Kyet=1,Uyet=1,Myet=0 where KullaniciId=" + kid;
                }
                else if (kyet.Checked && myet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Resim='" + yeniad + "',Kyet=1,Uyet=0,Myet=1 where KullaniciId=" + kid;
                }
                else if (uyet.Checked && myet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Resim='" + yeniad + "',Kyet=0,Uyet=1,Myet=1 where KullaniciId=" + kid;
                }
                else if (kyet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Resim='" + yeniad + "',Kyet=1,Uyet=0,Myet=0 where KullaniciId=" + kid;
                }
                else if (uyet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Resim='" + yeniad + "',Kyet=0,Uyet=1,Myet=0 where KullaniciId=" + kid;
                }
                else if (myet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Resim='" + yeniad + "',Kyet=0,Uyet=0,Myet=1 where KullaniciId=" + kid;
                }
                else
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Resim='" + yeniad + "',Kyet=0,Uyet=0,Myet=0 where KullaniciId=" + kid;
                }


                File.Copy(kaynak, hedef + yeniad);

                DataBase.ExecSql(sql);
            }

            else
            {
                if (kyet.Checked && uyet.Checked && uyet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Kyet=1,Uyet=1,Myet=1 where KullaniciId=" + kid;
                }
                else if (kyet.Checked && uyet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Kyet=1,Uyet=1,Myet=0 where KullaniciId=" + kid;
                }
                else if (kyet.Checked && myet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Kyet=1,Uyet=0,Myet=1 where KullaniciId=" + kid;
                }
                else if (uyet.Checked && myet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Kyet=0,Uyet=1,Myet=1 where KullaniciId=" + kid;
                }
                else if (kyet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Kyet=1,Uyet=0,Myet=0 where KullaniciId=" + kid;
                }
                else if (uyet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Kyet=0,Uyet=1,Myet=0 where KullaniciId=" + kid;
                }
                else if (myet.Checked)
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Kyet=0,Uyet=0,Myet=1 where KullaniciId=" + kid;
                }
                else
                {
                    sql = "UPDATE Kullanici set Adi='" + textBox1.Text + "',Soyadi='" + textBox2.Text + "',Email='" + textBox3.Text + "',KullaniciAdi='" + textBox4.Text + "',Sifre='" + textBox5.Text + "',Kyet=0,Uyet=0,Myet=0 where KullaniciId=" + kid;
                }



                DataBase.ExecSql(sql);
            }

            MessageBox.Show("Güncellendi..");
            KullaniciTanimlari kullaniciTanimlari = new KullaniciTanimlari();

            kullaniciTanimlari.Show();
            this.Hide();
        }