private void impoerEmailBilag(object sender, EventArgs e) { clsUnicontaHelp obj = new clsUnicontaHelp(UCInitializer.GetBaseAPI); int antalbilag = obj.ImportEmailBilag(); string bigString; if (antalbilag == 0) { bigString = "Der er ingen Email Bilag klar til uploaded til UniConta"; } else { bigString = string.Format("Der er uploaded {0} Email Bilag til UniConta.", antalbilag); } DialogResult result = DotNetPerls.BetterDialog.ShowDialog( "Medlem3060uc", //titleString bigString, //bigString null, //smallString null, //leftButton "OK", //rightButton global::Medlem3060uc.Properties.Resources.Message_info); //iconSet }
//************************************************************************************************************* //************************************************************************************************************* private void JobWorker(string jobname) { try { if (Enum.IsDefined(typeof(enumTask), jobname)) { Console.WriteLine(string.Format("Medlem3060Service {0} begin", jobname)); dbData3060DataContext m_dbData3060 = new dbData3060DataContext(); enumTask job = StringToEnum <enumTask>(jobname); switch (job) { case enumTask.ReceiveFilesFromPBS: CrudAPI api = UCInitializer.GetBaseAPI; clsSFTP objSFTP = new clsSFTP(m_dbData3060); int AntalImportFiler = objSFTP.ReadFraSFtp(m_dbData3060); //Læs direkte SFTP objSFTP.DisconnectSFtp(); objSFTP = null; clsPbs602 objPbs602 = new clsPbs602(); int Antal602Filer = objPbs602.betalinger_fra_pbs(m_dbData3060); //if (Antal602Filer > 0) // <<---------------------------- { Console.WriteLine(string.Format("Medlem3060Service {0} begin", "Betalinger til RSMembership")); objPbs602.betalinger_opdate_uniconta(m_dbData3060, api); Console.WriteLine(string.Format("Medlem3060Service {0} end", "Betalinger til RSMembership")); clsUniconta objSumma = new clsUniconta(m_dbData3060, api); int AntalBetalinger = objSumma.BogforIndBetalinger(); } objPbs602 = null; clsPbs603 objPbs603 = new clsPbs603(); int Antal603Filer = objPbs603.aftaleoplysninger_fra_pbs(m_dbData3060); objPbs603 = null; clsPbs686 objPbs686 = new clsPbs686(); int Antal686Filer = objPbs686.aftaleoplysninger_fra_pbs(m_dbData3060); objPbs686 = null; break; case enumTask.SendEmailAdvis: clsPbs601 objPbs601a = new clsPbs601(); CrudAPI aapi = UCInitializer.GetBaseAPI; Tuple <int, int> tresult = objPbs601a.advis_auto(m_dbData3060); int AntalAdvis = tresult.Item1; int lobnra = tresult.Item2; if ((AntalAdvis > 0)) { objPbs601a.advis_email_lobnr(m_dbData3060, lobnra, aapi); } objPbs601a = null; break; case enumTask.ProcessType602Files: break; case enumTask.ProcessType603Files: break; case enumTask.SendKontingentFileToPBS: CrudAPI dapi = UCInitializer.GetBaseAPI; clsPbsHelper objPbsHelperd = new clsPbsHelper(); objPbsHelperd.PbsAutoKontingent(m_dbData3060, dapi); objPbsHelperd = null; break; case enumTask.LoadSchedule: //Schedule(); break; case enumTask.KontingentNyeMedlemmer: CrudAPI capi = UCInitializer.GetBaseAPI; clsPbs601 objPbs601c = new clsPbs601(); Tuple <int, int> tresultc = objPbs601c.pending_rsform_indmeldelser(m_dbData3060, capi); int AntalKontingent = tresultc.Item1; int lobnrc = tresultc.Item2; if ((AntalKontingent > 0)) { //pbsType.indbetalingskort objPbs601c.faktura_og_rykker_601_action_lobnr(m_dbData3060, lobnrc, capi); clsSFTP objSFTPc = new clsSFTP(m_dbData3060); objSFTPc.WriteTilSFtp(m_dbData3060, lobnrc); objSFTPc.DisconnectSFtp(); objSFTPc = null; Tuple <int, int> tresultd = objPbs601c.advis_auto_lobnr(m_dbData3060, lobnrc); int AntalAdvisd = tresultd.Item1; int lobnrd = tresultd.Item2; if ((AntalAdvisd > 0)) { objPbs601c.advis_email_lobnr(m_dbData3060, lobnrd, capi); } objPbs601c = null; } break; case enumTask.SendEmailRykker: clsPbs601 objPbs601b = new clsPbs601(); CrudAPI bapi = UCInitializer.GetBaseAPI; Tuple <int, int> tresultb = objPbs601b.rykker_auto(m_dbData3060, bapi); int AntalRykker = tresultb.Item1; int lobnrb = tresultb.Item2; if ((AntalRykker > 0)) { objPbs601b.rykker_email_lobnr(m_dbData3060, lobnrb, bapi); } objPbs601b = null; break; case enumTask.UpdateMedlemStatus: break; case enumTask.SendEmailKviteringer: clsPbs601 objPbs601d = new clsPbs601(); CrudAPI apif = UCInitializer.GetBaseAPI; Tuple <int, int> tresultf = objPbs601d.kvitering_auto(m_dbData3060); int AntalKvit = tresultf.Item1; int lobnrf = tresultf.Item2; if ((AntalKvit > 0)) { objPbs601d.kvitering_email_lobnr(m_dbData3060, lobnrf, apif); } objPbs601d = null; break; case enumTask.ImportEmailBilag: CrudAPI apig = UCInitializer.GetBaseAPI; clsUnicontaHelp objUnicontaHelp = new clsUnicontaHelp(apig); objUnicontaHelp.ImportEmailBilag(); objUnicontaHelp = null; break; default: break; } } Console.WriteLine(string.Format("Medlem3060Service {0} end", jobname)); } catch (Exception e) { Console.WriteLine(string.Format("Medlem3060Service JobWorker() for {0} failed with message: {1}", jobname, e.Message)); } }