Пример #1
0
        public PinKoduFormu(string yapilacakIslemNe, AdminGirisFormu adminFormu)
        {
            InitializeComponent();

            this.adminFormu = adminFormu;

            yapilacakIslem = yapilacakIslemNe;

            this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
            this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
        }
Пример #2
0
        public ModemFormu(AdminGirisFormu adminForm)
        {
            InitializeComponent();

            this.adminForm = adminForm;

            this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
            this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;

            //açılışta capslock açıksa kapatıyoruz.
            ToggleCapsLock(false);

            textboxSSID.Text = Properties.Settings.Default.SSID;
            textBoxSifre.Text = Properties.Settings.Default.SSIDPass;

            textboxSSID.Select(0, textboxSSID.TextLength);
        }
Пример #3
0
        private void girisButtonPressed(object sender, EventArgs e)
        {
            if (adminForm == null)
            {
                if (!File.Exists("tempfiles.xml")) // ilk açılışta veya bir sıkıntı sonucu kategoriler dosyası silinirse kendi default kategorilerimizi giriyoruz.
                {
                    infoKullanici = new UItemp[1];

                    infoKullanici[0] = new UItemp();
                    infoKullanici[0].UIN = (new UnicodeEncoding()).GetBytes("Adınız");
                    infoKullanici[0].UIS = (new UnicodeEncoding()).GetBytes("Soy Adınız");
                    infoKullanici[0].UIUN = (new UnicodeEncoding()).GetBytes("admin");
                    infoKullanici[0].UIU = (new UnicodeEncoding()).GetBytes("Yönetici");

                    infoKullanici[0].UIPN = PasswordHash.CreateHash("0000");
                    infoKullanici[0].UIPW = PasswordHash.CreateHash("00000");
                    infoKullanici[0].UIY[0] = PasswordHash.CreateHash("true");
                    infoKullanici[0].UIY[1] = PasswordHash.CreateHash("true");
                    infoKullanici[0].UIY[2] = PasswordHash.CreateHash("true");
                    infoKullanici[0].UIY[3] = PasswordHash.CreateHash("true");
                    infoKullanici[0].UIY[4] = PasswordHash.CreateHash("true");

                    XmlSave.SaveRestoran(infoKullanici, "tempfiles.xml");

                    File.SetAttributes("tempfiles.xml", FileAttributes.Archive);
                }
                XmlLoad<UItemp> loadInfoKullanicilar = new XmlLoad<UItemp>();
                infoKullanici = loadInfoKullanicilar.LoadRestoran("tempfiles.xml");

                string[] username = new string[1];
                username[0] = userNameTextBox.getNameText(); //name lazım olduğunda al
                string password = passwordTextBox.getPasswordText(); //password lazım olduğunda al

                int kullaniciAdi = -5;

                if (username[0] == "ropisimiz" && password == "roproprop")
                {
                    XmlSave.SaveRestoran(username, "sonKullanici.xml");

                    try
                    {
                        Task reportTask = Task.Factory.StartNew(
                            () =>
                            {
                                adminForm = new AdminGirisFormu(this, true);
                                adminForm.ShowDialog();
                            }
                            , CancellationToken.None
                            , TaskCreationOptions.None
                            , TaskScheduler.FromCurrentSynchronizationContext()
                            );

                        reportTask.Wait();
                    }
                    catch
                    { }

                    //Task.Factory.StartNew(() => adminForm.ShowDialog());
                    //adminForm.Show();
                }
                else
                {
                    for (int i = 0; i < infoKullanici.Count(); i++)
                    {
                        if (username[0] == (new UnicodeEncoding()).GetString(infoKullanici[i].UIUN))
                        {
                            kullaniciAdi = i;
                            break;
                        }
                    }
                    if (kullaniciAdi != -5)
                    {
                        //bool flag = Helper.VerifyHash(password, "SHA512", infoKullanici[kullaniciAdi].UIPW);

                        bool flag = PasswordHash.ValidatePassword(password, infoKullanici[kullaniciAdi].UIPW);

                        bool adisyonDegistirebilirMi = false;

                        if (PasswordHash.ValidatePassword("true", infoKullanici[kullaniciAdi].UIY[3]))
                            adisyonDegistirebilirMi = true;

                        if (flag == true)
                        { //şifre doğru
                            XmlSave.SaveRestoran(username, "sonKullanici.xml");

                            try
                            {
                                Task reportTask = Task.Factory.StartNew(
                                    () =>
                                    {
                                        adminForm = new AdminGirisFormu(this, adisyonDegistirebilirMi);

                                        adminForm.ShowDialog();
                                    }
                                    , CancellationToken.None
                                    , TaskCreationOptions.None
                                    , TaskScheduler.FromCurrentSynchronizationContext()
                                    );

                                reportTask.Wait();
                            }
                            catch
                            { }
                            //Task.Factory.StartNew(() => adminForm.ShowDialog());
                        }
                        else
                        {
                            KontrolFormu dialog2 = new KontrolFormu("Yanlış kullanıcı adı/şifre girdiniz", false);
                            dialog2.Show();
                        }
                    }
                    else
                    {
                        KontrolFormu dialog2 = new KontrolFormu("Yanlış kullanıcı adı/şifre girdiniz", false);
                        dialog2.Show();
                    }
                }

                userNameTextBox = new WPF_UserControls.VerticalCenterTextBox();
                usernameBoxHost.Child = userNameTextBox;
                passwordTextBox = new WPF_UserControls.VerticalCenterPasswordBox();
                passwordBoxHost.Child = passwordTextBox;
            }
            else
            {
                this.SendToBack();
            }
        }