private void new_btn_Click(object sender, EventArgs e) { if (new_btn.Tag == null || !(bool)new_btn.Tag) { current = new Ecriture(); current.Colonnes = new List <ColumnEcriture>(); foreach (var item in servStructs.GetByEvenement(Convert.ToInt32(events_liste.SelectedValue.ToString()))) { current.Colonnes.Add(new ColumnEcriture { Champs = item }); } var liste = new List <Ecriture>(); liste.Add(current); bs.DataSource = new BindingList <ColumnEcriture>(current.Colonnes); columnsGrid.DataSource = bs; cle_tb.Clear(); num_tb.Clear(); ligneCondi_tb.Clear(); num_tb.ReadOnly = cle_tb.ReadOnly = false; ecritures_liste.Enabled = false; new_btn.Text = "A\nn\nn\nu\nl\ne\nr"; new_btn.Tag = true; } else { columnsGrid.DataSource = null; cle_tb.Clear(); num_tb.Clear(); ligneCondi_tb.Clear(); ecritures_liste.Enabled = true; ecritures_liste.SelectedIndex = -1; new_btn.Text = "N\no\nu\nv\ne\na\nu"; new_btn.Tag = false; } }
private void FillSumAvgList(int eventCode) { ServiceStructures servStruct = new ServiceStructures(); servStruct.Connector = this.Connector; var all = servStruct.GetByEvenement(eventCode); //Passer les parametres Numeric, pour calculer les sommes ou les moyennes var numeric_types = new string[] { "Entier", "Réel" }; sum_avg = (from param in all where numeric_types.Contains(param.Type) select param).ToList(); }
public List <Ecriture> GetByEvent(Evenement evenement) { servStruct.Connector = this.Connector; var structures = servStruct.GetByEvenement(evenement.Code); List <Ecriture> liste = new List <Ecriture>(); Ecriture obj; List <ColumnEcriture> colsEcr = new List <ColumnEcriture>(); //try //{ var cnx = Connector.GetConnection(); var cmd = cnx.CreateCommand(); cmd.CommandText = string.Format("select * from Ecritures_{0}", evenement.Libelle); Connector.GetConnection().Open(); var dr = cmd.ExecuteReader(); while (dr.Read()) { obj = new Ecriture(); obj.Cle = dr.GetInt32(0); obj.Numero = dr.GetInt32(1); obj.Condition = dr[2].ToString(); //Les colonnes foreach (var item in structures) { colsEcr.Add(new ColumnEcriture { Champs = item, Requette = dr[item.Champs].ToString() }); } obj.Colonnes = colsEcr; liste.Add(obj); } cnx.Close(); return(liste); //} //catch (Exception) //{ return null; } }
private void evenements_liste_SelectedIndexChanged(object sender, EventArgs e) { //Remplir la data Grid View par la structure(lES CHAMPS DE CET EVENT) int even = -1; if (int.TryParse(evenements_liste.SelectedValue.ToString(), out even)) { modifyField_grid.Rows.Clear(); liste = new BindingList <Parametre>(servStructs.GetByEvenement(even)); bs = new BindingSource(liste, null); structures_Grid.DataSource = bs; structures_Grid.CellMouseClick += structures_Grid_CellMouseClick; submit_btn.Enabled = false; } }
private void evenets_liste_SelectedIndexChanged(object sender, EventArgs e) { var even = (Evenement)evenets_liste.SelectedItem; //remplissage des conditions conditions_liste.DataSource = servCondi.GetByEvenement(even.Code); conditions_liste.DisplayMember = "Libelle"; conditions_liste.ValueMember = "Ref_Util"; //remplissage des champs(structure) de l'evenement champs_tree.Nodes.Clear(); outputs = servStructs.GetByEvenement(even.Code); foreach (var item in outputs) { var node = new TreeNode { Text = item.Champs, Tag = item }; champs_tree.Nodes.Add(node); } input_grid.Rows.Clear(); inputs.Clear(); }