public void Begin() { try { //程序一 : //生成 B2B XML// ExA0401 a0401 = new ExA0401(); a0401.Begin("a0401"); ExA0501 a0501 = new ExA0501(); a0501.Begin("a0501"); ExA0601 a0601 = new ExA0601(); a0601.Begin("a0601"); ExB0401 b0401 = new ExB0401(); b0401.Begin("b0401"); ExB0501 b0501 = new ExB0501(); b0501.Begin("b0501"); //程序二 : //生成 B2C XML ExC0401 c0401 = new ExC0401(); c0401.Begin("c0401"); ExC0501 c0501 = new ExC0501(); c0501.Begin("c0501"); ExC0701 c0701 = new ExC0701(); c0701.Begin("c0701"); ExD0401 d0401 = new ExD0401(); d0401.Begin("d0401"); ExD0501 d0501 = new ExD0501(); d0501.Begin("d0501"); } catch (Exception ex) { string mailBody = string.Format("[電子發票] <br> 錯誤訊息:{0}", ex.Message); string eToWho1 = PublicMethodFramework35.Repositoies.GetParaXml("eToWhoRinnai"); string eFromWho1 = PublicMethodFramework35.Repositoies.GetParaXml("eFromWho"); PublicMethodFramework35.Repositoies.AutoEMail(eToWho1, "", eFromWho1, "", mailBody); throw ex; } }
static void Main(string[] args) { string sKind0 = args[0].ToString().ToLower(); if (sKind0.Length > 0) { switch (sKind0.ToString()) { case "a0401": //生成XML A0401 存證B2B 開立發票 ExA0401 a0401 = new ExA0401(); a0401.Begin(sKind0); break; case "a0501": //生成XML A0501 存證B2B 作廢發票 ExA0501 a0501 = new ExA0501(); a0501.Begin(sKind0); break; case "a0601": //生成XML A0601 存證B2B 退回(拒收)發票 ExA0601 a0601 = new ExA0601(); a0601.Begin(sKind0); break; case "b0401": //生成XML B0401 存證B2B 折讓證明單 ExB0401 b0401 = new ExB0401(); b0401.Begin(sKind0); break; case "b0501": //生成XML B0501 存證B2B 作廢折讓證明單 ExB0501 b0501 = new ExB0501(); b0501.Begin(sKind0); break; default: break; } } }