Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        //*************************************************************************************************************
        //*************************************************************************************************************
        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));
            }
        }