Пример #1
0
        //Initialise la DATAGRID
        private void InitialiserListeFlux()
        {
            //Initialiser Liste "Flux"
            dgv_FluxServeurs.AutoGenerateColumns = false;
            dgv_FluxServeurs.DataSource          = new BindingList <ServeurFlux>(ServeurFluxService.getLstServeursFlux(cdFlux));

            DataGridViewCell cell = new DataGridViewTextBoxCell();

            dgv_FluxServeurs.Columns.Add(new DataGridViewColumn()
            {
                CellTemplate = cell, Name = "codeFlux", DataPropertyName = "codeFlux", HeaderText = "Code Flux", Visible = false
            });
            dgv_FluxServeurs.Columns.Add(new DataGridViewColumn()
            {
                CellTemplate = cell, Name = "codeServeur", DataPropertyName = "codeServeur", HeaderText = "Code Serveur"
            });
            dgv_FluxServeurs.Columns.Add(new DataGridViewColumn()
            {
                CellTemplate = cell, Name = "adresseIP", DataPropertyName = "adresseIP", HeaderText = "Serveur"
            });
            dgv_FluxServeurs.Columns.Add(new DataGridViewColumn()
            {
                CellTemplate = cell, Name = "designation", DataPropertyName = "designation", HeaderText = "Designation", Visible = false
            });
            dgv_FluxServeurs.Columns.Add(new DataGridViewColumn()
            {
                CellTemplate = cell, Name = "cheminLocal", DataPropertyName = "cheminLocal", HeaderText = "Fichier"
            });

            dgv_FluxServeurs.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
        }
Пример #2
0
        private void bt_valider_Click(object sender, EventArgs e)
        {
            switch (etat)
            {
            case "AJOUTER":


                foreach (HeliosTransfert.Business.Dto.Serveur srv in lstserveur)
                {
                    if (srv.adresseIp.ToString() == cb_adresseIP.Text)
                    {
                        codeServeurNew = Convert.ToInt32(srv.codeServeur.ToString());
                    }
                }


                //Associe le Flux au serveur avec le chemin local
                ServeurFluxService.ajoutServeurFlux(cdFlux, codeServeurNew, tb_cheminLocal.Text, null);

                break;

            case "MODIFIER":


                foreach (HeliosTransfert.Business.Dto.Serveur srv in lstserveur)
                {
                    if (srv.adresseIp.ToString() == cb_adresseIP.Text)
                    {
                        codeServeurNew = Convert.ToInt32(srv.codeServeur.ToString());
                    }
                }


                //Modifie le chemin lcoal du flux
                ServeurFluxService.modifCdSRVServeurFlux(cdFlux, codeServeurOld, codeServeurNew, tb_cheminLocal.Text, null);



                break;

            case "SUPPRIMER":

                //Supprime le chemin locoal du flux
                ServeurFluxService.suppServeurFlux(Convert.ToInt32(ligne.Cells["codeServeur"].Value.ToString()), cdFlux);

                break;
            }


            //Désactive les boutons
            bt_valider.Visible = false;
            bt_annuler.Visible = false;

            bt_choisirChemin.Visible = false;

            //Désactive la modification des champs
            tb_designation.ReadOnly = true;
            tb_cheminLocal.ReadOnly = true;

            //Actualise la form
            this.Refresh();

            //Actualiser tableau
            dgv_FluxServeurs.DataSource = new BindingList <ServeurFlux>(ServeurFluxService.getLstServeursFlux(cdFlux));
        }