//------------------------------------------------------------------------- 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); }
private void m_menuAjouterChampDonnee_Click(object sender, EventArgs e) { Type tp = m_structureExport.TypeSource; if (m_tableVue == null) { return; } if (m_tableVue.ChampOrigine != null) { tp = m_tableVue.ChampOrigine.TypeDonnee.TypeDotNetNatif; } CDefinitionProprieteDynamique[] defs = CFormSelectChampPourStructure.SelectProprietes( tp, CFormSelectChampPourStructure.TypeSelectionAttendue.ChampParent, m_tableVue.ChampOrigine, m_fournisseur); 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); } }
public CResultAErreur Serialize(C2iSerializer serializer) { int nVersion = GetNumVersion(); CResultAErreur result = serializer.TraiteVersion(ref nVersion); if (!result) { return(result); } result = serializer.TraiteObject <C2iExpression>(ref m_formuleFiltre); if (!result) { return(result); } serializer.TraiteInt(ref m_nDelaiMasquageTerminees); if (nVersion < 1) { List <CDefinitionProprieteDynamique> lstTmp = new List <CDefinitionProprieteDynamique>(); result = serializer.TraiteListe <CDefinitionProprieteDynamique>(lstTmp); } else if (nVersion < 2) { //Transformation de la liste de "CFormuleNommee" en liste de "C2iCHampExport" if (m_listeColonnes == null) { m_listeColonnes = new List <C2iChampExport>(); } List <CFormuleNommee> tmpListe = new List <CFormuleNommee>(); result = serializer.TraiteListe <CFormuleNommee>(tmpListe); if (result) { foreach (CFormuleNommee formule in tmpListe) { C2iChampExport tmpChamp = new C2iChampExport(); tmpChamp.Origine = new C2iOrigineChampExportExpression(formule.Formule); tmpChamp.NomChamp = formule.Libelle; m_listeColonnes.Add(tmpChamp); } } } else { if (m_listeColonnes == null) { m_listeColonnes = new List <C2iChampExport>(); } result = serializer.TraiteListe <C2iChampExport>(m_listeColonnes); } if (!result) { return(result); } return(result); }
//------------------------------------------------------------------------- private bool EditChamp(C2iChampExport champ) { if (champ.Origine is C2iOrigineChampExportExpression) { //return CFormEditChampCalcule.EditeChamp(champ, m_typeObjet, m_elementAVariablesPourFiltre != null ? (IFournisseurProprietesDynamiques)m_elementAVariablesPourFiltre : new CFournisseurPropDynStd(true)); return(CFormEditChampCalcule.EditeChamp(champ, m_typeObjet, new CFournisseurPropDynStd(true))); } return(false); }
/// ////////////////////////////////////////////////////// public static bool EditeChamp(C2iChampExport champ, Type typeDonnees) { CFormEditOrigineChampCustom form = new CFormEditOrigineChampCustom(); form.Init(champ, typeDonnees); Boolean bOk = form.ShowDialog() == DialogResult.OK; form.Dispose(); return(bOk); }
//------------------------------------------------------------------------- private bool EditChamp(C2iChampExport champ) { if (champ.Origine is C2iOrigineChampExportExpression) { if (champ.Origine is C2iOrigineChampExportExpression) { return(CFormEditChampCalcule.EditeChamp(champ, typeof(DataTable), m_fournisseur)); } } return(false); }
//-------------------------------------------------------------------------- private void m_menuAjouterChampCalcule_Click(object sender, EventArgs e) { C2iChampExport champ = new C2iChampExport(); champ.Origine = new C2iOrigineChampExportExpression(); champ.NomChamp = "Champ " + m_wndListeChamps.Items.Count; if (EditChamp(champ)) { ListViewItem item = new ListViewItem(); FillItemForChamp(item, champ); m_wndListeChamps.Items.Add(item); } }
//-------------------------------------------------------------------------- private void m_menuAjouterChampDonnee_Click(object sender, EventArgs e) { CDefinitionProprieteDynamique[] defs = CFormSelectChampPourStructure.SelectProprietes(m_typeObjet, CFormSelectChampPourStructure.TypeSelectionAttendue.ChampParent, m_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 void m_menuAjouterChampsPersonnalisés_Click(object sender, EventArgs e) { C2iChampExport champ = new C2iChampExport(); champ.Origine = new C2iOrigineChampExportChampCustom(); champ.NomChamp = "CUSTOM_FIELDS"; if (EditChamp(champ)) { ListViewItem item = new ListViewItem(); FillItemForChamp(item, champ); m_wndListeChamps.Items.Add(item); } }
/// ////////////////////////////////////////////////////// public static bool EditeChamp(C2iChampExport champ, Type typeDonnees, IFournisseurProprietesDynamiques fournisseur) { CFormEditChampCalcule form = new CFormEditChampCalcule(); if (fournisseur != null) { form.m_fournisseurProprietes = fournisseur; } form.Init(champ, typeDonnees); Boolean bOk = form.ShowDialog() == DialogResult.OK; form.Dispose(); return(bOk); }
//------------------------------------------ public CResultAErreur MajChamps() { CResultAErreur result = CResultAErreur.True; m_ListChampsExport.Clear(); foreach (ListViewItem item in m_wndListeChamps.Items) { if (item.Tag is C2iChampExport) { C2iChampExport champ = (C2iChampExport )item.Tag; m_ListChampsExport.Add(champ); } } return(result); }
private void m_wndListeChamps_MouseMove(object sender, MouseEventArgs e) { ListViewItem item = m_wndListeChamps.GetItemAt(e.X, e.Y); if (item != null && item != m_lastItemTooltip) { if (item.Tag is C2iChampExport) { C2iChampExport champ = (C2iChampExport)item.Tag; if (champ.Origine is C2iOrigineChampExportChamp) { m_tooltip.SetToolTip(m_wndListeChamps, ((C2iOrigineChampExportChamp)champ.Origine).ChampOrigine.Nom); return; } if (champ.Origine is C2iOrigineChampExportExpression) { C2iExpression formule = ((C2iOrigineChampExportExpression)champ.Origine).Expression; if (formule != null) { m_tooltip.SetToolTip(m_wndListeChamps, formule.GetString()); return; } } } else if (item.Tag is CInfoChampTable) { m_tooltip.SetToolTip(m_wndListeChamps, ((CInfoChampTable)item.Tag).NomConvivial); return; } else if (item.Tag is C2iChampDeRequete) { C2iChampDeRequete champ = (C2iChampDeRequete)item.Tag; string strInfo = "Origin : " + champ.GetStringSql() + "\r\n" + "Operation : " + champ.OperationAgregation.ToString() + "\r\n" + "Group by : " + (champ.GroupBy ? "Yes" : "No"); m_tooltip.SetToolTip(m_wndListeChamps, strInfo); return; } m_lastItemTooltip = item; } m_tooltip.SetToolTip(m_wndListeChamps, ""); }
//------------------------------------------ public CResultAErreur MajChamps() { CResultAErreur result = CResultAErreur.True; if (m_tableVue == null) { result.EmpileErreur(I.T("Bad table format|20003")); return(result); } m_tableVue.NomTable = m_txtNomTable.Text; // Table normale m_tableVue.ClearChamps(); foreach (ListViewItem item in m_wndListeChamps.Items) { if (item.Tag is C2iChampExport) { C2iChampExport champ = (C2iChampExport )item.Tag; m_tableVue.AddChamp(champ); } } m_tableVue.SupprimerTablesTravail = m_chkSupprimerTablesTravail.Checked; return(result); }
/// ////////////////////////////////////////////////////// private void Init(C2iChampExport champ, Type typeDonnees) { m_champ = champ; m_typeDonnees = typeDonnees; }
//------------------------------------------------------------------------- private void FillItemForChamp(ListViewItem item, C2iChampExport champ) { item.Text = champ.NomChamp; item.ImageIndex = (champ.Origine is C2iOrigineChampExportExpression) ? 1 : 0; item.Tag = champ; }