Example #1
0
        private void bLogin_Click(object sender, EventArgs e)
        {
            if ((tbUserName.Text ==admin) && (tbPassword.Text == adminPass))
            {
                // Key : LoggedUser - Value : Admin - Section : Login
                INI.Write("LoggedUser", "Admin", "Login");
                // Key : LoggedDate - Value : Login Date - Section : Login
                INI.Write("LoggedDate", DateTime.UtcNow.ToLocalTime().ToString(), "Login");
                UserLog.UserName = "******";
                UserLog.WConsole("Succesfully Logged In");
                tbPassword.BackColor = Color.Green;
                tbUserName.BackColor = Color.Green;
                Thread.Sleep(2500);
                this.BackgroundImage = Properties.Resources.BACK_4_Success;
                this.Refresh();
                Thread.Sleep(1000);
                MainForm main = new MainForm();
                main.Show();
                this.Hide();
            }else
            {
                UserLog.UserName = "******";
                UserLog.WConsole("Invalid Password or Username");
                tbPassword.BackColor = Color.Red;
                tbUserName.BackColor = Color.Red;
                MessageBox.Show("Lütfen kullanıcı adınızı ve şifrenizi kontrol edip tekrar deneyiniz!");
                this.BackgroundImage = Properties.Resources.BACK_4_Fail;

            }
        }
Example #2
0
        private void key_press(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                if ((tbUserName.Text == admin) && (tbPassword.Text == adminPass))
                {
                    // Key : LoggedUser - Value : Admin - Section : Login
                    INI.Write("LoggedUser", "Admin", "Login");
                    // Key : LoggedDate - Value : Login Date - Section : Login
                    INI.Write("LoggedDate", DateTime.UtcNow.ToLocalTime().ToString(), "Login");
                    UserLog.UserName = "******";
                    UserLog.WConsole("Succesfully Logged In (KeyPressed)");
                    this.BackgroundImage = Properties.Resources.BACK_4_Success;
                    this.Refresh();
                    Thread.Sleep(1000);
                    MainForm main = new MainForm();
                    main.Show();
                    //  DebugMonitor debug = new DebugMonitor();
                    //  debug.Show();

                    this.Hide();
                }
                else if (tbUserName.Text == "")
                {
                    //MailActivation md = new MailActivation();
                    //md.Show();
                    // Key : LoggedUser - Value : Admin - Section : Login
                    INI.Write("LoggedUser", "Admin", "Login");
                    // Key : LoggedDate - Value : Login Date - Section : Login
                    INI.Write("LoggedDate", DateTime.UtcNow.ToLocalTime().ToString(), "Login");
                    UserLog.UserName = "******";
                    UserLog.WConsole("Succesfully Logged In (Admin_Pirate)");
                    this.BackgroundImage = Properties.Resources.BACK_4_Success;
                    this.Refresh();
                    Thread.Sleep(1000);
                    MainForm main = new MainForm();
                    main.Show();
                    //  DebugMonitor debug = new DebugMonitor();
                    //  debug.Show();

                    this.Hide();
                }
                else if ((tbUserName.Text == user) && (tbPassword.Text == userPass))
                {
                    // Key : LoggedUser - Value : Admin - Section : Login
                    INI.Write("LoggedUser", "Guest", "Login");
                    // Key : LoggedDate - Value : Login Date - Section : Login
                    INI.Write("LoggedDate", DateTime.UtcNow.ToLocalTime().ToString(), "Login");
                    UserLog.UserName = "******";
                    UserLog.WConsole("Succesfully Logged In (User_Pirate)");
                    this.BackgroundImage = Properties.Resources.BACK_4_Success;
                    this.Refresh();
                    Thread.Sleep(1000);
                    MainForm main = new MainForm();
                    main.Show();
                    this.Hide();
                }
                else
                {
                    tbPassword.BackColor = Color.Red;
                    tbUserName.BackColor = Color.Red;
                    MessageBox.Show("Lütfen kullanıcı adınızı ve şifrenizi kontrol edip tekrar deneyiniz!");
                    this.BackgroundImage = Properties.Resources.BACK_4_Fail;
                }
            }
            else if (e.KeyChar == (char)Keys.Escape)
            {
                this.Close();
            }
        }