Example #1
0
 private void SalvaButton_Click(object sender, EventArgs e)
 {
     if (
         NameTextBox.Text != string.Empty &&
         PathTextBox.Text != string.Empty &&
         CodBaseTextBox.Text != string.Empty
         )
     {
         //if (MessageBox.Show("Salva database?", "Confermare", MessageBoxButtons.YesNo) == DialogResult.Yes)
         //{
         var db = new GeispDatabase(NameTextBox.Text, CodBaseTextBox.Text, PathTextBox.Text, GeispUtils.getSocietaId(SocietaComboBox.SelectedItem.ToString()));
         GeispUtils.addDatabase(db);
         cfg.Refr();
         this.Close();
         //}
         //else
         //{
         /// Code for ‘No’
         //}
     }
     else
     {
         MessageBox.Show("Si prega di compilare tutti i campi", "Attenzione..");
     }
 }
Example #2
0
 public AddGeispDb()
 {
     InitializeComponent();
     bs            = new BindingSource();
     bs.DataSource = GeispUtils.getSocietaNames();
     SocietaComboBox.DataSource = bs;
 }
Example #3
0
 private void GeispRemoveButton_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Rimouvi " + GeispListBox.SelectedValue.ToString() + "?", "Confermare", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         GeispUtils.removeDatabase(GeispListBox.SelectedValue.ToString());
         Refr();
     }
 }
Example #4
0
 public AddGeispDb(Configurazione cfg)
 {
     InitializeComponent();
     this.cfg      = cfg;
     bs            = new BindingSource();
     bs.DataSource = GeispUtils.getSocietaNames();
     SocietaComboBox.DataSource = bs;
 }
Example #5
0
 private void GeispRemoveAllButton_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Rimouvi tuti database?", "Confermare", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         GeispUtils.removeAllDatabases();
         bs                      = new BindingSource();
         bs.DataSource           = GeispUtils.getDatabasesNames();
         GeispListBox.DataSource = bs;
     }
 }
Example #6
0
 private void GeispRemoeButton_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Rimouvi " + GeispListBox.SelectedValue.ToString() + "?", "Confermare", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         GeispUtils.removeDatabase(GeispListBox.SelectedValue.ToString());
         bs                      = new BindingSource();
         bs.DataSource           = GeispUtils.getDatabasesNames();
         GeispListBox.DataSource = bs;
     }
 }
Example #7
0
        private void ControlsInit()
        {
            LogTextBox.Text      = ConfigUtils.GetLogPath();
            HourComboBox.Text    = ConfigUtils.GetHours();
            MinutesComboBox.Text = ConfigUtils.GetMinutes();

            bs                      = new BindingSource();
            bs.DataSource           = GeispUtils.getDatabasesNames();
            GeispListBox.DataSource = bs;
        }
Example #8
0
        private void ControlsInit()
        {
            GeispDatabase gDet = new GeispDatabase();

            gDet = GeispUtils.getDatabase(name);

            NameTextBox.Text  = gDet.name;
            MdbTextBox.Text   = gDet.mdb;
            ExcelTextBox.Text = gDet.excel;
            Mdb2TextBox.Text  = gDet.mdb2;
        }
Example #9
0
        public DetailsForm(string name)
        {
            InitializeComponent();
            GeispDatabase gDet = new GeispDatabase();

            gDet = GeispUtils.getDatbase(name);

            NameTextBox.Text    = gDet.name;
            CodBaseTextBox.Text = gDet.codBas;
            SocietaTextBox.Text = gDet.getSocietaName();
            PathTextBox.Text    = gDet.path;
        }
Example #10
0
        public DetailsForm(string name)
        {
            InitializeComponent();
            GeispDatabase gDet = new GeispDatabase();

            gDet = GeispUtils.getDatabase(name);

            NameTextBox.Text  = gDet.name;
            MdbTextBox.Text   = gDet.mdb;
            ExcelTextBox.Text = gDet.excel;
            Mdb2TextBox.Text  = gDet.mdb2;
        }
Example #11
0
        private void ControlsInit()
        {
            GeispDatabase gDet = new GeispDatabase();

            gDet          = GeispUtils.getDatbase(name);
            bs            = new BindingSource();
            bs.DataSource = GeispUtils.getSocietaNames();
            SocietaComboBox.DataSource = bs;

            NameTextBox.Text     = gDet.name;
            CodBaseTextBox.Text  = gDet.codBas;
            SocietaComboBox.Text = gDet.getSocietaName();
            PathTextBox.Text     = gDet.path;
        }
Example #12
0
        private void ApplicareButton_Click(object sender, EventArgs e)
        {
            if (File.Exists(MdbTextBox.Text) == false || File.Exists(ExcelTextBox.Text) == false || File.Exists(Mdb2TextBox.Text) == false)
            {
                MessageBox.Show("Invalid path format!");
                return;
            }
            if (String.IsNullOrEmpty(NameTextBox.Text))
            {
                MessageBox.Show("Name field is required!");
                return;
            }
            var db = new GeispDatabase(NameTextBox.Text, MdbTextBox.Text, ExcelTextBox.Text, Mdb2TextBox.Text);

            GeispUtils.modifyDatabase(name, db);
            this.Close();
        }
Example #13
0
        private void ControlsInit()
        {
            LogTextBox.Text      = ConfigUtils.GetLogPath();
            HourComboBox.Text    = ConfigUtils.GetHours();
            MinutesComboBox.Text = ConfigUtils.GetMinutes();

            SqlPassTextBox.Text      = ConfigUtils.GetSQLPassword();
            SqlServerTextBox.Text    = ConfigUtils.GetSQLServer();
            SqlTrustCheckBox.Checked = ConfigUtils.GetTrustedConnection();
            SqlUserTextBox.Text      = ConfigUtils.GetSQLUser();

            CaricoTextBox.Text      = ConfigUtils.GetCaricoAddress();
            PosteTextBox.Text       = ConfigUtils.GetPostAddress();
            EmailServerTextBox.Text = ConfigUtils.GetMailServer();
            SSLcheckBox.Checked     = ConfigUtils.GetServerSecurity();
            SenderTextBox.Text      = ConfigUtils.GetSenderAddress();
            PortTextBox.Text        = ConfigUtils.GetServerPort();
            MailPassTextBox.Text    = ConfigUtils.GetSenderPassword();

            bs                      = new BindingSource();
            bs.DataSource           = GeispUtils.getDatabasesNames();
            GeispListBox.DataSource = bs;
        }
Example #14
0
 private void ApplicareButton_Click(object sender, EventArgs e)
 {
     if (
         NameTextBox.Text != string.Empty &&
         PathTextBox.Text != string.Empty &&
         CodBaseTextBox.Text != string.Empty
         )
     {
         if (MessageBox.Show("Applicare configurazione?", "Confermare", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             var db = new GeispDatabase(NameTextBox.Text, CodBaseTextBox.Text, PathTextBox.Text, GeispUtils.getSocietaId(SocietaComboBox.SelectedItem.ToString()));
             GeispUtils.modifyDatabase(name, db);
         }
         else
         {
             /// Code for ‘No’
         }
     }
     else
     {
         MessageBox.Show("Si prega di compilare tutti i campi", "Attenzione..");
     }
 }
Example #15
0
        public void Run()
        {
            report     = new DataTable();
            NonTrovati = new DataTable();
            this.oledb = new OleDbUtil();
            this.sql   = new SQLUtil();
            string output = string.Empty;
            string query  = string.Empty;
            string nota   = string.Empty;

            InitReportDataTable();

            List <GeispDatabase> databases = GeispUtils.getDatabases();

            foreach (var db in databases)
            {
                output = this.oledb.InitConnection(db.path);
                output = this.sql.InitConnection(ConfigUtils.GetSQLServer(), db.societatId, ConfigUtils.GetSQLUser(), ConfigUtils.GetSQLPassword(), ConfigUtils.GetTrustedConnection().ToString());


                query = string.Format("SELECT PAGAMENTI.BASE, PRATICHE.CONTRATTO, DEBITORI.NOM_DEB, PRATICHE.COD_VEL,"
                                      + " PAGAMENTI.IMPORTO_EURO,ISNULL(PAGAMENTI.DATAVERA, PAGAMENTI.DATA2) as 'data di valuta del titolo',"
                                      + " PAGAMENTI.ESTREMI, PAGAMENTI.DATA_DISTINTA_INCASSI, PAGAMENTI.COD_INT from PAGAMENTI"
                                      + " inner join PRATICHE on PRATICHE.COD_VEL = PAGAMENTI.COD_VEL"
                                      + " inner join DEBITORI on DEBITORI.COD_DEB = PRATICHE.COD_DEB"
                                      + " where CONVERT(nvarchar(10),PAGAMENTI.DATA_DISTINTA_INCASSI,105) = CONVERT(nvarchar(10), GETDATE(), 105)"
                                      + " and PAGAMENTI.IMPORTO_EURO > 0  and PAGAMENTI.COD_INT < 500"
                                      + " and NOT EXISTS (select 1 from PAGAMENTI P where P.COD_INT  =  PAGAMENTI.COD_INT + 500  and p.COD_VEL = PAGAMENTI.COD_VEL)"
                                      + " and PRATICHE.COD_BAS in ({0})", db.codBas);

                Logger.Log("Estrazione dei pagamenti per il database GEISP (" + db.name + ") per la prima procedura", LogType.Operation);
                DataTable dtPagamenti = new DataTable();
                if (this.sql.Connection.State.ToString().ToUpper() == "OPEN")
                {
                    try
                    {
                        dtPagamenti = this.sql.ExtractValues(query);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(ex.ToString(), LogType.Error);
                    }
                }
                nota = string.Empty;
                Logger.Log(string.Concat(new object[] { "Trovati ", dtPagamenti.Rows.Count.ToString(), " pagamenti sul database GALAXIA (", db.societatId, " cod_base ", db.codBas, ")" }), LogType.Operation);
                foreach (DataRow dr in dtPagamenti.Rows)
                {
                    string nrRapporto = this.determineNrRaport(dr.ItemArray[1].ToString());
                    if (nrRapporto != "-1")
                    {
                        nota   = "In data odierna per il rapporto nr " + nrRapporto.ToString() + " e’ stato versato su conto di servizio titolo di euro " + dr.ItemArray[4].ToString() + " estremi " + dr.ItemArray[6].ToString() + ", al quale vanno aggiunti i giorni previsti da convenzione per realizzare il bonifico.";
                        output = this.InsertNewNote(nrRapporto.ToString(), nota);
                        if (output == "OK")
                        {
                            string datetime = string.Empty;
                            Logger.Log(datetime + "Contratto " + dr.ItemArray[1].ToString().Substring(dr.ItemArray[1].ToString().Length - 7) + ": inserimento di nota: \"" + nota + "\" finito con successo", LogType.Operation);
                            //string text7 = "UPDATE PAGAMENTI SET PAGAMENTI.ESIGENZA_STATO = 'NOTE GEISP' WHERE PAGAMENTI.COD_VEL = " + dr.ItemArray[3].ToString() + " and PAGAMENTI.COD_INT = " + dr.ItemArray[8].ToString();
                            report.Rows.Add(db.getSocietaName(), dr.ItemArray[3].ToString(), nota, nrRapporto.ToString());
                        }
                        else
                        {
                            string datetime = string.Empty;
                            Logger.Log(datetime + "Contratto " + dr.ItemArray[1].ToString().Substring(dr.ItemArray[1].ToString().Length - 7) + ": inserimento di nota: \"" + nota + "\" non ha finito con successo", LogType.Operation);
                        }
                    }
                    else
                    {
                        try
                        {
                            Logger.Log(string.Empty + "Contratto " + dr.ItemArray[1].ToString().Substring(dr.ItemArray[1].ToString().Length - 7) + ": non trovato nella tabella Rapporti", LogType.Operation);
                            NonTrovati.Rows.Add(db.getSocietaName(), dr.ItemArray[3].ToString(), "Non trovato nella tabella Rapporti", dr.ItemArray[1].ToString());
                        }
                        catch { }
                    }
                }

                query = string.Format("SELECT DISTINCT PRATICHE.CONTRATTO from PAGAMENTI"
                                      + " inner join PRATICHE on PRATICHE.COD_VEL = PAGAMENTI.COD_VEL"
                                      + " inner join DEBITORI on DEBITORI.COD_DEB = PRATICHE.COD_DEB"
                                      + " where CONVERT(nvarchar(10),PAGAMENTI.DATA1,105) = CONVERT(nvarchar(10), GETDATE(), 105)"
                                      //+ " and PAGAMENTI.DATA2 <> PAGAMENTI.DATA1"
                                      + " and PAGAMENTI.IMPORTO_EURO > 0  and PAGAMENTI.COD_INT < 500"
                                      + " and NOT EXISTS (SELECT 1 FROM PAGAMENTI P WHERE P.COD_VEL = PAGAMENTI.COD_VEL AND P.COD_INT = 500 + PAGAMENTI.COD_INT) "
                                      + " and PRATICHE.COD_BAS IN ({0})", db.codBas);

                Logger.Log("Estrazione dei pagamenti per il database GEISP (" + db.name + ") per la seconda procedura", LogType.Operation);

                DataTable dtContratto = new DataTable();

                if (this.sql.Connection.State.ToString().ToUpper() == "OPEN")
                {
                    try
                    {
                        dtContratto = this.sql.ExtractValues(query);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(ex.ToString(), LogType.Error);
                    }
                }

                //query = string.Format("SELECT PAGAMENTI.BASE, PRATICHE.CONTRATTO, DEBITORI.NOM_DEB, PRATICHE.COD_VEL, PAGAMENTI.IMPORTO_EURO,"
                //+"ISNULL(PAGAMENTI.DATAVERA, PAGAMENTI.DATA2) as 'data di valuta del titolo', PAGAMENTI.ESTREMI, PAGAMENTI.DATA_DISTINTA_INCASSI,"
                //+"PAGAMENTI.DATA1,PAGAMENTI.DATA2,PAGAMENTI.DATA3, PAGAMENTI.TIPO_PAGA from PAGAMENTI inner join PRATICHE on PRATICHE.COD_VEL = PAGAMENTI.COD_VEL"
                //+" inner join DEBITORI on DEBITORI.COD_DEB = PRATICHE.COD_DEB where CONVERT(nvarchar(10),PAGAMENTI.DATA1,105) = CONVERT(nvarchar(10), GETDATE(), 105)"
                //+" and PAGAMENTI.DATA2 <> PAGAMENTI.DATA1  and PAGAMENTI.IMPORTO_EURO > 0  and PAGAMENTI.COD_INT < 500"
                //+" and NOT EXISTS (select 1 from PAGAMENTI P where P.COD_VEL = PAGAMENTI.COD_VEL and P.COD_INT = 500 + PAGAMENTI.COD_INT) "
                //+" and PRATICHE.COD_BAS in ({0})",db.codBas);
                //DataTable dtCountPayments = this.sql.ExtractValues(query);
                //Logger.Log(string.Concat(new object[] { "Trovati ", dtCountPayments.Rows.Count.ToString(), " pagamenti sul database GALAXIA (", db.societatId, " cod_base ", db.codBas, ")" }), LogType.Operation);

                Logger.Log(string.Concat(new object[] { "Trovati ", dtContratto.Rows.Count.ToString(), " pagamenti sul database GALAXIA (", db.societatId, " cod_base ", db.codBas, ")" }), LogType.Operation);

                foreach (DataRow dr in dtContratto.Rows)
                {
                    string entireRow = dr.ItemArray[0].ToString();
                    int    rowLength = entireRow.Length;
                    string last7Row  = entireRow.Substring(rowLength - 7);
                    query = string.Format("SELECT PAGAMENTI.BASE, PRATICHE.CONTRATTO, DEBITORI.NOM_DEB, PRATICHE.COD_VEL,"
                                          + "PAGAMENTI.IMPORTO_EURO,ISNULL(PAGAMENTI.DATAVERA, PAGAMENTI.DATA2) as 'data di valuta del titolo',"
                                          + "PAGAMENTI.ESTREMI, PAGAMENTI.DATA_DISTINTA_INCASSI,PAGAMENTI.DATA1,PAGAMENTI.DATA2,PAGAMENTI.DATA3,"
                                          + "PAGAMENTI.TIPO_PAGA, PAGAMENTI.COD_INT from PAGAMENTI"
                                          + " inner join PRATICHE on PRATICHE.COD_VEL = PAGAMENTI.COD_VEL"
                                          + " inner join DEBITORI on DEBITORI.COD_DEB = PRATICHE.COD_DEB"
                                          + " where CONVERT(nvarchar(10),PAGAMENTI.DATA1,105) = CONVERT(nvarchar(10), GETDATE(), 105)"
                                          //+ " and PAGAMENTI.DATA2 <> PAGAMENTI.DATA1"
                                          + " and RIGHT(PRATICHE.CONTRATTO,7) ='{0}' "
                                          + " and PAGAMENTI.IMPORTO_EURO > 0  and PAGAMENTI.COD_INT < 500"
                                          + " and NOT EXISTS (select 1 from PAGAMENTI P where P.COD_VEL = PAGAMENTI.COD_VEL and P.COD_INT = 500 + PAGAMENTI.COD_INT)"
                                          + " and PRATICHE.COD_BAS in ({1})", last7Row, db.codBas);

                    DataTable dtPagamenti2 = this.sql.ExtractValues(query);

                    bool            bp1              = false;
                    bool            bp2              = false;
                    int             nrCp             = this.CountCPNumber(dtPagamenti2);
                    int             nrBp1            = this.CountBPNumber1(dtPagamenti2);
                    int             nrBp2            = this.CountBPNumber2(dtPagamenti2);
                    DateTime        minDate2         = this.ExtractMinDate2(dtPagamenti2);
                    DateTime        maxDate2         = this.ExtractMaxDate2(dtPagamenti2);
                    double          totaleuro        = this.CalculateTotalEuroSum(dtPagamenti2);
                    List <string[]> listPagamentiBP  = this.ExtractPagamentiList1(dtPagamenti2);
                    List <string[]> listPagamentiBP2 = this.ExtractPagamentiList2(dtPagamenti2);

                    foreach (DataRow drP in dtPagamenti2.Rows)
                    {
                        string type = drP.ItemArray[11].ToString();
                        if (type.ToUpper() == "DI")
                        {
                            string nrRaport = this.determineNrRaport(drP.ItemArray[1].ToString());
                            if (nrRaport != "-1")
                            {
                                nota   = "Il cliente per il rapporto NR " + nrRaport.ToString() + " ha provveduto al pagamento di euro " + drP.ItemArray[4].ToString() + " in data " + drP.ItemArray[10].ToString() + " che sar\x00e0 versato nei prossimi giorni sul conto di servizio al quale andranno aggiunti i giorni previsti da convenzione per realizzare il bonifico. ";
                                output = this.InsertNewNote(nrRaport.ToString(), nota);
                                if (output.ToLower() == "ok")
                                {
                                    string datetime = string.Empty;
                                    Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" finito con successo", LogType.Operation);
                                    //string text10 = "UPDATE PAGAMENTI SET PAGAMENTI.ESIGENZA_STATO = 'NOTE GEISP' WHERE PAGAMENTI.COD_VEL = " + drP.ItemArray[3].ToString() + " and PAGAMENTI.COD_INT = " + drP.ItemArray[12].ToString();
                                    report.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), nota, nrRaport.ToString());
                                }
                                else
                                {
                                    string datetime = string.Empty;
                                    Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" non ha finito con successo", LogType.Operation);
                                }
                            }
                            else
                            {
                                Logger.Log(string.Empty + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": non trovato nella tabella Rapporti", LogType.Operation);
                                NonTrovati.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), "Non trovato nella tabella Rapporti", drP.ItemArray[1].ToString());
                            }
                        }
                        else if (type.ToUpper() == "CP")
                        {
                            string nrRaport = this.determineNrRaport(drP.ItemArray[1].ToString());
                            if (nrRaport != "-1")
                            {
                                nota   = "Il cliente per il rapporto NR " + nrRaport.ToString() + " propone rientro mediante  NR " + nrCp.ToString() + " promesse di pagamento con scadenza dal " + minDate2.ToString() + " al " + maxDate2.ToString() + " " + drP.ItemArray[4].ToString() + " in data " + drP.ItemArray[9].ToString() + " per un totale di euro " + totaleuro.ToString() + " che transiteranno sul conto corrente di servizio a copertura di quanto in nostro affidamento.";
                                output = this.InsertNewNote(nrRaport.ToString(), nota);
                                if (output.ToLower() == "ok")
                                {
                                    string datetime = string.Empty;
                                    Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" finito con successo", LogType.Operation);
                                    //string text11 = "UPDATE PAGAMENTI SET PAGAMENTI.ESIGENZA_STATO = 'NOTE GEISP' WHERE PAGAMENTI.COD_VEL = " + drP.ItemArray[3].ToString() + " and PAGAMENTI.COD_INT = " + drP.ItemArray[12].ToString();
                                    report.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), nota, nrRaport.ToString());
                                }
                                else
                                {
                                    string datetime = string.Empty;
                                    Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" non ha finito con successo", LogType.Operation);
                                }
                            }
                            else
                            {
                                Logger.Log(string.Empty + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": non trovato nella tabella Rapporti", LogType.Operation);
                                NonTrovati.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), "Non trovato nella tabella Rapporti", drP.ItemArray[1].ToString());
                            }
                        }
                        else if (type.ToUpper() == "BP")
                        {
                            if (((drP.ItemArray[6].ToString()[0] == 'I') || (drP.ItemArray[6].ToString()[0] == 'J')) && !bp1)
                            {
                                string nrRaport = this.determineNrRaport(drP.ItemArray[1].ToString());
                                if (nrRaport != "-1")
                                {
                                    nota = "Il cliente per il rapporto NR " + nrRaport.ToString() + " ha provveduto ha sottoscrivere piano di rientro tramite nr " + nrBp1.ToString() + " rate  aventi i seguenti importi e scadenze ";
                                    foreach (string[] s in listPagamentiBP)
                                    {
                                        nota += s[0] + "->" + s[1] + " ";
                                    }
                                    nota   = nota + ". Tali pagamenti transiteranno su conto di servizio e alla scadenza dovranno essere aggiunti i giorni previsti da convenzione per il bonifico.";
                                    output = this.InsertNewNote(nrRaport.ToString(), nota);
                                    if (output.ToLower() == "ok")
                                    {
                                        string datetime = string.Empty;
                                        Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" finito con successo", LogType.Operation);
                                        report.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), nota, nrRaport.ToString());
                                    }
                                    else
                                    {
                                        string datetime = string.Empty;
                                        Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" non ha finito con successo", LogType.Operation);
                                    }
                                }
                                else
                                {
                                    Logger.Log(string.Empty + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": non trovato nella tabella Rapporti", LogType.Operation);
                                    NonTrovati.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), "Non trovato nella tabella Rapporti", drP.ItemArray[1].ToString());
                                }
                                bp1 = true;
                            }
                            if (((drP.ItemArray[6].ToString()[0] != 'I') && (drP.ItemArray[6].ToString()[0] != 'J')) && !bp2)
                            {
                                string nrRaport = this.determineNrRaport(drP.ItemArray[1].ToString());
                                if (nrRaport != "-1")
                                {
                                    nota = "Il cliente per il rapporto NR " + nrRaport.ToString() + " ha provveduto ha sottoscrivere piano di rientro tramite nr " + nrBp2.ToString() + " rate  aventi i seguenti importi e scadenze ";
                                    foreach (string[] s in listPagamentiBP2)
                                    {
                                        nota += s[0] + "->" + s[1] + " ";
                                    }
                                    nota   = nota + " a copertura di quanto in nostro affidamento.";
                                    output = this.InsertNewNote(nrRaport.ToString(), nota);
                                    if (output.ToLower() == "ok")
                                    {
                                        string datetime = string.Empty;
                                        Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" finito con successo", LogType.Operation);
                                        report.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), nota, nrRaport.ToString());
                                    }
                                    else
                                    {
                                        string datetime = string.Empty;
                                        Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" non ha finito con successo", LogType.Operation);
                                    }
                                }
                                else
                                {
                                    Logger.Log(string.Empty + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": non trovato nella tabella Rapporti", LogType.Operation);
                                    NonTrovati.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), "Non trovato nella tabella Rapporti", drP.ItemArray[1].ToString());
                                }
                                bp2 = true;
                            }
                        }
                        else
                        {
                            string nrRaport = this.determineNrRaport(drP.ItemArray[1].ToString());
                            if (nrRaport != "-1")
                            {
                                nota   = "Il cliente per il rapporto NR " + nrRaport.ToString() + " ha rilasciato titolo di euro " + drP.ItemArray[4].ToString() + " in data " + drP.ItemArray[8].ToString() + " che sar\x00e0 versato nei prossimi giorni sul conto di servizio al quale andranno aggiunti i giorni previsti da convenzione per realizzare il bonifico.";
                                output = this.InsertNewNote(nrRaport.ToString(), nota);
                                if (output.ToLower() == "ok")
                                {
                                    string datetime = string.Empty;
                                    Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" finito con successo", LogType.Operation);
                                    //string text12 = "UPDATE PAGAMENTI SET PAGAMENTI.ESIGENZA_STATO = 'NOTE GEISP' WHERE PAGAMENTI.COD_VEL = " + drP.ItemArray[3].ToString() + " and PAGAMENTI.COD_INT = " + drP.ItemArray[12].ToString();
                                    report.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), nota, nrRaport.ToString());
                                }
                                else
                                {
                                    string datetime = string.Empty;
                                    Logger.Log(datetime + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": inserimento di nota: \"" + nota + "\" non ha finito con successo", LogType.Operation);
                                }
                            }
                            else
                            {
                                Logger.Log(string.Empty + "Contratto " + drP.ItemArray[1].ToString().Substring(drP.ItemArray[1].ToString().Length - 8) + ": non trovato nella tabella Rapporti", LogType.Operation);
                                NonTrovati.Rows.Add(db.getSocietaName(), drP.ItemArray[3].ToString(), "Non trovato nella tabella Rapporti", drP.ItemArray[1].ToString());
                            }
                        }
                    }
                }
                if (this.oledb.Connection.State.ToString().ToUpper() == "OPEN")
                {
                    output = this.oledb.CloseConnection();
                    bool flag1 = output.ToUpper() == "OK";
                }
                if (this.sql.Connection.State.ToString().ToUpper() == "OPEN")
                {
                    output = this.sql.CloseConnection();
                    bool flag2 = output.ToUpper() == "OK";
                }
            }

            string STOP_STOP = string.Empty;

            List <string> listfiles         = new List <string>();
            string        today             = string.Concat(new object[] { DateTime.Now.Day, "_", DateTime.Now.Month, "_", DateTime.Now.Year });
            string        _loggingDirectory = ConfigUtils.GetLogPath() + "logger";
            string        errorFile         = "errors.txt";

            if (File.Exists(_loggingDirectory + today + @"\" + errorFile))
            {
                listfiles.Add(_loggingDirectory + today + @"\" + errorFile);
            }
            errorFile = "operations.txt";
            if (File.Exists(_loggingDirectory + today + @"\" + errorFile))
            {
                listfiles.Add(_loggingDirectory + today + @"\" + errorFile);
            }
            string excelFile = MakeExcel();

            var files = new List <string>();

            files.Add(excelFile);
            //SendMail(files);
        }
Example #16
0
 public void Refr()
 {
     bs                      = new BindingSource();
     bs.DataSource           = GeispUtils.getDatabasesNames();
     GeispListBox.DataSource = bs;
 }