private void button2_Click(object sender, EventArgs e) { var fm = new fileMan(); var ws = new wsClass(); string[] pesan = fm.getFile(outbox); string pes = ws.invokeProd("", "", pesan[0]); MessageBox.Show(pes); }
private void button4_Click(object sender, EventArgs e) { //string e = ""; var fm = new fileMan(); var ws = new wsClass(); string[] files = fm.getFile(outbox); string pes = ""; string[] fName = null; if (files != null && files.Length > 0) { foreach (string i in files) { try { pes = ws.invokeProd("", "", i); } catch (Exception ex) { System.Console.WriteLine(ex); } //string[] has = pes.Split('|'); //fName = i.Split('\\'); string namaFile = "";// fName[fName.Length - 1]; System.Console.WriteLine(namaFile + " " + pes); //if (has[0] == "failed") //{ // fm.moveFile(i, "c:\\tes\\error\\"); //} //else //{ // fm.moveFile(i, "c:\\tes\\success\\"); //} } } }
//timer eventhandler private void t_Tick(object sender, EventArgs e) { string log = ""; int jum = 0; //get current time int hh = DateTime.Now.Hour; int mm = DateTime.Now.Minute; int ss = DateTime.Now.Second; //time string time = jamText(hh.ToString() + ":" + mm.ToString() + ":" + ss.ToString()); //update label txtJam.Text = time; if (next < DateTime.Now) { jum = fman.cekDir(inbox); log = "[" + DateTime.Now.ToString("HH:MM:ss") + "] " + jum.ToString() + " files on Inbox"; updateLog(log); if (jum > 0) { //konversi string[] files = fman.getFile(inbox); if (files != null && files.Length > 0) { foreach (string i in files) { int conFile = fman.xlsToTxt(i, "xlsx"); if (conFile > 0) { fman.moveFile(i, error); log = "[" + DateTime.Now.ToString("HH:MM:ss") + "] " + conFile.ToString() + " new files Converted"; updateLog(log); } else { fman.moveFile(i, error); } } } } int jumOut = fman.cekDir(outbox); log = "[" + DateTime.Now.ToString("HH:MM:ss") + "] " + jumOut.ToString() + " files on Outbox"; updateLog(log); if (jumOut > 0) { string[] files = fman.getFile(outbox); string pes = ""; string[] fName = null; if (files != null && files.Length > 0) { foreach (string i in files) { pes = wsf.invokeProd("", "", i); //pes = wsf.invokeProdUoi("", "", i); string[] has = pes.Split('|'); fName = i.Split('\\'); string namaFile = fName[fName.Length - 1]; System.Console.WriteLine(namaFile + " " + pes); log = "[" + DateTime.Now.ToString("HH:MM:ss") + "] " + namaFile + " " + pes; updateLog(log); if (has[0] == "failed") { fman.moveFile(i, error); } else { fman.moveFile(i, succcess); } System.Threading.Thread.Sleep(1000); } } } next = DateTime.Now.AddSeconds(schedInt); txtNext.Text = jamText(next.Hour.ToString() + ":" + next.Minute.ToString() + ":" + next.Second.ToString()); } }