Пример #1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            string username   = TbUsername.Text;
            string password   = TbPassword.Text;
            string errMessage = "";

            if (Glob.CheckLogin(username, password))
            {
                OpenMainForm();
            }
            else
            {
                errMessage = "Please try again";
            }
            Lblerr.Text = errMessage;
        }
Пример #2
0
 private void TsmiDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (LvPassword.SelectedItems.Count > 0) // checkt of een regel geselecteerd is
         {
             int     index        = LvPassword.Items.IndexOf(LvPassword.SelectedItems[0]);
             DataRow selectedData = (DataRow)LvPassword.SelectedItems[0].Tag;
             Glob.DeleteRow(selectedData);
             RefreshDataInList();
         }
     }
     catch (IndexOutOfRangeException _IORE)
     {
         MessageBox.Show("Regel niet gevonden in de data");
     }
 }
Пример #3
0
        private void BtnWeetjes_Click(object sender, EventArgs e)
        {
            if (TbCMain.SelectedTab != TbCMain.TabPages["TbpWeetjes"])
            {
                TbCMain.SelectedTab = TbCMain.TabPages["TbpWeetjes"];

                TmrDefaultSizeNav.Enabled = true;
                TmrDefaultSizeNav.Start();
                TmrDefaultSizeNav.Interval = 1;
            }

            Database DBinstance = new Database(); // used for the weetjes tab to get the tostring overrride method.

            LblLaatsteDataRegel.Text        = Glob.Datas.Last().ToString();
            LblHuidigeGebruiker.Text        = Glob.CurrentLoggedInUser.ToString();
            LblDatabaseConnectieString.Text = DBinstance.ToString();

            LblAantalGebruikers.Text              = Glob.ReturnAmountUsers().ToString();
            LblAantalRegelsOpgeslagen.Text        = Glob.ReturnAmountDataRows().ToString();
            LblLongestUsernameWithMostRights.Text = Glob.ReturnLongestUsernameMostRights().ToString();
            LblAantalWachtwoordenMatch.Text       = Glob.ReturnAmountPasswordMatch().ToString();
        }
Пример #4
0
        /// <summary>
        /// zoek in de listview naar de patroon die opgegeven is
        /// </summary>
        /// <param name="pattern"></param>
        private void SearchInList(string pattern)
        {
            indeces = new HashSet <int>();
            if (pattern.Length > 0)
            {
                for (int i = 0; i < Glob.Datas.Count(); i++)
                {
                    ListViewItem CurrItem = itemsC[i];
                    Console.WriteLine(itemsC[i]);

                    if (Glob.maybeMatch(CurrItem.Text, pattern) || Glob.maybeMatch(CurrItem.SubItems[1].Text, pattern) || Glob.maybeMatch(CurrItem.SubItems[2].Text, pattern))
                    {
                        if (!indeces.Contains(i))
                        {
                            indeces.Add(i);
                        }
                        Console.WriteLine("Index added: " + i);
                        Console.WriteLine("count" + indeces.Count);
                    }
                }

                this.LvPassword.Items.Clear();
                foreach (var index in indeces)
                {
                    Console.WriteLine("The index: " + index + " is in the array");
                    this.LvPassword.Items.Add(itemsC[index]);
                }
            }
            else
            {
                RefreshDataInList();
                indeces.Clear();
                Console.WriteLine("Indces cleared!");
            }
        }