private void dologinBtn_Click(object sender, RoutedEventArgs e)
        {
            LoginData loginData = new LoginData();
            loginData.userName = userNameTxtbox.Text;
            loginData.password = passwordBox.Password;
            loginData.type = (UserTypeEnum)Enum.Parse(typeof(UserTypeEnum), userTypeCombobox.Text, true);

            bool loginStatus = MmmDb.DbInteraction.DoMmmLogin(loginData);
            dologinBtn.IsEnabled = !loginStatus;
            dologoutBtn.IsEnabled = loginStatus;
        }
        private static bool FetcheLoginData(LoginData loginData)
        {
            bool returnVal = false;

            MySql.Data.MySqlClient.MySqlConnection msqlConnection = null;

            msqlConnection = new MySql.Data.MySqlClient.MySqlConnection("server=localhost;user id=root;Password=technicise;database=Mmm_mb;persist security info=False");
            try
            {   //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();
                msqlCommand.Connection = msqlConnection;

                msqlConnection.Open();

                msqlCommand.CommandText = "Select password,type from login_details where user_name = @userName;";
                msqlCommand.Parameters.AddWithValue("@userName", loginData.userName);
                MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();

                msqlReader.Read();

                string password = msqlReader.GetString("password");
                string type = msqlReader.GetString("type");

                if (loginData.password.Equals(password) && loginData.type.ToString().Equals(type))
                    returnVal = true;
            }
            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }

            return returnVal;
        }
 public static bool DoMmmLogin(LoginData loginData)
 {
     return FetcheLoginData(loginData);
 }