private void exceleaktar_Click(object sender, EventArgs e) { DialogResult soru = new DialogResult(); soru = MessageBoxOperation.MessageBoxQuestion("Tablodaki veriler EXCEL'e aktarılacak . Devam etmek istiyor musunuz."); Hata.tryCatch(() => { if (soru == DialogResult.Yes) { Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application(); excel.Visible = true; object Missing = Type.Missing; Workbook workbook = excel.Workbooks.Add(Missing); Worksheet sheet1 = (Worksheet)workbook.Sheets[1]; int StartCol = 1; int StartRow = 1; for (int j = 0; j < dgwParolaListe.Columns.Count; j++) { Range myRange = (Range)sheet1.Cells[StartRow, StartCol + j]; myRange.Value2 = dgwParolaListe.Columns[j].HeaderText; } StartRow++; for (int i = 0; i < dgwParolaListe.Rows.Count; i++) { for (int j = 0; j < dgwParolaListe.Columns.Count; j++) { Range myRange = (Range)sheet1.Cells[StartRow + i, StartCol + j]; myRange.Value2 = dgwParolaListe[j, i].Value == null ? "" : dgwParolaListe[j, i].Value; myRange.Select(); } } } }); }
private void btnEnter_Click(object sender, EventArgs e) { if (txtPassword.Text == "4817") { this.Close(); } else { MessageBoxOperation.MessageBoxError("Hatalı parola girdiniz."); txtPassword.Text = ""; txtPassword.Focus(); } }
void tryCatchBlock(Action action) { try { driver = new ChromeDriver(); drivers.Add(driver); action.Invoke(); } catch (Exception exception) { //throw exception; MessageBoxOperation.MessageBoxError(exception.Message); } }
private void Delete_Click(object sender, EventArgs e) { Parola parola = lblParolaListe.SelectedItem as Parola; if (parola != null) { ParolaEdit delete = new ParolaEdit(parola, Operations.Delete); delete.ShowDialog(); } else { MessageBoxOperation.MessageBoxWarning("Herhangi bir parola seçmediniz.İşleme devam edilemiyor."); } LoadingForm(); }
private void Update_Click(object sender, EventArgs e) { //guncelleme işlemi Parola parola = lblParolaListe.SelectedItem as Parola; if (parola != null) { parolaEdit = new ParolaEdit(parola, Operations.Update); parolaEdit.ShowDialog(); } else { MessageBoxOperation.MessageBoxWarning("Herhangi bir parola seçmediniz.İşleme devam edilemiyor."); } }
private void BtnJsonBackup_Click(object sender, EventArgs e) { string folderPath = FileOperation.FolderPath(); if (!string.IsNullOrEmpty(folderPath)) { var liste = _bll.GetAll(); var mailParola = liste.Where(I => I.isim == "gmail").SingleOrDefault(); string stringliste = JsonOperation.JsonSerialize(liste); string backupTime = DateTime.Now.ToShortDateString(); string SavePath = folderPath + "\\" + backupTime + "_passwords.json"; //Backup tarihini bir dosyaya kayıt ediyoruz. System.IO.File.WriteAllText(SavePath, stringliste); MessageBoxOperation.MessageBoxInformation($"Yedekleme işlemi gerçekleşti.\n{SavePath} adresini kontrol ediniz."); } }
private void BtnJsonRestore_Click(object sender, EventArgs e) { List <string> etkilenenKayitlar = new List <string>(); List <Parola> Parolalar = null; string path = FileOperation.FilePath(); if (!string.IsNullOrEmpty(path)) { string JsonOkunanData = System.IO.File.ReadAllText(path); Parolalar = JsonOperation.JsonDeserialize <Parola>(JsonOkunanData); } if (Parolalar != null && !string.IsNullOrEmpty(Parolalar[0].kullaniciadi) && !string.IsNullOrEmpty(Parolalar[0].isim) && !string.IsNullOrEmpty(Parolalar[0].parola_) && !string.IsNullOrEmpty(Parolalar[0].parola_)) { foreach (var parola in Parolalar) { //gelen koleksiyondaki verileri veritabanına kaydetmek için kod yazılabilir. //ilgili değer kayıt ve update işlemleri yapılacaktır. //business tarafında metotlar oluşturulup eklenecek.. string etkilenenenKayit = _bll.RestoreFromJsonToDatabase(parola); if (etkilenenenKayit != "") { etkilenenKayitlar.Add(etkilenenenKayit); } } MessageBoxOperation.MessageBoxInformation("Restore işlemi bitmiştir..."); RestoreKayitlar restoreKayitlar = new RestoreKayitlar(etkilenenKayitlar); restoreKayitlar.Show(); } else { //koleksiyon null değerde geldiği için herhangi bir işlem yapmıyoruz. MessageBoxOperation.MessageBoxWarning("Koleksiyon null değer almıştır.İlgili json dosyasından herhangi bir değer AKTARILAMAMIŞTIR."); } Listele(); }