コード例 #1
0
        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();
        }
コード例 #2
0
 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();
 }
コード例 #3
0
 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();
 }
コード例 #4
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();
        }
コード例 #5
0
        public void afficher(List <event_class> list)
        {
            foreach (event_class con in list)
            {
                Grid Item = new Grid();
                //header
                StackPanel big = new StackPanel();
                big.Orientation         = Orientation.Horizontal;
                big.HorizontalAlignment = HorizontalAlignment.Left;
                big.Width = 1200;

                /*StackPanel info = new StackPanel();
                 * info.Orientation = Orientation.Horizontal;
                 * info.Width = 670;
                 * /*Label lbl = new Label();
                 * lbl.Content = con.get_des();
                 * CheckBox check = new CheckBox();
                 * info.Children.Add(check);
                 * check.Margin = new Thickness(5, 10, 5, 0);
                 * info.Children.Add(lbl);*/



                StackPanel info = new StackPanel();
                info.Orientation = Orientation.Horizontal;
                info.Width       = 470;

                Label lbl = new Label();
                lbl.Content = con.getDesig();
                CheckBox check = new CheckBox();
                info.Children.Add(check);

                check.Margin = new Thickness(17, 12, 5, 0);
                info.Children.Add(lbl);

                //add some buttons to header
                //modify
                StackPanel option = new StackPanel();
                option.Orientation         = Orientation.Horizontal;
                option.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                option.Width = 80;
                Button modif = new Button();
                Image  ch    = new Image();
                ch.Source = new BitmapImage(new Uri("modif.png", UriKind.Relative));

                modif.Content    = ch;
                modif.Height     = 30;
                modif.Width      = 30;
                modif.Background = null;
                modif.Click     += new RoutedEventHandler(modif_Click);
                option.Children.Add(modif);

                //delete button
                Button delete = new Button();
                Image  del    = new Image();
                del.Source        = new BitmapImage(new Uri("delete1.png", UriKind.Relative));
                delete.Click     += new RoutedEventHandler(delete_Click);
                delete.Content    = del;
                delete.Height     = 30;
                delete.Width      = 30;
                delete.Background = null;
                option.Children.Add(delete);
                big.Children.Add(info);
                //stack in the middle

                /* StackPanel mid = new StackPanel();
                 * mid.Width = 500;
                 * big.Children.Add(mid);*/
                option.Margin = new Thickness(600, -130, 0, 0);

                DropShadowBitmapEffect shadow = new DropShadowBitmapEffect();
                shadow.Direction  = 320;
                shadow.Opacity    = 0.6;
                Item.BitmapEffect = shadow;
                BrushConverter bc = new BrushConverter();
                Item.Background = (Brush)bc.ConvertFrom("#FFFFFF");

                big.Children.Add(option);
                Item.Children.Add(big);

                //grid of expander
                StackPanel bigstack = new StackPanel();
                bigstack.Width = 600;

                //priorité

                /*StackPanel stack1 = new StackPanel();
                 * stack1.Orientation = Orientation.Horizontal;
                 * Label symb1 = new Label();
                 * symb1.Content = "Priorité :"; ;
                 * symb1.Height = 30;
                 * symb1.Width = 122;
                 * Label lbl1 = new Label();
                 * lbl1.Content = con.get_prio();
                 * stack1.Children.Add(symb1);
                 * stack1.Children.Add(lbl1);
                 * stack1.Margin = new Thickness(0, 30, 0, 0);
                 * bigstack.Children.Add(stack1);*/

                //lieu

                StackPanel stack2 = new StackPanel();
                stack2.Orientation = Orientation.Horizontal;
                Label symb2 = new Label();
                symb2.Content = "Lieu :";;
                symb2.Height  = 30;
                symb2.Width   = 122;
                Label lbl2 = new Label();
                lbl2.Content = con.getLieu();
                stack2.Children.Add(symb2);
                stack2.Children.Add(lbl2);
                stack2.Margin = new Thickness(0, 30, 0, 0);
                bigstack.Children.Add(stack2);

                //temps

                StackPanel stack3 = new StackPanel();
                stack3.Orientation = Orientation.Horizontal;
                Label symb3 = new Label();
                symb3.Content = "Date :";;
                symb3.Height  = 30;
                symb3.Width   = 122;
                Label lbl3 = new Label();
                lbl3.Content = con.getDate().Date.ToString("dd/MM/yyyy");
                stack3.Children.Add(symb3);
                stack3.Children.Add(lbl3);
                bigstack.Children.Add(stack3);

                StackPanel stack4 = new StackPanel();
                stack4.Orientation = Orientation.Horizontal;
                Label symb4 = new Label();
                symb4.Content = "Heure Début :";;

                symb4.Width = 122;
                Label lbl4 = new Label();
                lbl4.Margin  = new Thickness(0, 1, 0, 0);
                lbl4.Content = con.getDate().ToString("HH:mm");
                stack4.Children.Add(symb4);
                stack4.Children.Add(lbl4);
                bigstack.Children.Add(stack4);

                StackPanel stack5 = new StackPanel();
                stack5.Orientation = Orientation.Horizontal;
                Label symb5 = new Label();
                symb5.Content = "Heure Fin :";;
                symb5.Height  = 30;
                symb5.Width   = 122;
                Label lbl5 = new Label();
                symb5.Margin = new Thickness(0, -10, 0, 0);
                lbl5.Content = con.getFin().ToString("HH:mm");
                stack5.Children.Add(symb5);
                stack5.Children.Add(lbl5);
                bigstack.Children.Add(stack5);
                bigstack.Margin = new Thickness(-500, 0, 0, 0);
                Item.Children.Add(bigstack);

                alerte_class a = con.get_alerte();
                if (a != null)
                {
                    StackPanel stackofalert = new StackPanel();

                    option.Margin            = new Thickness(600, -165, 0, 0);
                    stackofalert.Orientation = Orientation.Horizontal;
                    stackofalert.Width       = 1200;
                    Image reveil = new Image();
                    reveil.Source = new BitmapImage(new Uri("reveil.png", UriKind.Relative));
                    reveil.Height = 20;
                    reveil.Width  = 20;

                    stackofalert.Children.Add(reveil);
                    Label labl6 = new Label();
                    labl6.Content = a.gettemps().ToString("dd/MM/yyyy HH:mm");
                    stackofalert.Children.Add(labl6);
                    //modify
                    StackPanel options_alerte = new StackPanel();
                    options_alerte.Orientation         = Orientation.Horizontal;
                    options_alerte.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                    options_alerte.Width = 80;
                    Button modify = new Button();
                    Image  pen    = new Image();
                    pen.Source = new BitmapImage(new Uri("modif.png", UriKind.Relative));

                    modify.Content    = pen;
                    modify.Height     = 30;
                    modify.Width      = 30;
                    modify.Background = null;
                    modify.Click     += new RoutedEventHandler(modifyAlert_Click);
                    options_alerte.Children.Add(modify);


                    options_alerte.Margin = new Thickness(800, 0, 0, 0);
                    //delete button
                    Button supp = new Button();
                    Image  su   = new Image();
                    su.Source       = new BitmapImage(new Uri("delete1.png", UriKind.Relative));
                    supp.Click     += new RoutedEventHandler(deleteAlert_Click);
                    supp.Content    = su;
                    supp.Height     = 30;
                    supp.Width      = 30;
                    supp.Background = null;
                    options_alerte.Children.Add(supp);
                    stackofalert.Margin = new Thickness(100, 160, 0, 0);
                    stackofalert.Children.Add(options_alerte);
                    Item.Children.Add(stackofalert);
                }
                listBox.Items.Add(Item);
            }
        }
コード例 #6
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);
        }