예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (isLogged)
     {
         isStaff  = false;
         isLogged = false;
         HelloLabel.Hide();
         loggedUser         = "";
         loggedUserLastName = "";
         LogInButton.Text   = "Log in";
         //connectionString = "Server=localhost;Port=3306;Database=sakila;Uid=client;Pwd=$3cr3t;";
         staffImage.Show();
     }
     else
     {
         if (UserTextBox.Text == "guest" && PaswordTextBox.Text == "123")
         {
             connectionString        = "Server=localhost;Port=3306;Database=sakila;Uid=staff;Pwd=$up3r$3cr3t;";
             isStaff                 = true;
             isLogged                = true;
             LogInButton.Text        = "Log out";
             tabControl1.SelectedTab = FilmsTab;
             loggedUserLastName      = "guest";
             HelloLabel.Text         = "hello mr. " + loggedUserLastName;
             HelloLabel.Show();
             //staffImage.Visible = !staffImage.Visible;
         }
         else
         {
             List <string>   users      = new List <string>();
             MySqlConnection connection = new MySqlConnection(connectionString);
             string          sql        = $"SELECT last_name FROM staff WHERE first_name = '{UserTextBox.Text}';";
             users = connection.Query <string>(sql).ToList();
             if (users.Count() != 0 && PaswordTextBox.Text == "456")
             {
                 isStaff                 = true;
                 isLogged                = true;
                 LogInButton.Text        = "Log out";
                 tabControl1.SelectedTab = FilmsTab;
                 staffImage.Hide();
                 loggedUser         = UserTextBox.Text;
                 loggedUserLastName = users.FirstOrDefault().ToString();
                 HelloLabel.Text    = "hello mr. " + loggedUserLastName;
                 HelloLabel.Show();
             }
             connection.Close();
         }
     }
 }
예제 #2
0
        void ReleaseDesignerOutlets()
        {
            if (HelloLabel != null)
            {
                HelloLabel.Dispose();
                HelloLabel = null;
            }

            if (mybutton != null)
            {
                mybutton.Dispose();
                mybutton = null;
            }

            if (NameTextView != null)
            {
                NameTextView.Dispose();
                NameTextView = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (HelloLabel != null)
            {
                HelloLabel.Dispose();
                HelloLabel = null;
            }

            if (logo2 != null)
            {
                logo2.Dispose();
                logo2 = null;
            }

            if (MainImage != null)
            {
                MainImage.Dispose();
                MainImage = null;
            }

            if (ModeLable != null)
            {
                ModeLable.Dispose();
                ModeLable = null;
            }

            if (ModeSwitch != null)
            {
                ModeSwitch.Dispose();
                ModeSwitch = null;
            }

            if (testButton != null)
            {
                testButton.Dispose();
                testButton = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (CenterDesc != null)
            {
                CenterDesc.Dispose();
                CenterDesc = null;
            }

            if (CenterTitle != null)
            {
                CenterTitle.Dispose();
                CenterTitle = null;
            }

            if (CenterView != null)
            {
                CenterView.Dispose();
                CenterView = null;
            }

            if (CloseSessionButton != null)
            {
                CloseSessionButton.Dispose();
                CloseSessionButton = null;
            }

            if (CloseSessionLabel != null)
            {
                CloseSessionLabel.Dispose();
                CloseSessionLabel = null;
            }

            if (ContactDataDescripLabel != null)
            {
                ContactDataDescripLabel.Dispose();
                ContactDataDescripLabel = null;
            }

            if (ContactDataTitleLabel != null)
            {
                ContactDataTitleLabel.Dispose();
                ContactDataTitleLabel = null;
            }

            if (ContactDataView != null)
            {
                ContactDataView.Dispose();
                ContactDataView = null;
            }

            if (HealthDataDescripLabel != null)
            {
                HealthDataDescripLabel.Dispose();
                HealthDataDescripLabel = null;
            }

            if (HealthDataTitleLabel != null)
            {
                HealthDataTitleLabel.Dispose();
                HealthDataTitleLabel = null;
            }

            if (HealthDataView != null)
            {
                HealthDataView.Dispose();
                HealthDataView = null;
            }

            if (HelloLabel != null)
            {
                HelloLabel.Dispose();
                HelloLabel = null;
            }

            if (labeVersion != null)
            {
                labeVersion.Dispose();
                labeVersion = null;
            }

            if (LanguageButton != null)
            {
                LanguageButton.Dispose();
                LanguageButton = null;
            }
        }