protected override void OnBeforeDelete() { List <TbDetailJenisKegiatanRow> detail = Connection.List <TbDetailJenisKegiatanRow>(x => x.SelectTableFields().Where(string.Format("IdJenisKegiatan = {0}", Row.Id))); if (detail.Count > 0) { foreach (var item in detail) { if (item.NamaFile != null) { FileChanger.Delete(item.NamaFile); } if (item.Dokumentasi != null) { var resultFile = Newtonsoft.Json.JsonConvert.DeserializeObject <List <FileNameResult> >(item.Dokumentasi); foreach (var doc in resultFile) { FileChanger.Delete(doc.Filename); } } } this.Connection.Execute(string.Format("DELETE dbo.TbDetailJenisKegiatan WHERE IdJenisKegiatan = {0} ", this.Row.Id)); } }
protected override void OnBeforeDelete() { List <TbDetailJenisInformasiRow> detail = Connection.List <TbDetailJenisInformasiRow>(x => x.SelectTableFields().Where(string.Format("IdJenisInformasi = {0}", Row.Id))); if (detail.Count > 0) { foreach (var item in detail) { if (item.NamaFile != null) { FileChanger.Delete(item.NamaFile); } } this.Connection.Execute(string.Format("DELETE dbo.TbDetailJenisInformasi WHERE IdJenisInformasi = {0} ", this.Row.Id)); } }
protected override void OnBeforeDelete() { List <TbDetailPemiluRow> detail = Connection.List <TbDetailPemiluRow>(x => x.SelectTableFields().Where(string.Format("IdPemilu = {0}", Row.Id))); if (detail.Count > 0) { foreach (var item in detail) { this.Connection.Execute(string.Format("DELETE dbo.TbPollingPemilu WHERE IdDetailPemilu = {0} ", item.Id)); if (item.FileName != null) { FileChanger.Delete(item.FileName); } } this.Connection.Execute(string.Format("DELETE dbo.TbDetailPemilu WHERE IdPemilu = {0} ", this.Row.Id)); } if (Row.FileName != null) { FileChanger.Delete(Row.FileName); } }
internal void UserChoise() { while (true) { Console.WriteLine("Choose your action and write in console"); Console.WriteLine(); Console.WriteLine("\t If your wont delete smt in file write:"); Console.WriteLine("change"); Console.WriteLine(); Console.WriteLine("\t If your wont count words in file write:"); Console.WriteLine("count"); Console.WriteLine(); Console.WriteLine("\t If your wont wrap smt in file write:"); Console.WriteLine("wrap"); Console.WriteLine(); Console.WriteLine("\t If your wont to see files write:"); Console.WriteLine("file"); Console.WriteLine(); Console.WriteLine("if your wont to exit push q"); choise = Console.ReadLine(); switch (choise) { case "change": FileChanger test = new FileChanger(); test.Delete(); break; case "count": Word test1 = new Word(); break; case "wrap": Letters test2 = new Letters(); break; case "file": FileExplorer test3 = new FileExplorer(); test3.ProcessDirectory(); test3.SeeDirectories(); break; case "q": Console.WriteLine("Your decided exit"); break; default: Console.WriteLine("Invalid input"); break; } Console.ReadLine(); if (choise == "q") { break; } } }