コード例 #1
0
ファイル: Service1.cs プロジェクト: Oceannevss/Mission4GSB
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                //Connexion a la base de données gsb_frais
                myConnexion = (ConnexionSql)ConnexionSql.GetInstance("localhost", "gsb_frais", "root", "");
                myConnexion.openConnection();

                //recuperation de la date du jour
                int jour = Int32.Parse(DateTime.Now.ToString("dd"));


                if (jour <= 10)
                {
                    //Requete qui permet de mettre à jour l'état d'une fiche frais en fonction de la date
                    myConn = myConnexion.reqExec("Update fichefrais set idEtat = 'CL' where mois = " + date.dateMoisPrecedent() + " and idEtat = 'CR'");
                    myConn.ExecuteNonQuery();
                }

                if (jour >= 20)
                {
                    myConn = myConnexion.reqExec("Update fichefrais set idEtat = 'RB' where mois = " + date.dateMoisPrecedent() + " and idEtat = 'VA'");
                    myConn.ExecuteNonQuery();
                }
                //fermeture de la connexion
                myConnexion.closeConnection();
            }
            catch (Exception emp)
            {
                throw (emp);
            }
        }
コード例 #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                maConnexion = ConnexionSql.getInstance("localhost", "gsb", "root", "");
                dateJour    = Convert.ToInt32(GD.getJour());


                if (dateJour >= 1 && dateJour <= 10)
                {
                    maConnexion.openConnection();

                    maCo = maConnexion.reqExec("update fichefrais set idEtat ='CL' where idEtat ='CR' and mois = '" + GD.getDateMoisPrecedent() + "'");
                    maCo.ExecuteNonQuery();

                    maCo = maConnexion.reqExec("Select * from fichefrais where mois='" + dateTest + "'");
                    maConnexion.closeConnection();
                }
                else if (dateJour >= 20 && dateJour <= 31)
                {
                    maConnexion.openConnection();

                    maCo = maConnexion.reqExec("update fichefrais set idEtat ='VA' where idEtat ='RB' and mois = '" + GD.getDateMoisPrecedent() + "'");
                    maCo.ExecuteNonQuery();
                    dateTest = GD.getDateMoisPrecedent();

                    maCo = maConnexion.reqExec("Select * from fichefrais where mois='" + dateTest + "'");
                    maConnexion.closeConnection();
                }
            }
            catch (Exception emp)
            {
                throw (emp);
            }
        }
コード例 #3
0
        public void updateRB(GestionDate date)
        {
            try
            {
                maConnexionSql = ConnexionSql.GetInstance(Fabrique.ProviderMysql, Fabrique.DataBaseMysql
                                                          , Fabrique.UidMysql, Fabrique.MdpMysql);

                maConnexionSql.openConnection();

                myConn = maConnexionSql.reqExec("Update fichefrais set idEtat = 'RB' where mois = "
                                                + date.dateMoisPrecedent()
                                                + " and idEtat = 'VA'");

                myConn.ExecuteNonQuery();
            }
            catch (Exception emp)
            {
                throw (emp);
            }
        }