//-------------------------------------------------------------------------- private void m_menuAjouterChampDonnee_Click(object sender, EventArgs e) { Type tp = m_structureExport.TypeSource; if (m_tableExport == null || !(m_tableExport is C2iTableExport)) { return; } C2iTableExport table = (C2iTableExport)m_tableExport; if (m_tableExport != null && table.ChampOrigine != null) { tp = table.ChampOrigine.TypeDonnee.TypeDotNetNatif; } CDefinitionProprieteDynamique[] defs = CFormSelectChampPourStructure.SelectProprietes(tp, CFormSelectChampPourStructure.TypeSelectionAttendue.ChampParent, table.ChampOrigine); foreach (CDefinitionProprieteDynamique def in defs) { C2iChampExport champ = new C2iChampExport(); champ.Origine = new C2iOrigineChampExportChamp(def); champ.NomChamp = def.Nom; ListViewItem item = new ListViewItem(); FillItemForChamp(item, champ); m_wndListeChamps.Items.Add(item); } }
//------------------------------------------------------------------------- private bool EditChamp(C2iChampExport champ) { if (champ.Origine is C2iOrigineChampExportExpression || champ.Origine is C2iOrigineChampExportChampCustom) { Type tp = m_structureExport.TypeSource; if (m_tableExport is C2iTableExport) { C2iTableExport table = (C2iTableExport)m_tableExport; if (table.ChampOrigine != null) { tp = table.ChampOrigine.TypeDonnee.TypeDotNetNatif; } if (champ.Origine is C2iOrigineChampExportExpression) { return(CFormEditChampCalcule.EditeChamp(champ, tp, m_elementAVariablesPourFiltre != null ? (IFournisseurProprietesDynamiques)m_elementAVariablesPourFiltre : new CFournisseurPropDynStd(true))); } if (champ.Origine is C2iOrigineChampExportChampCustom) { return(CFormEditOrigineChampCustom.EditeChamp(champ, tp)); } } } return(false); }
//------------------------------------------ public CResultAErreur MajChamps() { CResultAErreur result = CResultAErreur.True; if (m_tableExport == null) { result.EmpileErreur(I.T("Bad table format|20003")); return(result); } /*if ( !m_gestionnaireModeEdition.ModeEdition ) * { * result.EmpileErreur(I.T("Bad table format|20003")); * return result; * }*/ m_tableExport.NomTable = m_txtNomTable.Text; // Table normale if (m_tableExport is C2iTableExport) { C2iTableExport tableExport = (C2iTableExport)m_tableExport; tableExport.ClearChamps(); foreach (ListViewItem item in m_wndListeChamps.Items) { if (item.Tag is C2iChampExport) { C2iChampExport champ = (C2iChampExport )item.Tag; tableExport.AddChamp(champ); } } } return(result); }
/// <summary> /// Convertit une liste de colonnes GLColumn en structure d'export /// </summary> /// <param name="colonnes"></param> /// <returns></returns> public static C2iStructureExport ConvertToStructureExport(Type typeExporte, GLColumn[] colonnes) { CResultAErreur result = CResultAErreur.True; C2iStructureExport structure = new C2iStructureExport( ); structure.TypeSource = typeExporte; C2iTableExport table = new C2iTableExport(); structure.Table = table; table.NomTable = "Data_Export"; foreach (GLColumn col in colonnes) { CDefinitionProprieteDynamique defProp = GetDefinitionProprieteDynamiqueForExport(col.Propriete); if (defProp != null) { C2iOrigineChampExportChamp origine = new C2iOrigineChampExportChamp(defProp); C2iChampExport champ = new C2iChampExport(); champ.Origine = origine; champ.NomChamp = col.Text; table.AddChamp(champ); } } return(structure); }
//------------------------------------------ public CResultAErreur InitChamps( ITableExport table, ITableExport tableParente, C2iStructureExport structure, IElementAVariablesDynamiquesAvecContexteDonnee eltAVariablesPourFiltre) { CResultAErreur result = CResultAErreur.True; m_tableExport = table as C2iTableExport; m_tableParente = tableParente; m_structureExport = structure; m_elementAVariablesPourFiltre = eltAVariablesPourFiltre; if (m_tableExport == null) { result.EmpileErreur(I.T("Bad table format|20003")); return(result); } InitChamps(); return(result); }