private void FrmPbsnetdir_Load(object sender, EventArgs e) { clsSFTP objSFTP = new clsSFTP(Program.dbData3060); objSFTP.ReadDirFraSFtp(); this.bsMemPbsnetdir.DataSource = objSFTP.m_memPbsnetdir; objSFTP.DisconnectSFtp(); objSFTP = null; }
private void betalingerFraPBSToolStripMenuItem_Click(object sender, EventArgs e) { string bigString = null; string smallString = null; int AntalImportFiler = 0; clsPbs601 objPbs601 = new clsPbs601(); clsPbs602 objPbs602 = new clsPbs602(); clsPbs603 objPbs603 = new clsPbs603(); clsPbs686 objPbs686 = new clsPbs686(); clsSFTP objSFTP = new clsSFTP(Program.dbData3060); AntalImportFiler = objSFTP.ReadFraSFtp(Program.dbData3060); //Læs direkte SFTP objSFTP.DisconnectSFtp(); objSFTP = null; //AntalImportFiler = objPbs602.ReadFraPbsFile(); //Læs fra Directory FraPBS int Antal602Filer = objPbs602.betalinger_fra_pbs(Program.dbData3060); int Antal603Filer = objPbs603.aftaleoplysninger_fra_pbs(Program.dbData3060); int Antal686Filer = objPbs686.aftaleoplysninger_fra_pbs(Program.dbData3060); Tuple <int, int> tresult = objPbs601.advis_auto(Program.dbData3060); int AntalAdvis = tresult.Item1; int lobnr = tresult.Item2; if ((AntalAdvis > 0)) { objPbs601.advis_email(Program.dbData3060, lobnr); } clsSumma objSumma = new clsSumma(); int AntalBetalinger = objSumma.BogforIndBetalinger(); if (AntalBetalinger > 0) { bigString = String.Format("Der er {0} bogførte betalinger.", AntalBetalinger); } else { bigString = "Der er ingen nye betalinger"; } smallString = String.Format("Antal indlæste filer fra PBS: {0} \nAntal nye 602 filer: {1}\nAntal nye 603 filer: {3}\nAntal nye 686 filer: {4}\nAntal nye betalinger: {2}.", AntalImportFiler, Antal602Filer, AntalBetalinger, Antal603Filer, Antal686Filer); DialogResult result = DotNetPerls.BetterDialog.ShowDialog( "Filer fra PBS", //titleString bigString, //bigString smallString, //smallString null, //leftButton "OK", //rightButton global::nsPuls3060v2.Properties.Resources.Message_info); //iconSet }
private void button1_Click(object sender, EventArgs e) { int pbsfilesid = int.Parse(txtpbsfilesid.Text); button1.Enabled = false; txtpbsfilesid.Enabled = false; clsSFTP objSFTP = new clsSFTP(Program.dbData3060); objSFTP.ReWriteTilSFtp(Program.dbData3060, pbsfilesid); objSFTP.DisconnectSFtp(); objSFTP = null; button1.Text = "Udført"; }
private void cmdImport_Click(object sender, EventArgs e) { clsSFTP objSFTP = new clsSFTP(Program.dbData3060); int AntalImportFiler = objSFTP.ReadFromLocalFile(Program.dbData3060, textFilePath.Text); objSFTP.DisconnectSFtp(); objSFTP = null; cmdImport.Enabled = false; textFilePath.Enabled = false; if (AntalImportFiler == 1) { labelMessage.Text = string.Format("{0} er importeret", textFilePath.Text); } else { labelMessage.Text = string.Format("{0} kunne ikke importeres", textFilePath.Text); labelMessage.ForeColor = Color.Red; } labelMessage.Visible = true; }
private int JobWorker(string jobname) { try { if (Enum.IsDefined(typeof(enumTask), jobname)) { dbData3060DataContext m_dbData3060 = new dbData3060DataContext(Program.dbConnectionString()); enumTask job = StringToEnum <enumTask>(jobname); switch (job) { case enumTask.ReceiveFilesFromPBS: 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); 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; if (Antal686Filer > 0) { clsPbs601 objPbs601a = new clsPbs601(); Tuple <int, int> tresult = objPbs601a.advis_auto(m_dbData3060); int AntalAdvis = tresult.Item1; int lobnra = tresult.Item2; if ((AntalAdvis > 0)) { objPbs601a.advis_email(m_dbData3060, lobnra); } objPbs601a = null; } break; case enumTask.ProcessType602Files: break; case enumTask.ProcessType603Files: break; case enumTask.SendFilesToPBS: break; case enumTask.LoadSchedule: LoadSchedule(); break; case enumTask.KontingentNyeMedlemmer: clsPbs601 objPbs601c = new clsPbs601(); Tuple <int, int> tresultc = objPbs601c.kontingent_fakturer_auto(m_dbData3060); int AntalKontingent = tresultc.Item1; int lobnrc = tresultc.Item2; if ((AntalKontingent > 0)) { objPbs601c.faktura_og_rykker_601_action(m_dbData3060, lobnrc, fakType.fdfaktura); clsSFTP objSFTPc = new clsSFTP(m_dbData3060); objSFTPc.WriteTilSFtp(m_dbData3060, lobnrc); objSFTPc.DisconnectSFtp(); objSFTPc = null; } objPbs601c = null; break; case enumTask.SendEmailRykker: clsPbs601 objPbs601b = new clsPbs601(); Tuple <int, int> tresultb = objPbs601b.rykker_auto(m_dbData3060); int AntalRykker = tresultb.Item1; int lobnrb = tresultb.Item2; if ((AntalRykker > 0)) { objPbs601b.rykker_email(m_dbData3060, lobnrb); } objPbs601b = null; break; case enumTask.UpdateMedlemStatus: m_dbData3060.UpdateMedlemStatus(); break; default: break; } } return(0); } catch (Exception e) { Program.Log(string.Format("Medlem3060Service JobWorker() failed with message: {0}", e.Message)); return(-1); } }
private int JobWorker(string jobname) { try { if (Enum.IsDefined(typeof(enumTask), jobname)) { Program.Log(string.Format("Medlem3060Service {0} begin", jobname)); dbData3060DataContext m_dbData3060 = new dbData3060DataContext(Program.dbConnectionString()); enumTask job = StringToEnum <enumTask>(jobname); switch (job) { case enumTask.ReceiveFilesFromPBS: 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) { Program.Log(string.Format("Medlem3060Service {0} begin", "Betalinger til RSMembership")); puls3060_dkEntities jdb = new puls3060_dkEntities(); objPbs602.betalinger_til_rsmembership(m_dbData3060, jdb); Program.Log(string.Format("Medlem3060Service {0} end", "Betalinger til RSMembership")); } 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(); Tuple <int, int> tresult = objPbs601a.advis_auto(m_dbData3060); int AntalAdvis = tresult.Item1; int lobnra = tresult.Item2; if ((AntalAdvis > 0)) { objPbs601a.advis_email(m_dbData3060, lobnra); } objPbs601a = null; break; case enumTask.ProcessType602Files: break; case enumTask.ProcessType603Files: break; case enumTask.SendKontingentFileToPBS: clsPbsHelper objPbsHelperd = new clsPbsHelper(); objPbsHelperd.PbsAutoKontingent(m_dbData3060); objPbsHelperd = null; break; case enumTask.LoadSchedule: LoadSchedule(); break; case enumTask.KontingentNyeMedlemmer: puls3060_dkEntities cjdb = new puls3060_dkEntities(); clsPbs601 objPbs601c = new clsPbs601(); Tuple <int, int> tresultc = objPbs601c.rsmembeshhip_fakturer_auto(m_dbData3060, cjdb); int AntalKontingent = tresultc.Item1; int lobnrc = tresultc.Item2; if ((AntalKontingent > 0)) { objPbs601c.faktura_og_rykker_601_action(m_dbData3060, lobnrc, fakType.fdrsmembership); clsSFTP objSFTPc = new clsSFTP(m_dbData3060); objSFTPc.WriteTilSFtp(m_dbData3060, lobnrc); objSFTPc.DisconnectSFtp(); objSFTPc = null; Tuple <int, int> tresultd = objPbs601c.advis_autoxxx(m_dbData3060, lobnrc); int AntalAdvisd = tresultd.Item1; int lobnrd = tresultd.Item2; if ((AntalAdvisd > 0)) { objPbs601c.advis_email(m_dbData3060, lobnrd); } objPbs601c = null; } break; case enumTask.SendEmailRykker: puls3060_dkEntities bjdb = new puls3060_dkEntities(); clsPbs601 objPbs601b = new clsPbs601(); Tuple <int, int> tresultb = objPbs601b.rykker_auto(m_dbData3060, bjdb); int AntalRykker = tresultb.Item1; int lobnrb = tresultb.Item2; if ((AntalRykker > 0)) { objPbs601b.rykker_email(m_dbData3060, lobnrb); } objPbs601b = null; break; case enumTask.UpdateMedlemStatus: m_dbData3060.UpdateMedlemStatus(); break; case enumTask.UpdateKanSlettes: clsPbsHelper objPbsHelpera = new clsPbsHelper(); objPbsHelpera.opdaterKanSlettes(); break; case enumTask.JobQMaintenance: clsPbsHelper objPbsHelperb = new clsPbsHelper(); objPbsHelperb.JobQMaintenance(m_dbData3060); break; case enumTask.SendEmailKviteringer: puls3060_dkEntities djdb = new puls3060_dkEntities(); clsPbs601 objPbs601d = new clsPbs601(); objPbs601d.rsmembeshhip_betalinger_auto(m_dbData3060, djdb); break; default: break; } } Program.Log(string.Format("Medlem3060Service {0} end", jobname)); return(0); } catch (Exception e) { Program.Log(string.Format("Medlem3060Service JobWorker() for {0} failed with message: {1}", jobname, e.Message)); return(-1); } }
//************************************************************************************************************* //************************************************************************************************************* 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)); } }
private void cmdRykkere_Click(object sender, EventArgs e) { string TilPBSFilename; int AntalRykkere; int lobnr; int imax; string keyval; int faknr; double advisbelob; if ((this.cmdRykkere.Text == "Afslut")) { this.Close(); } this.cmdForslag.Visible = false; this.cmdCancel.Visible = false; imax = lvwRykker.Items.Count; this.pgmRykker.Maximum = (imax * 4); this.pgmRykker.Minimum = 0; this.pgmRykker.Value = 0; this.pgmRykker.Visible = true; Program.dbData3060.tempRykkerforslag.RemoveRange(Program.dbData3060.tempRykkerforslag); Program.dbData3060.SaveChanges(); if ((imax == 0)) { this.Label_Rykkertekst.Text = "Der ikke noget at rykkere"; this.Label_Rykkertekst.Visible = true; } else { nsPbs3060v2.tempRykkerforslag rec_tempRykkerforslag = new nsPbs3060v2.tempRykkerforslag { betalingsdato = clsOverfoersel.bankdageplus(DateTime.Today, 5), bsh = this.DelsystemBSH.Checked }; Program.dbData3060.tempRykkerforslag.Add(rec_tempRykkerforslag); var i = 0; foreach (ListViewItem lvi in lvwRykker.Items) { this.pgmRykker.Value = ++i; keyval = lvi.Name; advisbelob = double.Parse(lvi.SubItems[5].Text); faknr = int.Parse(lvi.SubItems[6].Text); nsPbs3060v2.tempRykkerforslaglinie rec_tempRykkerforslaglinie = new nsPbs3060v2.tempRykkerforslaglinie { Nr = int.Parse(keyval), advisbelob = (decimal)advisbelob, faknr = faknr }; rec_tempRykkerforslag.tempRykkerforslaglinie.Add(rec_tempRykkerforslaglinie); } Program.dbData3060.SaveChanges(); clsPbs601 objPbs601 = new clsPbs601(); Tuple <int, int> tresult = objPbs601.rykkere_bsh(Program.dbData3060); AntalRykkere = tresult.Item1; lobnr = tresult.Item2; this.pgmRykker.Value = imax * 2; if ((AntalRykkere > 0)) { if (this.DelsystemBSH.Checked) //RYKKERE med Indbetalingskort { objPbs601.faktura_og_rykker_601_action(Program.dbData3060, lobnr, fakType.fdrykker); this.pgmRykker.Value = (imax * 3); clsSFTP objSFTP = new clsSFTP(Program.dbData3060); objSFTP.WriteTilSFtp(Program.dbData3060, lobnr); objSFTP.DisconnectSFtp(); objSFTP = null; } else //RYKKERE som emails { objPbs601.rykker_email(Program.dbData3060, lobnr); this.pgmRykker.Value = (imax * 3); } } this.pgmRykker.Value = (imax * 4); cmdRykkere.Text = "Afslut"; try { var rec_tilpbs = (from t in Program.dbData3060.tbltilpbs where t.id == lobnr select t).First(); TilPBSFilename = "PBS" + rec_tilpbs.leverancespecifikation + ".lst"; } catch (System.InvalidOperationException) { TilPBSFilename = "PBSNotFound.lst"; } this.Label_Rykkertekst.Text = ("Leverance til PBS er gemt i filen " + TilPBSFilename); this.Label_Rykkertekst.Visible = true; this.pgmRykker.Visible = false; } }
private void cmdFakturer_Click(object sender, EventArgs e) { string TilPBSFilename = "Unknown"; int AntalFakturaer; int lobnr; int imax; string keyval; DateTime fradato; DateTime tildato; bool tilmeldtpbs; bool indmeldelse; double advisbelob; if ((this.cmdFakturer.Text == "Afslut")) { this.Close(); } this.cmdForslag.Visible = false; this.cmdCancel.Visible = false; imax = lvwKontingent.Items.Count; this.pgmFaktura.Maximum = (imax * 4); this.pgmFaktura.Minimum = 0; this.pgmFaktura.Value = 0; this.pgmFaktura.Visible = true; (Program.dbData3060.tempKontforslag).RemoveRange(Program.dbData3060.tempKontforslag); Program.dbData3060.SaveChanges(); if ((imax == 0)) { this.Label_Fakturatekst.Text = "Der ikke noget at fakturere"; this.Label_Fakturatekst.Visible = true; } else { nsPbs3060v2.tempKontforslag rec_tempKontforslag = new nsPbs3060v2.tempKontforslag { betalingsdato = clsOverfoersel.bankdageplus(this.DatoKontingentForfald.Value, 0), bsh = this.DelsystemBSH.Checked }; Program.dbData3060.tempKontforslag.Add(rec_tempKontforslag); var i = 0; foreach (ListViewItem lvi in lvwKontingent.Items) { this.pgmFaktura.Value = ++i; keyval = lvi.Name; fradato = DateTime.Parse(lvi.SubItems[4].Text); advisbelob = double.Parse(lvi.SubItems[5].Text); tildato = DateTime.Parse(lvi.SubItems[6].Text); indmeldelse = (lvi.SubItems[7].Text == "J") ? true : false; tilmeldtpbs = (lvi.SubItems[8].Text == "J") ? true : false; nsPbs3060v2.tempKontforslaglinie rec_tempKontforslaglinie = new nsPbs3060v2.tempKontforslaglinie { Nr = int.Parse(keyval), advisbelob = (decimal)advisbelob, fradato = fradato, tildato = tildato, indmeldelse = indmeldelse, tilmeldtpbs = tilmeldtpbs, }; rec_tempKontforslag.tempKontforslaglinie.Add(rec_tempKontforslaglinie); } Program.dbData3060.SaveChanges(); clsPbs601 objPbs601 = new clsPbs601(); Tuple <int, int> tresult = objPbs601.kontingent_fakturer_bs1(Program.dbData3060); AntalFakturaer = tresult.Item1; lobnr = tresult.Item2; this.pgmFaktura.Value = imax * 2; if ((AntalFakturaer > 0)) { objPbs601.faktura_og_rykker_601_action(Program.dbData3060, lobnr, fakType.fdfaktura); this.pgmFaktura.Value = (imax * 3); clsSFTP objSFTP = new clsSFTP(Program.dbData3060); TilPBSFilename = objSFTP.WriteTilSFtp(Program.dbData3060, lobnr); objSFTP.DisconnectSFtp(); objSFTP = null; } this.pgmFaktura.Value = (imax * 4); cmdFakturer.Text = "Afslut"; this.DelsystemBSH.Visible = false; this.Label_Fakturatekst.Text = ("Leverance til PBS i filen " + TilPBSFilename); this.Label_Fakturatekst.Visible = true; this.pgmFaktura.Visible = false; } }