示例#1
0
        private void btnKullaniciEkle_Click(object sender, EventArgs e)
        {
            usersNewAdd._Name     = txtKullaniciOlusturAd.Text;
            usersNewAdd._Surname  = txtKullaniciOlusturSoyad.Text;
            usersNewAdd._GrupID   = usersNewAdd._GrupID;
            usersNewAdd._Username = txtKullaniciOlusturKullaniciAdi.Text;
            // // Hash
            var parola = SecurePasswordHasher.Hash(txtKullaniciOlusturSifre.Text);

            usersNewAdd._Password = parola.ToString();
            if (usersNewAdd.userInfo(usersNewAdd._Username)._UserID == 0)
            {
                bool result = usersNewAdd.userNewAdd();
                if (result)
                {
                    cGenel.genelUyari("Kullanıcı ekleme başarılı!", false);
                    txtKullaniciOlusturAd.Clear();
                    txtKullaniciOlusturKullaniciAdi.Clear();
                    txtKullaniciOlusturSoyad.Clear();
                    txtKullaniciOlusturSifre.Clear();
                    dropdownsUpdate();
                }
                else
                {
                    cGenel.genelUyari("Kullanıcı ekleme başarısız!", false);
                }
            }
            else
            {
                cGenel.genelUyari("Kullanıcı adı kullanımıştır!", false);
            }
        }
示例#2
0
        private void btnKullaniciGuncelle_Click(object sender, EventArgs e)
        {
            cUsers p = (cUsers)ddUserEditKullanicilar.SelectedItem;

            try
            {
                usersEdit._UserID = p._UserID;

                usersEdit._Name     = txtlKullaniciDuzenlemeAd.Text;
                usersEdit._Surname  = txtlKullaniciDuzenlemeSoyad.Text;
                usersEdit._Username = txtlKullaniciDuzenlemeKullaniciAdi.Text;

                cUserGrups u = (cUserGrups)ddUserEditUserGrup.SelectedItem;
                usersEdit._GrupID = u._GrupID;

                if (p.userInfo(usersEdit._Username)._UserID == 0 || (p.userInfo(usersEdit._Username)._UserID == usersEdit._UserID))
                {
                    bool result = usersEdit.userUpdate();
                    if (result)
                    {
                        cGenel.genelUyari("Kullanıcı güncelleme başarılı!", false);
                        txtlKullaniciDuzenlemeKullaniciAdi.Clear();
                        txtlKullaniciDuzenlemeSoyad.Clear();
                        txtlKullaniciDuzenlemeAd.Clear();
                        dropdownsUpdate();
                    }
                    else
                    {
                        cGenel.genelUyari("Kullanıcı güncelleme başarısız!", false);
                    }
                    dropdownsUpdate();
                }
                else
                {
                    cGenel.genelUyari("Girilen Kullanıcı adı tanımından bulunmaktadır.", false);
                }
            }
            catch (Exception)
            {
            }
        }