//показ базы паролей private void Button_Click_ShowDB(object sender, RoutedEventArgs e) { //работа с Excel //if (File.Exists(save.FileName)) //{ // Process.Start(save.FileName); //} //else //{ // MessageBox.Show("Not file!"); //} DataBaseWorker.Conection(); List <string[]> mas = DataBaseWorker.GetData("SELECT * FROM DBPass", 4); Info info = new Info(); if (mas != null) { foreach (var item in mas) { info.a = item[1]; info.b = item[2]; info.v = item[3]; listDB.Items.Add(info); } Grid_ListView.Visibility = Visibility.Visible; } else { MessageBox.Show("DataBase is empty!"); } DataBaseWorker.CloseConection(); }
// поиск сайта по базе private void Find(object sender, RoutedEventArgs e) { //работа с Excel //save.XLWb = save.XApp.Workbooks.Open(save.FileName); //save.Worksheet = save.XLWb.Sheets[1]; //string data = SearchSite.Text; //string Site = ""; //string Login = ""; //string Pas = ""; //int i = 2; //int g = 1; //bool flag = false; // while (save.Worksheet.Cells[i, g].Value2!=null) // { // if (save.Worksheet.Cells[i, g].Value2 == data) // { // Site = save.Worksheet.Cells[i, g].Value2; // Login = save.Worksheet.Cells[i, g+1].Value2; // Pas = save.Worksheet.Cells[i, g + 2].Value2; // TBSite.Text = Site; // TBLogin.Text = Login; // PBPass.Password = Pas; // flag = true; // break; // } // i++; // } //if (flag!=true) //{ // MessageBox.Show("Not found"); //} //SearchSite.Text = "What to find?"; //save.XLWb.Close(true); DataBaseWorker.Conection(); List <string[]> mas = DataBaseWorker.GetData("SELECT * FROM DBPass", 4); bool flag = false; foreach (var item in mas) { if (item[1] == SearchSite.Text) { TBSite.Text = item[1]; TBLogin.Text = item[2]; PBPass.Password = item[3]; flag = true; break; } } if (flag == false) { MessageBox.Show("Not found", "Attantion", MessageBoxButton.OK, MessageBoxImage.Error); } DataBaseWorker.CloseConection(); }
private void App_ServerChanged(object sender, EventArgs e) { if (DataBaseWorker.GetData(App.Server).Count != 0) { RefillFilterCheckBoxes(); } FilterMod.Clear(); RefillFilterCheckBoxes(); }