16 Ocak 2018 Salı

Kullanici Giriş ekranı 1

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;
                }

                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 SIFRE='{1}'", kullaniciAdi, sifre);

                SqlCommand Cmd = new SqlCommand(Query, baglanti);
                SqlDataReader Rdr = Cmd.ExecuteReader();

                if (Rdr.Read())
                {
                    AppStatics.kullaniciAdı = Rdr["KULLANICIADI"].ToString();
                    AppStatics.kullaniciAdiSoyadi = Rdr["ADISOYADI"].ToString();
                    AppStatics.kullaniciId = Convert.ToInt32(Rdr["ID"]);
                    AppStatics.kullaniciSifre = Rdr["SIFRE"].ToString();
                    AppStatics.loginTime = DateTime.Now;
                    MessageBox.Show("Hoşgeldiniz " +  AppStatics.kullaniciAdiSoyadi);
                }
                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....