Exemplo n.º 1
0
        private void button_LiStele_Click(object sender, EventArgs e)
        {
            string sorgu = "select  Marka,Model,Alis_Fiyati,Satis_Fiyati,Alis_Tarihi,Satis_Tarihi,Kar,Zarar from tbl_Arac where Marka = '" + comboBox_Marka.Text + "' AND Satis_Durumu = 1";

            System.Data.DataTable table = SqlConn.goster(sorgu);
            dataGridView1.DataSource = table;
        }
Exemplo n.º 2
0
        private void button_right_Click(object sender, EventArgs e)
        {
            if (satirbilgisi == null || satirbilgisi < 0 || satirbilgisi >= dtable.Rows.Count)
            {
                return;
            }

            string    sql   = " select  ftg.Fotograf_Uzanti,ftg.Sira,ftg.ProfilFotograf from tbl_Arac arc,tbl_Fotograf ftg where arc.Id=ftg.Arac_Id and arc.Id=" + dataGridView_Goster.Rows[satirbilgisi].Cells["Id"].Value.ToString();
            DataTable table = SqlConn.goster(sql);

            if (SqlConn.goster(sql).Rows.Count > 0)
            {
                int resimcount = SqlConn.goster(sql).Rows.Count;

                if (i <= resimcount - 1)
                {
                    if (table.Rows[i]["Fotograf_Uzanti"].ToString() != "")
                    {
                        pictureBox1.ImageLocation = Application.StartupPath + @"\photos\" + table.Rows[i]["Fotograf_Uzanti"].ToString();
                    }
                    i = i + 1;
                }
                else
                {
                    i = 0;
                }
            }
            else
            {
                pictureBox1.ImageLocation = "";
            }
        }
Exemplo n.º 3
0
        private void button_Satildi_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox_SatisFiyati.Text == "")
                {
                    MessageBox.Show("Araç satış bedeli girilmedi!");
                }
                else if (Convert.ToInt32(textBox_AlisFiyati.Text) > Convert.ToInt32(textBox_SatisFiyati.Text))
                {
                    int    hesapla = Convert.ToInt32(textBox_AlisFiyati.Text) - Convert.ToInt32(textBox_SatisFiyati.Text);
                    string insert  = "update  tbl_Arac set Zarar='" + hesapla + "', Kar='" + 0 + "' where Id = '" + textBox_id.Text + "'";
                    SqlConn.Islemler(insert);

                    string updatesatis = "update tbl_Arac set Satis_Durumu = 1, Satis_Fiyati ='" + textBox_SatisFiyati.Text + "',Satis_Tarihi = '" + dateTime_SatisTarihi.Text + "' where Id = '" + textBox_id.Text + "'";
                    SqlConn.Islemler(updatesatis);
                    MessageBox.Show("Araç satıldı olarak işaretlendi.");
                }
                else if (Convert.ToInt32(textBox_AlisFiyati.Text) < Convert.ToInt32(textBox_SatisFiyati.Text))
                {
                    int    hesapla = Convert.ToInt32(textBox_SatisFiyati.Text) - Convert.ToInt32(textBox_AlisFiyati.Text);
                    string insert  = "update  tbl_Arac set Kar='" + hesapla + "', Zarar='" + 0 + "' where Id = '" + textBox_id.Text + "'";
                    SqlConn.Islemler(insert);

                    string updatesatis = "update tbl_Arac set Satis_Durumu = 1, Satis_Fiyati ='" + textBox_SatisFiyati.Text + "',Satis_Tarihi = '" + dateTime_SatisTarihi.Text + "' where Id = '" + textBox_id.Text + "'";
                    SqlConn.Islemler(updatesatis);
                    MessageBox.Show("Araç satıldı olarak işaretlendi.");
                }
            }
            catch (Exception hata)
            {
                MessageBox.Show(hata.Message);
            }
        }
Exemplo n.º 4
0
        private void dataGridView_Goster_MouseClick(object sender, MouseEventArgs e)
        {
            satirbilgisi = dataGridView_Goster.HitTest(e.X, e.Y).RowIndex;

            if (satirbilgisi == null || satirbilgisi < 0 || satirbilgisi >= dtable.Rows.Count)
            {
                return;
            }

            string    islem = "select * from tbl_Arac where Id=" + dataGridView_Goster.Rows[satirbilgisi].Cells["Id"].Value.ToString();
            DataTable tbl   = SqlConn.goster(islem);

            textBox1.Text = tbl.Rows[0]["Detay_Ozellik"].ToString();

            string    sql   = " select  ftg.Fotograf_Uzanti,ftg.Sira,ftg.ProfilFotograf from tbl_Arac arc,tbl_Fotograf ftg where arc.Id=ftg.Arac_Id and arc.Id='" + dataGridView_Goster.Rows[satirbilgisi].Cells["Id"].Value.ToString() + "'and ftg.ProfilFotograf=1";
            DataTable table = SqlConn.goster(sql);

            if (SqlConn.goster(sql).Rows.Count > 0)
            {
                if (table.Rows[0]["Fotograf_Uzanti"].ToString() != "")
                {
                    pictureBox1.ImageLocation = Application.StartupPath + @"\photos\" + table.Rows[0]["Fotograf_Uzanti"].ToString();
                }
            }
            else
            {
                pictureBox1.ImageLocation = "";
            }
        }
Exemplo n.º 5
0
        private void dataGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            AracGuncelle aracgnc = new AracGuncelle();

            aracgnc.marka       = dataGridView1["Marka", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.model       = dataGridView1["Model", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.detay       = dataGridView1["Detay_Ozellik", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.alisfiyati  = dataGridView1["Alis_Fiyati", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.satisfiyati = dataGridView1["Satis_Fiyati", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.plaka       = dataGridView1["Plaka", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.id          = dataGridView1["Id", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.alistarihi  = dataGridView1["Alis_Tarihi", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.satistarihi = dataGridView1["Satis_Tarihi", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.satis_durum = dataGridView1["Satis_Durumu", dataGridView1.CurrentCell.RowIndex].Value.ToString();
            aracgnc.personelid  = personelid;

            string sorgu = "select * from tbl_Fotograf where Arac_Id=" + dataGridView1["Id", dataGridView1.CurrentCell.RowIndex].Value.ToString();

            aracgnc.resimtable = SqlConn.goster(sorgu);



            aracgnc.Show();
            this.Hide();
        }
Exemplo n.º 6
0
        private void btn_PersonelEkle_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox_PersonelParola.Text == textBox_ParolaTekrar.Text)
                {
                    string cinsiyett = "";
                    string yetki     = "";
                    if (checkBox_Erkek.Checked == (true))
                    {
                        cinsiyett = "E";
                    }
                    else if (checkBox_Kadin.Checked == (true))
                    {
                        cinsiyett = "K";
                    }
                    if (checkBox_SatisDep.Checked == (true))
                    {
                        yetki = "SD";
                    }
                    else if (checkBox_AlisDep.Checked == (true))
                    {
                        yetki = "AD";
                    }
                    else if (checkBox_Yonetici.Checked == (true))
                    {
                        yetki = "Y";
                    }
                    if (textBox_Email.Text == "" || textBox_PersonelAd.Text == "" || textBox_PersonelParola.Text == "" || textBox_PersonelSoyad.Text == "" || textBox_TCKN.Text == "")
                    {
                        MessageBox.Show("Alanlar boş olamaz.");
                    }
                    else
                    {
                        string sql = "insert into tbl_Personel(Ad,Soyad,TCKN,Parola,Yetki,Cinsiyet,Email) values('" + textBox_PersonelAd.Text + "','" + textBox_PersonelSoyad.Text + "','" + textBox_TCKN.Text + "','" + textBox_PersonelParola.Text + "','" + yetki + "','" + cinsiyett + "','" + textBox_Email.Text + "')";
                        SqlConn.Islemler(sql);

                        SqlConnection con = new SqlConnection("Data Source=DESKTOP-7L6TOHU;Initial Catalog=OtokondriOtomasyon;Persist Security Info=True;User ID=sa;Password=123456789");
                        con.Open();
                        SqlDataAdapter        adapter = new SqlDataAdapter("Select * from tbl_Personel", con);
                        System.Data.DataTable dtable  = new System.Data.DataTable();
                        adapter.Fill(dtable);
                        dataGridView_PersonelSil.DataSource = dtable;
                        con.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Parolalar Uyuşmuyor!");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Hata!");
            }
        }
Exemplo n.º 7
0
        private void PersonelPanel_Load(object sender, EventArgs e)
        {
            string    islem = "select Yetki from tbl_Personel where Email='" + personelid + "'";
            DataTable tbl   = SqlConn.goster(islem);

            if (tbl.Rows[0]["Yetki"].ToString() == "AD" || tbl.Rows[0]["Yetki"].ToString() == "SD")
            {
                button_PersonelIslemleri.Visible = false;
            }
        }
Exemplo n.º 8
0
        private void MarkaBaz_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            string sorguuu = "select distinct Marka from tbl_Arac";

            System.Data.DataTable tablee = SqlConn.goster(sorguuu);
            dataGridView2.DataSource = tablee;

            for (int i = 0; i < SqlConn.goster(sorguuu).Rows.Count; i++)
            {
                string marka = tablee.Rows[i]["Marka"].ToString();

                comboBox_Marka.Items.Add(marka);
            }

            dataGridView2.Visible = false;
        }
Exemplo n.º 9
0
        private void button_Listele_Click(object sender, EventArgs e)
        {
            try
            {
                string tarih1 = dateTimePicker1.Text;
                string tarih2 = dateTimePicker2.Text;

                string sorgu = @"select Marka,Model,Alis_Fiyati,Satis_Fiyati,Alis_Tarihi,Satis_Tarihi,Kar,Zarar
                             from tbl_Arac 
                             where convert(datetime,Satis_Tarihi,104) between convert(datetime,'" + tarih1 + "',104) and convert(datetime,'" + tarih2 + "',104) AND Satis_Durumu = 1";
                System.Data.DataTable table = SqlConn.goster(sorgu);
                dataGridView1.DataSource = table;
            }
            catch (Exception)
            {
                MessageBox.Show("Hata!!");
            }
        }
Exemplo n.º 10
0
        private void btn_Sil_Click(object sender, EventArgs e)
        {
            DialogResult sil = new DialogResult();

            sil = MessageBox.Show("Silmek istediğinizden emin misiniz ?", "Uyarı",
                                  MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
            if (sil == DialogResult.Yes)
            {
                string    fotodosyasil = "select Fotograf_Uzanti from tbl_Fotograf where Arac_Id='" + textBox_id.Text + "'";
                DataTable dtbl         = SqlConn.goster(fotodosyasil);

                string hedef = Application.StartupPath + @"\photos\";

                for (int i = 0; i < SqlConn.goster(fotodosyasil).Rows.Count; i++)
                {
                    string uzanti = dtbl.Rows[i]["Fotograf_Uzanti"].ToString();
                    if (System.IO.File.Exists(@hedef + uzanti))
                    {
                        System.IO.File.Delete(@hedef + uzanti);
                    }
                }

                string deletefoto = "delete from tbl_Fotograf WHERE Arac_Id='" + textBox_id.Text + "'";
                SqlConn.Islemler(deletefoto);

                try
                {
                    string deletearac = "delete from tbl_Arac WHERE Id='" + textBox_id.Text + "'";
                    SqlConn.Islemler(deletearac);
                    MessageBox.Show("Araç silindi.");
                }
                catch (Exception)
                {
                    MessageBox.Show("Hata!!");
                }
            }
            else if (sil == DialogResult.No)
            {
                MessageBox.Show("iptal edildi.");
            }
        }
Exemplo n.º 11
0
        private void PersonelPanel_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            string    islem = "select Yetki from tbl_Personel where Email='" + personelid + "'";
            DataTable tbl   = SqlConn.goster(islem);

            perid = tbl.Rows[0]["Yetki"].ToString();

            if (tbl.Rows[0]["Yetki"].ToString() == "AD")
            {
                button_PersonelIslemleri.Visible = false;
                button_Raporlar.Visible          = false;
            }
            if (tbl.Rows[0]["Yetki"].ToString() == "SD")
            {
                button_PersonelIslemleri.Visible = false;
                button_AracEkleSil.Visible       = false;
                button_Raporlar.Visible          = false;
            }
        }
Exemplo n.º 12
0
        private void button_Kaydet_Click(object sender, EventArgs e)
        {
            string    sorgu = "select Random from ParolaYenile where Personel_Id='" + id + "' and Durum = '" + 'A' + "'";
            DataTable tbl   = SqlConn.goster(sorgu);

            if (textBox_Random.Text == tbl.Rows[0]["Random"].ToString())
            {
                if (textBox_Parola.Text == textBox_ParolaTekrar.Text)
                {
                    //string sorguu = "select Durum from ParolaYenile where Personel_Id='"+id+"' and Durum = '"+'A'+"'";
                    //DataTable dtbl = SqlConn.goster(sorguu);

                    string guncelle = "Update tbl_Personel set  Parola='" + textBox_Parola.Text + "' where Id='" + id + "'";
                    try
                    {
                        SqlConn.Islemler(guncelle);
                        MessageBox.Show("Güncelleme Başarili.");
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Hata!!");
                    }

                    string guncelleepsota = "update ParolaYenile set GuncellemeTarihi='" + DateTime.Now.ToShortDateString() + "',Durum ='" + "P" + "' where Personel_Id=" + id;
                    SqlConn.Islemler(guncelleepsota);

                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Şifreler Uyuşmuyor!!");
                }
            }
            else
            {
                MessageBox.Show("Parola yenileme kodu yanlış.");
            }
        }
Exemplo n.º 13
0
 private void btn_Sil_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult cikis = new DialogResult();
         cikis = MessageBox.Show("Silmek istediğinizden emin misiniz ?", "Uyarı",
                                 MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
         if (cikis == DialogResult.Yes)
         {
             string a     = textBox_TCKN.Text;
             string komut = "delete from tbl_Personel WHERE TCKN='" + textBox_TCKN.Text + "'";
             SqlConn.Islemler(komut);
         }
         else if (cikis == DialogResult.No)
         {
             MessageBox.Show("iptal edildi.");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Hata!");
     }
 }
Exemplo n.º 14
0
        private void btn_Guncelle_Click(object sender, EventArgs e)
        {
            try
            {
                string cinsiyett = "";
                string yetkii    = "";
                if (checkBox_Erkek.Checked == (true))
                {
                    cinsiyett = "E";
                }
                else if (checkBox_Kadin.Checked == (true))
                {
                    cinsiyett = "K";
                }

                if (checkBox_SatisDep.Checked == (true))
                {
                    yetkii = "SD";
                }
                else if (checkBox_AlisDep.Checked == (true))
                {
                    yetkii = "AD";
                }
                else if (checkBox_Yonetici.Checked == (true))
                {
                    yetkii = "Y";
                }

                string komut = " UPDATE tbl_Personel SET Ad = '" + textBox_PersonelAd.Text + "', Soyad ='" + textBox_PersonelSoyad.Text + "', TCKN = '" + textBox_TCKN.Text + "', Parola = '" + textBox_PersonelParola.Text + "',Yetki = '" + yetkii + "', Cinsiyet ='" + cinsiyett + "',Email='" + email + "'  WHERE Id = '" + id + "'";
                SqlConn.Islemler(komut);
                MessageBox.Show("Personel bilgileri güncellendi.");
            }
            catch (Exception)
            {
                MessageBox.Show("Hata");
            }
        }
Exemplo n.º 15
0
        private void btn_SifremiUnuttumGonder_Click(object sender, EventArgs e)
        {
            Random        rastgele = new Random();
            StringBuilder sb       = new StringBuilder();

            for (int i = 0; i < 8; i++)
            {
                int ascii = rastgele.Next(32, 127);
                karakter = Convert.ToChar(ascii);
                sb.Append(karakter);
            }

            Random deneme  = new Random();
            string harfler = "ABCDEFGHIJKLMNOPRSTUVYZabcdefghijklmnoprstuvyz1234567890";
            string uret    = "";

            for (int i = 0; i < 6; i++)
            {
                uret += harfler[deneme.Next(harfler.Length)];
            }


            MailMessage ePosta = new MailMessage();

            ePosta.From = new MailAddress("*****@*****.**");
            ePosta.To.Add(textBox_Eposta.Text);
            ePosta.Subject = "parola yenile";
            ePosta.Body    = "Parola yenileme kodunuz : " + uret.ToString();
            SmtpClient smtp = new SmtpClient();

            smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "otokondri123");
            smtp.Port        = 587;
            smtp.Host        = "smtp.gmail.com";
            smtp.EnableSsl   = true;
            object userState = ePosta;
            bool   kontrol   = true;

            try
            {
                smtp.SendAsync(ePosta, (object)ePosta);
                MessageBox.Show("Mail gönderildi.");
            }
            catch (SmtpException ex)
            {
                kontrol = false;
                System.Windows.Forms.MessageBox.Show(ex.Message, "Mail Gönderme Hatasi");
            }



            string islem = "select Id from tbl_Personel where Email = '" + textBox_Eposta.Text + "'";
            string id    = SqlConn.Id_Deger(islem);


            string insrt = "insert into ParolaYenile(Random,Personel_Id)values('" + uret + "','" + id + "')";

            SqlConn.Islemler(insrt);

            SifreYenileme ynl = new SifreYenileme();

            ynl.id = id;

            ynl.Show();
            this.Hide();
        }
Exemplo n.º 16
0
        private void button_AracEkleme_Click(object sender, EventArgs e)
        {
            try
            {
                string aracinsert = "insert into tbl_Arac(Marka,Model,Detay_Ozellik,Alis_Tarihi,Alis_Fiyati,Plaka) values('" + textBox_Marka.Text + "','" + textBox_Model.Text + "','" + textBox_AracEkleDetay.Text + "','" + dateTime_AlisTarihi.Text + "','" + int.Parse(textBox_AlisFiyati.Text) + "','" + textBox_Plaka.Text + "')SELECT SCOPE_IDENTITY();";
                id = SqlConn.Id_Deger(aracinsert);
                MessageBox.Show("İşlem Başarılı.");
            }
            catch (Exception)
            {
                MessageBox.Show("Hata!!");
            }


            if (textBox_FotoUzanti1.Text != "")
            {
                dosyaismi = Path.GetFileName(dosyayolu1);
                string kaynak = dosyayolu1;
                string hedef  = Application.StartupPath + @"\photos\";
                yeniad = textBox_Plaka.Text + "_1.jpg";

                string fotografinsert = "insert into tbl_Fotograf(Fotograf_Uzanti,Arac_Id,Sira,ProfilFotograf) values('" + yeniad + "','" + id + "','" + 1 + "','" + 1 + "')";
                SqlConn.Islemler(fotografinsert);
                File.Copy(kaynak, hedef + yeniad);
            }


            if (textBox_FotoUzanti2.Text != "")
            {
                dosyaismi = Path.GetFileName(dosyayolu2);
                string kaynak = dosyayolu2;
                string hedef  = Application.StartupPath + @"\photos\";
                yeniad = textBox_Plaka.Text + "_2.jpg";

                string fotografinsert = "insert into tbl_Fotograf(Fotograf_Uzanti,Arac_Id,Sira) values('" + yeniad + "','" + id + "','" + 2 + "')";
                SqlConn.Islemler(fotografinsert);
                File.Copy(kaynak, hedef + yeniad);
            }

            if (textBox_FotoUzanti3.Text != "")
            {
                dosyaismi = Path.GetFileName(dosyayolu3);
                string kaynak = dosyayolu3;
                string hedef  = Application.StartupPath + @"\photos\";
                yeniad = textBox_Plaka.Text + "_3.jpg";

                string fotografinsert = "insert into tbl_Fotograf(Fotograf_Uzanti,Arac_Id,Sira) values('" + yeniad + "','" + id + "','" + 3 + "')";
                SqlConn.Islemler(fotografinsert);
                File.Copy(kaynak, hedef + yeniad);
            }

            if (textBox_FotoUzanti4.Text != "")
            {
                dosyaismi = Path.GetFileName(dosyayolu4);
                string kaynak = dosyayolu4;
                string hedef  = Application.StartupPath + @"\photos\";
                yeniad = textBox_Plaka.Text + "_4.jpg";

                string fotografinsert = "insert into tbl_Fotograf(Fotograf_Uzanti,Arac_Id,Sira) values('" + yeniad + "','" + id + "','" + 4 + "')";
                SqlConn.Islemler(fotografinsert);
                File.Copy(kaynak, hedef + yeniad);
            }

            SqlConnection con = new SqlConnection("Data Source=DESKTOP-7L6TOHU;Initial Catalog=OtokondriOtomasyon;Persist Security Info=True;User ID=sa;Password=123456789");

            con.Open();
            SqlDataAdapter adapter = new SqlDataAdapter("Select Marka, Model,Detay_Ozellik,Alis_Tarihi,Alis_Fiyati,Satis_Tarihi,Satis_Fiyati from tbl_Arac", con);
            DataTable      dtable  = new DataTable();

            adapter.Fill(dtable);
            dataGridView_AracSilListe.DataSource = dtable;
            con.Close();
        }
Exemplo n.º 17
0
        private void btn_Guncelle_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox_FotoUzanti1.Text != uzanti1)
                {
                    //sildik
                    string hedef = Application.StartupPath + @"\photos\";
                    if (System.IO.File.Exists(@hedef + uzanti1))
                    {
                        System.IO.File.Delete(@hedef + uzanti1);
                    }
                    //ekledik
                    dosyaismi = Path.GetFileName(dosyayolu1);
                    string kaynak = dosyayolu1;
                    yeniad = textBox_Plaka.Text.ToString() + "_1.jpg";
                    string deneme = textBox_Plaka.Text;


                    string fotografinsert = "update tbl_Fotograf set Fotograf_Uzanti='" + yeniad + "',Arac_Id='" + textBox_id.Text + "',Sira='" + 1 + "',ProfilFotograf='" + 1 + "' where Sira='" + 1 + "'";
                    SqlConn.Islemler(fotografinsert);
                    File.Copy(kaynak, hedef + yeniad);
                }
                //***************************************************************************************
                if (textBox_FotoUzanti2.Text != uzanti2)
                {
                    //sildik
                    string hedef = Application.StartupPath + @"\photos\";
                    if (System.IO.File.Exists(@hedef + uzanti2))
                    {
                        System.IO.File.Delete(@hedef + uzanti2);
                    }
                    //ekledik
                    dosyaismi = Path.GetFileName(dosyayolu2);
                    string kaynak = dosyayolu2;
                    yeniad = textBox_Plaka.Text + "_2.jpg";

                    string fotografinsert = "update tbl_Fotograf set Fotograf_Uzanti='" + yeniad + "',Arac_Id='" + textBox_id.Text + "',Sira='" + 2 + "' where Sira='" + 2 + "'";
                    SqlConn.Islemler(fotografinsert);
                    File.Copy(kaynak, hedef + yeniad);
                }
                //***************************************************************************************
                if (textBox_FotoUzanti3.Text != uzanti3)
                {
                    //sildik
                    string hedef = Application.StartupPath + @"\photos\";
                    if (System.IO.File.Exists(@hedef + uzanti3))
                    {
                        System.IO.File.Delete(@hedef + uzanti3);
                    }


                    //ekledik
                    dosyaismi = Path.GetFileName(dosyayolu3);
                    string kaynak = dosyayolu3;
                    yeniad = textBox_Plaka.Text + "_3.jpg";

                    string fotografinsert = "update tbl_Fotograf set Fotograf_Uzanti='" + yeniad + "',Arac_Id='" + textBox_id.Text + "',Sira='" + 3 + "' where Sira='" + 3 + "'";
                    SqlConn.Islemler(fotografinsert);
                    File.Copy(kaynak, hedef + yeniad);
                }
                //***************************************************************************************
                if (textBox_FotoUzanti4.Text != uzanti4)
                {
                    //sildik
                    string hedef = Application.StartupPath + @"\photos\";
                    if (System.IO.File.Exists(@hedef + uzanti4))
                    {
                        System.IO.File.Delete(@hedef + uzanti4);
                    }
                    //ekledik
                    dosyaismi = Path.GetFileName(dosyayolu4);
                    string kaynak = dosyayolu4;
                    yeniad = textBox_Plaka.Text + "_4.jpg";

                    string fotografinsert = "update tbl_Fotograf set Fotograf_Uzanti='" + yeniad + "',Arac_Id='" + textBox_id.Text + "',Sira='" + 4 + "' where where Sira='" + 4 + "'";
                    SqlConn.Islemler(fotografinsert);
                    File.Copy(kaynak, hedef + yeniad);
                }

                string komut = " UPDATE tbl_Arac SET Marka = '" + textBox_Marka.Text + "', Model ='" + textBox_Model.Text + "', Detay_Ozellik = '" + textBox_Detay.Text + "', Alis_Fiyati = '" + textBox_AlisFiyati.Text + "',Satis_Fiyati = '" + textBox_SatisFiyati.Text + "',Alis_Tarihi = '" + dateTime_AlisTarihi.Text + "',Satis_Tarihi = '" + dateTime_SatisTarihi.Text + "',Plaka ='" + textBox_Plaka.Text + "' WHERE Id = '" + textBox_id.Text + "'";
                SqlConn.Islemler(komut);
                MessageBox.Show("Güncelleme başarılı.");
            }
            catch (Exception)
            {
                MessageBox.Show("Hata!!");
            }
        }
Exemplo n.º 18
0
        private void button_Loginn(object sender, EventArgs e)
        {
            SqlConnection con;
            SqlCommand    cmd;
            SqlDataReader dr;

            string user = textBox_Personelid.Text;
            string pass = textBox_PersonelParola.Text;

            string islem = "select Id from tbl_Personel where Email = '" + textBox_Personelid.Text + "'";
            string id    = SqlConn.Id_Deger(islem);

            try
            {
                string    sorgu = "select Durum from ParolaYenile where Personel_Id='" + id + "' and Durum= '" + 'A' + "'";
                DataTable dtbl  = SqlConn.goster(sorgu);
                string    durum = dtbl.Rows[0]["Durum"].ToString();;

                if (durum == "A")
                {
                    MessageBox.Show("Daha önce parola yenileme isteği yolladınız, Lütfen mailinizi kontrol ediniz.");
                    SifreYenileme sfr = new SifreYenileme();
                    sfr.id = id;
                    sfr.Show();
                    //this.Hide();
                }

                else
                {
                    con = new SqlConnection("Data Source=DESKTOP-7L6TOHU;Initial Catalog=OtokondriOtomasyon;Persist Security Info=True;User ID=sa;Password=123456789");
                    cmd = new SqlCommand();
                    con.Open();
                    cmd.Connection  = con;
                    cmd.CommandText = "SELECT * FROM tbl_Personel where Email='" + textBox_Personelid.Text + "' AND Parola='" + textBox_PersonelParola.Text + "'";
                    dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        PersonelPanel PersonelPanelsec = new PersonelPanel();
                        PersonelPanelsec.personelid = textBox_Personelid.Text;
                        PersonelPanelsec.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Email veya şifrenizi kontrol ediniz.");
                    }
                    con.Close();
                }
            }
            catch
            {
                con = new SqlConnection("Data Source=DESKTOP-7L6TOHU;Initial Catalog=OtokondriOtomasyon;Persist Security Info=True;User ID=sa;Password=123456789");
                cmd = new SqlCommand();
                con.Open();
                cmd.Connection  = con;
                cmd.CommandText = "SELECT * FROM tbl_Personel where Email ='" + textBox_Personelid.Text + "' AND Parola='" + textBox_PersonelParola.Text + "'";
                dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    PersonelPanel PersonelPanelsec = new PersonelPanel();
                    PersonelPanelsec.personelid = textBox_Personelid.Text;
                    PersonelPanelsec.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Email veya şifrenizi kontrol ediniz.");
                }
                con.Close();
            }
        }