private void bt_valider_Click(object sender, EventArgs e) { switch (etat) { case "AJOUT": //Ajoute Serveur ServeursService.ajoutServeur(tb_adresseIP.Text, tb_idtfFTP.Text, tb_mdpFTP.Text, tb_portFTP.Text, tb_portTRFT.Text, Convert.ToInt32(tb_codeClient.Text)); //Actualiser tableau InitialiserListeServeur(); break; case "MODIFIER": //Modifie les infos du serveur ServeursService.modifServeur(Convert.ToInt32(tb_codeServeur.Text), tb_adresseIP.Text, tb_idtfFTP.Text, tb_mdpFTP.Text, tb_portFTP.Text, tb_portTRFT.Text, Convert.ToInt32(tb_codeClient.Text)); //Actualiser tableau InitialiserListeServeur(); break; case "SUPPRIMER": //Supprime le serveur ServeursService.suppServeur(Convert.ToInt32(tb_codeServeur.Text)); //Actualiser tableau InitialiserListeServeur(); break; } //Désactive les boutons bt_valider.Visible = false; bt_annuler.Visible = false; //Actualise la form this.Refresh(); //Désactiver la modification des champs tb_adresseIP.ReadOnly = true; tb_portTRFT.ReadOnly = true; tb_idtfFTP.ReadOnly = true; tb_mdpFTP.ReadOnly = true; tb_portFTP.ReadOnly = true; tb_codeClient.ReadOnly = true; }
private void initialiserFenetre() { if (ServeursService.getnbreServeur() == 0) { nouveau = true; tb_adresseIp.Text = "localhost"; } else { tb_adresseIp.Text = ServeursService.getAdresseIp(1); tb_port.Text = ServeursService.getTrftPort(1); } }
private void bt_valider_Click(object sender, EventArgs e) { if (nouveau == true) { ServeursService.ajoutServeur(tb_adresseIp.Text, "0", "0", "0", tb_port.Text, 0); } else if (nouveau == false) { ServeursService.modifServeur(1, tb_adresseIp.Text, "0", "0", "0", tb_port.Text, 0); } //Bloque les champs tb_adresseIp.ReadOnly = true; tb_port.ReadOnly = true; //Désactive les boutons bt_valider.Visible = false; bt_annuler.Visible = false; //Actualise la form this.Refresh(); }
//Ajouter Serveur private void ajouterServeur() { //Vide les champs tb_codeServeur.Text = ServeursService.getcdServeurmax().ToString(); tb_adresseIP.Text = null; tb_portTRFT.Text = null; tb_idtfFTP.Text = null; tb_mdpFTP.Text = null; tb_portFTP.Text = null; tb_codeClient.Text = null; //Active la modification des champs tb_adresseIP.ReadOnly = false; tb_portTRFT.ReadOnly = false; tb_idtfFTP.ReadOnly = false; tb_mdpFTP.ReadOnly = false; tb_portFTP.ReadOnly = false; tb_codeClient.ReadOnly = false; //Affiche les boutons de validation bt_valider.Visible = true; bt_annuler.Visible = true; }
//Initialise la DATAGRID private void InitialiserListeServeur() { dgv_serveurs.AutoGenerateColumns = false; dgv_serveurs.DataSource = new BindingList <HeliosTransfert.Business.Dto.Serveur>(ServeursService.getServeurs()); DataGridViewCell cell = new DataGridViewTextBoxCell(); dgv_serveurs.Columns.Add(new DataGridViewColumn() { CellTemplate = cell, Name = "codeServeur", DataPropertyName = "codeServeur", HeaderText = "Code Serveur" }); dgv_serveurs.Columns.Add(new DataGridViewColumn() { CellTemplate = cell, Name = "adresseIP", DataPropertyName = "adresseIP", HeaderText = "Serveur" }); dgv_serveurs.Columns.Add(new DataGridViewColumn() { CellTemplate = cell, Name = "code_client_srv", DataPropertyName = "code_client_srv", HeaderText = "Code Client" }); dgv_serveurs.Columns.Add(new DataGridViewColumn() { CellTemplate = cell, Name = "ftpIdtf", DataPropertyName = "ftpIdtf", HeaderText = "FTP Identifiant" }); dgv_serveurs.Columns.Add(new DataGridViewColumn() { CellTemplate = cell, Name = "ftpMdp", DataPropertyName = "ftpMdp", HeaderText = "FTP Mot de Passe", Visible = false }); dgv_serveurs.Columns.Add(new DataGridViewColumn() { CellTemplate = cell, Name = "ftpPort", DataPropertyName = "ftpPort", HeaderText = "FTP Port" }); dgv_serveurs.Columns.Add(new DataGridViewColumn() { CellTemplate = cell, Name = "trftPort", DataPropertyName = "trftPort", HeaderText = "TRFT Port" }); dgv_serveurs.SelectionMode = DataGridViewSelectionMode.FullRowSelect; }