public modif_alerte(alerte_class a, event_class eve, int id_user, AddEvent addev)
 {
     this.eve     = new event_class();
     this.eve     = eve;
     this.addev   = addev;
     this.id_user = id_user;
     this.al      = a;
     InitializeComponent();
     Date.Value = (al.gettemps());
     music.Text = al.getson();
 }
 public modif_alerte(alerte_class a, tache t, int id_user, modif_tache m)
 {
     this.eve     = null;
     this.t       = new tache();
     this.t       = t;
     this.m       = m;
     this.id_user = id_user;
     this.al      = a;
     InitializeComponent();
     Date.Value = (al.gettemps());
     music.Text = al.getson();
 }
Ejemplo n.º 3
0
        public void Modifier_aler_even_bdd(int id_alerte, alerte_class alerte)
        {
            CultureInfo   culture = CultureInfo.CreateSpecificCulture("en-En");
            SqlConnection con     = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\bdd.mdf;Integrated Security=True");
            String        query   = "update Alertes set temps=@temps,id_évèn=@id_évèn,id_utilis=@id_utilis,Son=@son WHERE id_alerte=@id";
            SqlCommand    cmd     = new SqlCommand(query, con);

            con.Open();
            cmd.Parameters.AddWithValue("@id", id_alerte.ToString());
            cmd.Parameters.AddWithValue("@temps", alerte.gettemps().ToString("G", culture));
            cmd.Parameters.AddWithValue("@id_évèn", alerte.getidévèn().ToString());
            cmd.Parameters.AddWithValue("@id_utilis", alerte.getidutilis().ToString());
            cmd.Parameters.AddWithValue("@son", alerte.getson());
            cmd.ExecuteNonQuery();
            con.Close();
        }
Ejemplo n.º 4
0
        public int inserer_alerte_even(alerte_class alerte)
        {
            int id_alerte = 0;

            try
            {
                CultureInfo   culture = CultureInfo.CreateSpecificCulture("en-En");
                SqlConnection con     = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\bdd.mdf;Integrated Security=True");
                String        query   = "INSERT INTO Alertes(temps,id_évèn,activer,son,id_utilis) output INSERTED.id_alerte VALUES ('" + alerte.gettemps().ToString("G", culture) + "','" + alerte.getidévèn().ToString() + "','" + /*activ*/ alerte.getactiver() + "','" + alerte.getson() + "','" + alerte.getidutilis() + "')";
                SqlCommand    cmd     = new SqlCommand(query, con);
                con.Open();

                id_alerte = (int)cmd.ExecuteScalar();
                con.Close();
                MessageBox.Show("Données enregistrées");
            }
            catch (Exception e)
            {
                MessageBox.Show(string.Concat("Erreur : ", e.Message));
            }
            setidalerte(id_alerte);
            return(id_alerte);
        }
        private void Creer_tache_planif(alerte_class a, String Design, DateTime planiftemp)
        {
            var startInfo = new ProcessStartInfo();

            startInfo.FileName        = "schtasks.exe";
            startInfo.UseShellExecute = false;
            String myfile     = @"<?xml version=""1.0"" encoding=""UTF-16""?>
              <Task version = ""1.2"" xmlns = ""http://schemas.microsoft.com/windows/2004/02/mit/task""  >
                         <RegistrationInfo >
                           <Date >" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + @"</Date >     
                           <Author > MAISONXP - PC\MAISON XP</Author >
                           <Description >Il faut réussir</Description >              
                                   </RegistrationInfo >
                                    <Triggers >                     
                                     <TimeTrigger >
                                       <StartBoundary > " + a.gettemps().ToString("yyyy-MM-ddTHH:mm:ss") + @" </StartBoundary >
                                               <Enabled > true </Enabled >
                                             </TimeTrigger >
                                           </Triggers >                              
                                           <Principals >
                                             <Principal>
                                                     <LogonType > InteractiveToken </LogonType >
                                                     <RunLevel > LeastPrivilege </RunLevel >
                                                   </Principal >
                                                 </Principals >
                                                 <Settings >
                                                   <MultipleInstancesPolicy > IgnoreNew </MultipleInstancesPolicy >
                                                   <DisallowStartIfOnBatteries > false </DisallowStartIfOnBatteries >
                                                   <StopIfGoingOnBatteries > false </StopIfGoingOnBatteries >
                                                   <AllowHardTerminate > true </AllowHardTerminate >                                    
                                                   <StartWhenAvailable > true </StartWhenAvailable >
                                                   <RunOnlyIfNetworkAvailable > false </RunOnlyIfNetworkAvailable >
                                                    <IdleSettings >                                  
                                                     <StopOnIdleEnd > true </StopOnIdleEnd >                                    
                                                     <RestartOnIdle > false </RestartOnIdle >                                    
                                                   </IdleSettings >                                    
                                                   <AllowStartOnDemand > true </AllowStartOnDemand >                                    
                                                   <Enabled > true </Enabled >                                    
                                                   <Hidden > false </Hidden >                                    
                                                   <RunOnlyIfIdle > false </RunOnlyIfIdle >                                    
                                                   <WakeToRun > true </WakeToRun >                                    
                                                   <ExecutionTimeLimit > P1D </ExecutionTimeLimit >                                    
                                                   <Priority > 7 </Priority >                                    
                                                 </Settings >                                    
                                                 <Actions Context = ""Author"" >                                     
                                                    <Exec >                                     
                                                      <Command > " + System.IO.Directory.GetCurrentDirectory() + @"\Affichage_alerte.exe" + @"</Command>                                        
                                                         <Arguments >" + @"""" + Design + @"""" + " " + @"""" + a.getson() + @"""" + " " + @"""" + planiftemp.ToString() + @"""" + @"</Arguments>                                           
                                                          </Exec >          
                                                     </Actions >
                                                      </Task > ";
            String pathString = System.IO.Directory.GetCurrentDirectory() + @"tachplanif.xml";

            System.IO.File.WriteAllText(pathString, myfile);
            startInfo.Arguments      = @"/Create /XML " + @"""" + pathString + @"""" + " /TN " + @"""" + Design + @"""";
            startInfo.CreateNoWindow = true;
            var p1 = Process.Start(startInfo);

            p1.WaitForExit();
        }