18 Ocak 2018 Perşembe

C# using Login ekranı


C# using kullanımı


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FirmaOtomasyonuDesktop
{
    public partial class fLogin : Form
    {
        public fLogin()
        {
            InitializeComponent();
        }

        private void biptal_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void bGiris_Click(object sender, EventArgs e)
        {
            kullaniciDenetle();
        }

        private void kullaniciDenetle()
        {
            try
            {
                string kullaniciAdi = eKullanıcıAdı.Text;
                string sifre = eSifre.Text;
                if (kullaniciAdi.Length <= 0 || sifre.Length <= 0)
                {
                    MessageBox.Show("Kullanıcı adı veya Şifre Boş olamaz !", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                using (SqlConnection baglanti = new SqlConnection())
                {
                    baglanti.ConnectionString = "Data Source=127.0.0.1; Initial Catalog=HELLOSQL; User id=sa; Password=2002;";
                    baglanti.Open();
                    string Query = string.Format("SELECT * FROM KULLANICILAR WHERE KULLANICIADI='{0}' AND SIFRESI='{1}'", kullaniciAdi, sifre);
                    using (SqlCommand Cmd = new SqlCommand(Query, baglanti))
                    {
                        using (SqlDataReader Rdr = Cmd.ExecuteReader())
                        {
                            if (Rdr.Read())
                            {
                                AppStatics.aktifKullanici = new kullaniciDataItem(
                                    AppUtil.ToInt(Rdr["ID"]),
                                    AppUtil.ToStr(Rdr["KULLANICIADI"]),
                                    AppUtil.ToStr(Rdr["SIFRESI"]),
                                    AppUtil.ToStr(Rdr["ADISOYADI"]),
                                    AppUtil.ToInt(Rdr["YETKI"]));

                                MessageBox.Show("Hoşgeldin" + AppStatics.aktifKullanici.kullanciAdi);
                            }
                            else
                            {
                                MessageBox.Show("Kullancı adı veya şifreniz hatalıdır !");
                            }
                    }
                }
            }

         }

            catch (Exception ex)
            {

                MessageBox.Show("Veri tabani Bağlantisi sağlanırken beklenmedik bir hata oluştu !\n" + ex.Message, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
           
        }
    }
}

Hiç yorum yok:

Yorum Gönder

Mac adres formatı excel

excel iki nokta mac addres formatı Mac adresi karakterlerini üst üste iki nokta : iki nokta üst üste olacak şekilde excel dosyasında ayırır....