Exemplo n.º 1
0
        private void DeleteUserAction(object sender, RoutedEventArgs e)
        {
            if (fieldResults.SelectedIndex != -1)
            {
                Debug.WriteLine(fieldResults.SelectedValue.ToString());

                string xmlmessage = "<user>" +
                                    $"<cn>{fieldResults.SelectedValue.ToString()}</cn>" +
                                    "<method>READ</method>" +
                                    "<goal>DELETE</goal>" +
                                    "<origin>GUI</origin>" +
                                    "<timestamp>" + DateTime.Now.ToString() + "</timestamp>" +
                                    "</user>";

                if (ProducerGUI.send(xmlmessage, Severity.AD.ToString())
                    )
                {
                    MessageBox.Show("User succesfully deleted!");
                    btnCreateUser.IsEnabled = btnDeleteUser.IsEnabled = btnUpdateUser.IsEnabled = false;
                }
            }
            else
            {
                MessageBox.Show("Select a user first!");
            }
        }
Exemplo n.º 2
0
        private void GetAllUsersAction(object sender, RoutedEventArgs e)
        {
            fieldResults.Items.Clear();
            try
            {
                string xmlmessage = "<user><header>" +
                                    "<UUID>Not Set</UUID>" +
                                    "<method>READ_ALL</method>" +
                                    "<origin>GUI</origin>" +
                                    "<version>0</version>" +
                                    "<sourceEntityId>Not Set</sourceEntityId>" +
                                    "<timestamp>" + DateTime.Now.ToString() + "</timestamp>" +
                                    "</header>" +
                                    "<body>" +
                                    "<firstname>Not Set</firstname>" +
                                    "<lastname>Not Set</lastname>" +
                                    "<email>Not Set</email>" +
                                    "<birthday>Not Set</birthday>" +
                                    "<role>Not Set</role>" +
                                    "<study>Not Set</study>" +
                                    "</body></user>";

                //Console.WriteLine(XMLParser.ObjectToXML(Program.GetADUsers()));
                ProducerGUI.send(xmlmessage, Severity.AD.ToString());



                //List<ADUser> l = null;

                /*
                 * if (l != null)
                 * {
                 *  l.ForEach(x => fieldResults.Items.Add($"CN={x.CN}"));
                 * }
                 * else
                 * {
                 *  MessageBox.Show("No User found or Database not connected!");
                 * }*/
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            btnCreateUser.IsEnabled = btnDeleteUser.IsEnabled = btnUpdateUser.IsEnabled = true;
        }