Ejemplo n.º 1
0
        private void btnSorgula_Click(object sender, EventArgs e)
        {
            try
            {
                SqlClass bgl = new SqlClass();

                SqlCommand komut = new SqlCommand();

                komut.Connection  = bgl.baglanti();
                komut.CommandText = "Select * from TblKullanici where ID=@ID AND KullaniciAdi=@KullaniciAdi";
                komut.Parameters.AddWithValue("@ID", ID.Text);
                komut.Parameters.AddWithValue("@KullaniciAdi", KullaniciAdi.Text);
                komut.ExecuteNonQuery();
                SqlDataReader dr = komut.ExecuteReader();
                if (dr.Read())
                {
                    GuvenlikSoru.Text = dr["GuvenlikSoru"].ToString();
                    panelgoster();
                    btntamam.Visible = false;
                }
                else
                {
                    MessageBox.Show("Kullanıcı Bulunamadı.");
                    Environment.Exit(0);
                }
                //baglanti.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void btnSil_Click(object sender, EventArgs e)
        {
            if (ID.Text.Trim() == "")
            {
                MessageBox.Show("Tablodan kayıt seçmediniz. Lütfen tablodan kayıt seçiniz", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }



            else
            {
                DialogResult cevap;
                cevap = MessageBox.Show(KullaniciAdi.Text + " " + "kullanıcısını silmek istediğinizden eminmisiniz?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Question);//silinme onayı için sorma hatalı kayıt silmenin önüne geçmek için.
                if (cevap == DialogResult.Yes)
                {
                    SqlClass   bgl   = new SqlClass();
                    SqlCommand komut = new SqlCommand();

                    komut.Connection  = bgl.baglanti();
                    komut.CommandText = "delete from TblKullanici where ID=" + ID.Text + "";
                    komut.ExecuteNonQuery();
                    MessageBox.Show("**SİLİNDİ**");
                    listele();
                    Temizle();
                }
            }
        }
Ejemplo n.º 3
0
        private void BtntxtSifrem_Click(object sender, EventArgs e)
        {
            try
            {
                SqlClass   bgl   = new SqlClass();
                SqlCommand komut = new SqlCommand();

                komut.Connection  = bgl.baglanti();
                komut.CommandText = "Select * from TblKullanici where GuvenlikSoru=@GuvenlikSoru AND GuvenlikCevap=@GuvenlikCevap";
                komut.Parameters.AddWithValue("@GuvenlikSoru", GuvenlikSoru.Text);
                komut.Parameters.AddWithValue("@GuvenlikCevap", GuvenlikCevap.Text);
                komut.ExecuteNonQuery();
                SqlDataReader dr = komut.ExecuteReader();
                if (dr.Read())
                {
                    sifre.Text = dr["Sifre"].ToString();
                    panelgoster();
                }
                else
                {
                    MessageBox.Show("Kullanıcı Bulunamadı.");
                    Environment.Exit(0);
                }
                //baglanti.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 4
0
        public void listele()
        {
            SqlClass bgl = new SqlClass();

            SqlDataAdapter da = new SqlDataAdapter("Select *from TblPrinters", bgl.baglanti());
            DataSet        ds = new DataSet();

            da.Fill(ds, "TblPrinters");
            dataGridView1.DataSource = ds.Tables["TblPrinters"];

            try
            {
                dataGridView1.SelectionMode         = DataGridViewSelectionMode.FullRowSelect;
                dataGridView1.Columns[0].HeaderText = "P.NO";//data gridviewdeki kolonları başlığı

                dataGridView1.Columns[1].HeaderText = "BELGE YAZICI";
                dataGridView1.Columns[2].HeaderText = "FİŞ YAZICI";

                dataGridView1.Columns[0].Width = 60;//datagridviewdeki kolonların genişliği
                dataGridView1.Columns[1].Width = 275;
                dataGridView1.Columns[2].Width = 275;
            }
            catch
            {
                ;
            }
        }
Ejemplo n.º 5
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            SqlClass       bgl = new SqlClass();
            SqlDataAdapter da  = new SqlDataAdapter("Select ID,KullaniciAdi,Yetki from TblKullanici where KullaniciAdi like '%" + textBox1.Text + "%' ", bgl.baglanti());
            DataSet        ds  = new DataSet();

            da.Fill(ds, "TblKullanici");

            dataGridView1.DataSource = ds.Tables["TblKullanici"];
        }
Ejemplo n.º 6
0
        private void btnGuncelleKaydet_Click(object sender, EventArgs e)
        {
            if (ID.Text == "" || KullaniciAdi.Text == "" || Yetki.Text == "")                                                 //tüm text alanları boş geçilirse
            {
                MessageBox.Show("Boş Alan Bırakmayınız", "Hata:Güvenlik Sorunu", MessageBoxButtons.OK, MessageBoxIcon.Error); //uyarı mesajı verdir
            }
            else

            {
                if (Sifre.Text == "" || GuvenlikSoru.Text == "" || GuvenlikCevap.Text == "")

                {
                    SqlClass   bgl   = new SqlClass();
                    SqlCommand komut = new SqlCommand();
                    komut.Connection  = bgl.baglanti();
                    komut.CommandText = "UPDATE TblKullanici SET KullaniciAdi='" + KullaniciAdi.Text + "',Yetki='" + Yetki.Text + "' WHERE ID=" + ID.Text + "";
                    komut.ExecuteNonQuery();
                    MessageBox.Show("**GÜNCELLENDİ**");
                    frmUserList fst = (frmUserList)Application.OpenForms["frmUserList"];
                    fst.listele();
                    fst.Temizle();
                    this.Close();
                }
                else
                {
                    SqlClass   bgl   = new SqlClass();
                    SqlCommand komut = new SqlCommand();
                    komut.Connection  = bgl.baglanti();
                    komut.CommandText = "UPDATE TblKullanici SET KullaniciAdi='" + KullaniciAdi.Text + "',Sifre='" + Sifre.Text + "',GuvenlikSoru='" + GuvenlikSoru.Text + "',GuvenlikCevap='" + GuvenlikCevap.Text + "',Yetki='" + Yetki.Text + "' WHERE ID=" + ID.Text + "";
                    komut.ExecuteNonQuery();
                    MessageBox.Show("**GÜNCELLENDİ**");
                    frmUserList fst = (frmUserList)Application.OpenForms["frmUserList"];
                    fst.listele();
                    fst.Temizle();
                    this.Close();
                }
            }
        }
Ejemplo n.º 7
0
        private void btnYeniKaydet_Click(object sender, EventArgs e)
        {
            if (ID.Text == "" || KullaniciAdi.Text == "" || Sifre.Text == "" || GuvenlikSoru.Text == "" || GuvenlikCevap.Text == "" || Yetki.Text == "") //tüm text alanları boş geçilirse
            {
                MessageBox.Show("Boş Alan Bırakmayınız", "Hata:Güvenlik Sorunu", MessageBoxButtons.OK, MessageBoxIcon.Error);                            //uyarı mesajı verdir
            }
            else
            {
                SqlClass   bgl   = new SqlClass();
                SqlCommand komut = new SqlCommand();
                komut.Connection  = bgl.baglanti();
                komut.CommandText = "INSERT INTO TblKullanici(ID,KullaniciAdi,Sifre,GuvenlikSoru,GuvenlikCevap,Yetki) VALUES ('" + ID.Text + "','" + KullaniciAdi.Text + "','" + Sifre.Text + "','" + GuvenlikSoru.Text + "','" + GuvenlikCevap.Text + "','" + Yetki.Text + "') ";
                komut.ExecuteNonQuery();



                MessageBox.Show("Kayıt İşlemi Tamamlandı ! ", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmUserList fst = (frmUserList)Application.OpenForms["frmUserList"];
                fst.listele();
                fst.Temizle();
                this.Close();
            }
        }
Ejemplo n.º 8
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (String.IsNullOrWhiteSpace(KullaniciAdi.Text) || String.IsNullOrWhiteSpace(Sifre.Text))
            {
                MessageBox.Show("Eksiksiz Giriniz!", " HATA ::..", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            try
            {
                SqlClass     bgl   = new SqlClass();
                string       sql   = "select * FROM TblKullanici WHERE KullaniciAdi=@KullaniciAdi AND Sifre=@Sifre";
                SqlParameter prms1 = new SqlParameter("@KullaniciAdi", KullaniciAdi.Text);
                SqlParameter prms2 = new SqlParameter("@Sifre", Sifre.Text);
                SqlCommand   cmd   = new SqlCommand(sql, bgl.baglanti());
                cmd.Parameters.Add(prms1);
                cmd.Parameters.Add(prms2);
                DataTable      dt = new DataTable();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);
                if (dt.Rows.Count != 0)

                {
                    frmana fas = new frmana();
                    fas.Show();

                    this.Visible = false;
                }
                else
                {
                    MessageBox.Show("Yanlış kullanıcı adı ve şifre", "..::HATA::..");
                    Environment.Exit(0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (pn.Text == "")
            {
                MessageBox.Show("Lütfen listeden seçim yapınız", "SEÇİM YAPMADINIZ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                SqlClass   bgl   = new SqlClass();
                SqlCommand komut = new SqlCommand();

                komut.Connection = bgl.baglanti();

                //cmd = new SQLiteCommand();
                //con.Open();
                //cmd.Connection = con;
                //OleDbCommand komut=new OleDbCommand("UPDATE stokbil SET stokAdi='" + textBox1.Text + "',stokModeli='" + textBox2.Text + "',stokSeriNo='" + textBox3.Text + "',stokAdedi='" + textBox4.Text + "',stokTarih='" + dateTimePicker1.Text + "',kayitYapan='" + textBox5.Text + "',dosyaAdi='" + DosyaAdi + "' WHERE id="+id,);
                komut.CommandText = "UPDATE TblPrinters SET belgePrint='" + belgePrint.Text + "',fisPrint='" + fisPrint.Text + "'WHERE pn=" + pn.Text + "";//update komutu
                komut.ExecuteNonQuery();

                MessageBox.Show("**GÜNCELLENDİ**");
                listele();
            }
        }
Ejemplo n.º 10
0
        public void listele()
        {
            SqlClass       bgl = new SqlClass();
            SqlDataAdapter da  = new SqlDataAdapter("Select ID,KullaniciAdi,Yetki from TblKullanici", bgl.baglanti());
            DataSet        ds  = new DataSet();

            da.Fill(ds, "TblKullanici");
            dataGridView1.DataSource = ds.Tables["TblKullanici"];

            try
            {
                dataGridView1.Columns[0].HeaderText = "T.C.NO";//data gridviewdeki kolonları başlığı

                dataGridView1.Columns[1].HeaderText = "KULLANICI ADI";
                dataGridView1.Columns[2].HeaderText = "YETKİ";
                dataGridView1.Columns[0].Width      = 225;//datagridviewdeki kolonların genişliği
                dataGridView1.Columns[1].Width      = 225;
                dataGridView1.Columns[2].Width      = 225;
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }