コード例 #1
0
        private void btnDeleteClient_Click(object sender, RoutedEventArgs e)
        {
            if (listBoxClient.SelectedItems != null)
            {
                OVClient ovClient = new OVClient();
                ovClient = (OVClient)listBoxClient.SelectedItem;
                string IdClientDelete = ovClient.Identifiant.ToString();

                string connectionString = "SERVER=localhost" + ";" + "DATABASE=megacastingv2" + ";" + "UID=root" + ";" + "PASSWORD="******";";
                string Query            = @"DELETE FROM client WHERE Identifiant ='" + IdClientDelete + "';";

                MySqlConnection MyConn    = new MySqlConnection(connectionString);
                MySqlCommand    MyCommand = new MySqlCommand(Query, MyConn);
                MySqlDataReader MyReader;
                MyConn.Open();
                MyReader = MyCommand.ExecuteReader();

                //Rafraichir listBoxClient
                ListClients.Remove(ovClient);

                MessageBox.Show("Client Supprimé !");
            }
            else
            {
                MessageBox.Show("Sélectionner un élément");
            }
        }
コード例 #2
0
        public IActionResult Index()
        {
            var model = new ListClients();

            model.Clients = _context.Client.Include(c => c.Address).ToList();

            return(View("ClientListView", model));
        }
コード例 #3
0
        public MainWindow()
        {
            InitializeComponent();

            ListClients newPage = new ListClients();

            pageTransitionControl.ShowPage(newPage);
            cboDate.Content = DateTime.Now.ToString("dd MMMM yyyy");
            lbTime.Content  = DateTime.Now.ToString("hh:mm:ss tt");
        }
コード例 #4
0
        private void UpdateListClients()
        {
            List <clients> AllClients = Srv.GetAllClients();

            foreach (clients cli in AllClients)
            {
                ClientViewModel newCli = new ClientViewModel(Srv, cli);
                ListClients.Add(newCli);
            }
        }
コード例 #5
0
 /// <summary>
 /// 收到客户端上线信息
 /// </summary>
 /// <param name="clientAddress"></param>
 private void ReceiveClientOnline(string clientAddress)
 {
     if (App.Current == null)
     {
         return;
     }
     App.Current.Dispatcher.Invoke(() =>
     {
         ListClients.Add(clientAddress);
     });
 }
コード例 #6
0
        //CHAMP ONGLET CLIENT
        private void btnAddClient_Click(object sender, RoutedEventArgs e)
        {
            if ((MessageBox.Show("Êtes-vous sûr de vouloir créer un nouveau client?", "Warning ! Ajout d'un nouveau client", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes))
            {
                MainWindow dialog = new MainWindow();

                try
                {
                    OVClient ovClient = new OVClient();
                    ovClient.NomEntreprise       = this.tbNomEts.Text;
                    ovClient.NomResponsable      = this.tbNomResp.Text;
                    ovClient.PrenomResponsable   = this.tbPrenomResp.Text;
                    ovClient.CiviliteResponsable = this.cbCivResp.Text;
                    ovClient.RueEntreprise       = this.tbRueEnt.Text;
                    ovClient.CpEntreprise        = int.Parse(this.tbCpEnt.Text);
                    ovClient.VilleEntreprise     = tbVilleEnt.Text;
                    ovClient.MailEntreprise      = this.tbMailEnt.Text;
                    ovClient.FaxEntreprise       = this.tbFaxEnt.Text;
                    ovClient.TelephoneEntreprise = this.tbTelephoneEnt.Text;


                    string connectionString = "SERVER=localhost" + ";" + "DATABASE=megacastingv2" + ";" + "UID=root" + ";" + "PASSWORD="******";";
                    string Query            = @"INSERT INTO client (NomEntreprise, NomResponsable, PrenomResponsable, CiviliteResponsable, RueEntreprise, CpEntreprise, VilleEntreprise, MailEntreprise, FaxEntreprise, TelephoneEntreprise) values('" + ovClient.NomEntreprise + "','" + ovClient.NomResponsable + "','" + ovClient.PrenomResponsable + "','" + ovClient.CiviliteResponsable + "','" + ovClient.RueEntreprise + "','" + ovClient.CpEntreprise + "','" + ovClient.VilleEntreprise + "','" + ovClient.MailEntreprise + "','" + ovClient.FaxEntreprise + "','" + ovClient.TelephoneEntreprise + "');";


                    MySqlConnection MyConn    = new MySqlConnection(connectionString);
                    MySqlCommand    MyCommand = new MySqlCommand(Query, MyConn);
                    MySqlDataReader MyReader;
                    MyConn.Open();
                    MyReader = MyCommand.ExecuteReader();

                    //Vider donnnées apres insertion
                    tbNomEts.Text       = string.Empty;
                    tbNomResp.Text      = string.Empty;
                    tbPrenomResp.Text   = string.Empty;
                    cbCivResp.Text      = string.Empty;
                    tbRueEnt.Text       = string.Empty;
                    tbCpEnt.Text        = string.Empty;
                    tbVilleEnt.Text     = string.Empty;
                    tbMailEnt.Text      = string.Empty;
                    tbTelephoneEnt.Text = string.Empty;
                    tbFaxEnt.Text       = string.Empty;

                    //Rafraichir listBoxClient
                    ListClients.Add(ovClient);
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
コード例 #7
0
        private void btnFollowUp_Click(object sender, RoutedEventArgs e)
        {
            //  FollowUp follow = new FollowUp();
            launcherFlag = 1;
            ListClients newPage = new ListClients(launcherFlag);

            pageTransitionControl.ShowPage(newPage); // to comment
            //Change Background
            btnNewClient.Background = Brushes.White;
            btnScreening.Background = Brushes.White;
            btnFollowUp.Background  = Brushes.LightGray;
            button_Copy2.Background = Brushes.White;
        }
コード例 #8
0
        private void button_Copy2_Click(object sender, RoutedEventArgs e)
        {
            // ClinicVisit clinic = new ClinicVisit();///that may come back
            launcherFlag = 2;
            ListClients newPage = new ListClients(launcherFlag);

            pageTransitionControl.ShowPage(newPage); // to comment
            //Change Background
            btnNewClient.Background = Brushes.White;
            btnScreening.Background = Brushes.White;
            btnFollowUp.Background  = Brushes.White;
            button_Copy2.Background = Brushes.LightGray;
        }
コード例 #9
0
        public async Task <IActionResult> IndexSearch(string search)
        {
            if (!String.IsNullOrEmpty(search))
            {
                var Clients = await _context.Clients
                              .Where(t => t.Name.Contains(search) || t.Email.Contains(search))
                              .ToListAsync();

                var model = new ListClients();
                model.Clients = Clients;
                return(View("ClientListView", model));
            }

            return(RedirectToAction("Index"));
        }
コード例 #10
0
 public void UnRegisterClient([FromBody] Client client)
 {
     try
     {
         ListClients.removeClient(client);
     }
     catch (Exception)
     {
         HttpResponseMessage resMessage = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest)
         {
             Content = new StringContent($"Failed unregister this client with the port num {client.port}")
         };
         logger.LogFunc($"Failed to remove the client with the port {client.port}");
         throw new HttpResponseException(resMessage);
     }
 }
コード例 #11
0
 public void RegisterClient([FromBody] Client client)
 {
     try
     {
         ListClients.addClient(client);
     }
     catch (Exception)//Catching all exceptions here as I don't know the specifics
     {
         HttpResponseMessage resMessage = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest)
         {
             Content = new StringContent($"Failed to add the client with the port {client.port}")
         };
         logger.LogFunc($"Failed to add the client with the port {client.port}");
         throw new HttpResponseException(resMessage);
     }
 }
コード例 #12
0
        private void HomePage_Click_1(object sender, RoutedEventArgs e)
        {
            ListClients newPage = new ListClients();

            pageTransitionControl.ShowPage(newPage);
        }
コード例 #13
0
 public void Nouveau()
 {
     ClientCourant = Client.GetNewClient();
     ListClients.Add(ClientCourant);
 }
コード例 #14
0
 public Clients()
 {
     InitializeComponent();
     listClient = new ListClients();
     this.OpenForms(listClient);
 }