Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlBaglanti sql = new SqlBaglanti(ServerName);

            KullaniciBilgileri = sql.KullaniciOku();
            for (int i = 0; i < Convert.ToInt16(KullaniciBilgileri[3][0]); i++)
            {
                if (textBox1.Text.CompareTo(KullaniciBilgileri[0][i]) == 0 && textBox2.Text.CompareTo(KullaniciBilgileri[1][i]) == 0)
                {
                    KullaniciAdi = KullaniciBilgileri[2][i];
                    Personel_id  = Convert.ToInt16(KullaniciBilgileri[4][i]);
                    Form2 form2 = new Form2(ServerName);
                    this.Hide();
                    form2.ShowDialog();
                    this.Close();
                }
            }
        }
Exemple #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            Taployubastanolusturma();
            SqlBaglanti sql = new SqlBaglanti(ServerName);

            try
            {
                sql.KullaniciEkle("Vandellas", "24519551", "Mehmet", "1");
            }
            catch
            {
            }
            Yıllıkİzin();
            KullaniciBilgileri = sql.KullaniciOku();
            textBox1.Text      = "Vandellas";;
            textBox2.Text      = "24519551";
            SqlConnection myCon = new SqlConnection(BaglantiOlustur());
            string        personelotomasyonname = "";

            myCon.Open();
            SqlCommand    cmd = new SqlCommand("select * from personel_izin.dbo.Ayarlar", myCon);
            SqlDataReader dr  = cmd.ExecuteReader();

            while (dr.Read())
            {
                personelotomasyonname = dr["PersonelOtomasyonName"].ToString();
            }
            myCon.Close();
            if (personelotomasyonname == "")
            {
                SqlCommand sorgu = new SqlCommand();
                myCon.Open();
                sorgu.Connection  = myCon;
                sorgu.CommandText = "insert into personel_izin.dbo.Ayarlar(PersonelOtomasyonName)values(@Adi)";
                sorgu.Parameters.AddWithValue("@Adi", "Ahmet");
                sorgu.ExecuteNonQuery();
                myCon.Close();
            }
        }