//////////////////////////////////////////// private void OnChangeExpression(string strTexte, ref C2iExpression expToSet, CComboboxAutoFilled combo) { CContexteAnalyse2iExpression ctx = new CContexteAnalyse2iExpression(ActionSynchronisme.Process, typeof(CProcess)); CResultAErreur result = new CAnalyseurSyntaxiqueExpression(ctx).AnalyseChaine(strTexte); if (result) { ArrayList lstChamps = new ArrayList(); expToSet = (C2iExpression)result.Data; Type tp = expToSet.TypeDonnee.TypeDotNetNatif; CStructureTable structure = null; try { structure = CStructureTable.GetStructure(tp); ArrayList lst = new ArrayList(); foreach (CInfoChampTable champ in structure.Champs) { if (champ.TypeDonnee == typeof(DateTime) || champ.TypeDonnee == typeof(DateTime?)) { lst.Add(champ); } } //Cherche les champs custom if (typeof(CElementAChamp).IsAssignableFrom(tp)) { //Crée les infos champ custom pour le type using (CContexteDonnee contexte = new CContexteDonnee( CSessionClient.GetSessionUnique().IdSession, true, false)) { string strCodeRole = CRoleChampCustom.GetRoleForType(tp).CodeRole; CListeObjetsDonnees listeChamps = CChampCustom.GetListeChampsForRole( contexte, strCodeRole); new CListeObjetsDonnees(contexte, typeof(CChampCustom)); listeChamps.Filtre = new CFiltreData( CChampCustom.c_champType + "=@1", (int)TypeDonnee.tDate); foreach (CChampCustom champ in listeChamps) { CInfoChampTable info = new CInfoChampTable( CSynchronismeDonnees.c_idChampCustom + champ.Id.ToString(), typeof(DateTime), 0, false, false, true, false, true); info.NomConvivial = champ.Nom; lst.Add(info); } } } combo.ListDonnees = lst; } catch { } } }
private void CControlActionReleve_Load(object sender, EventArgs e) { //Cherche les champs relevé CListeObjetsDonnees lst = CChampCustom.GetListeChampsForRole(CContexteDonneeSysteme.GetInstance(), CReleveEquipement.c_roleChampCustom); if (lst.Count == 0) { m_panelReleve.Height = m_lblSerialReleve.Height; m_panelOriginal.Height = m_lblSerialDB.Height; Height = m_panelReleve.Height + m_panelOriginal.Height; m_panelChampsOriginaux.Visible = false; m_panelChampsReleve.Visible = false; } else { foreach (CChampCustom champ in lst) { CControleForCustomFieldReleve ctrl = new CControleForCustomFieldReleve(); ctrl.Init(champ); m_panelChampsReleve.Controls.Add(ctrl); ctrl.Dock = DockStyle.Left; ctrl.LockEdition = true; ctrl.OnValueChanged += new EventHandler(ctrlCustom_OnValueChanged); ctrl = new CControleForCustomFieldReleve(); ctrl.Init(champ); m_panelChampsOriginaux.Controls.Add(ctrl); ctrl.Dock = DockStyle.Left; ctrl.LockEdition = true; } m_panelChampsOriginaux.Visible = true; m_panelChampsReleve.Visible = true; } }
private void CFormEditVariableFiltreCalculee_Load(object sender, System.EventArgs e) { // Lance la traduction du formulaire sc2i.win32.common.CWin32Traducteur.Translate(this); CRoleChampCustom role = CRoleChampCustom.GetRoleForType(m_typeDonnees); if (role != null) { CListeObjetsDonnees listeChamps = CChampCustom.GetListeChampsForRole(CSc2iWin32DataClient.ContexteCourant, role.CodeRole); listeChamps.Tri = CChampCustom.c_champNom; m_wndListeChamps.ListeSource = listeChamps; Dictionary <int, bool> lstChecks = new Dictionary <int, bool>(); if (!(m_champ.Origine is C2iOrigineChampExportChampCustom)) { m_champ.Origine = new C2iOrigineChampExportChampCustom(); } m_champ.NomChamp = "CUSTOM_FIELDS"; C2iOrigineChampExportChampCustom origineChamp = (C2iOrigineChampExportChampCustom)m_champ.Origine; foreach (int nId in origineChamp.IdsChampCustom) { lstChecks[nId] = true; } for (int nChamp = 0; nChamp < listeChamps.Count; nChamp++) { CChampCustom champ = (CChampCustom)listeChamps[nChamp]; if (lstChecks.ContainsKey(champ.Id)) { m_wndListeChamps.CheckItem(nChamp); } } } }
//------------------------------------------------------------------------- private void FillListeChamps(CRestrictionUtilisateurSurType restriction) { m_wndListeChamps.BeginUpdate(); m_wndListeChamps.Items.Clear(); CInfoStructureDynamique info = CInfoStructureDynamique.GetStructure(restriction.TypeAssocie, 0); List <ListViewItem> lstItems = new List <ListViewItem>(); foreach (CInfoChampDynamique champ in info.Champs) { string strTmp = ""; CDefinitionProprieteDynamique def = CConvertisseurInfoStructureDynamiqueToDefinitionChamp.GetDefinitionProprieteDynamique(champ.NomPropriete, ref strTmp); //Uniquement les propriétés "classiques" //voir CTimosApp.GetStructure if (def != null && typeof(CDefinitionProprieteDynamiqueDotNet).IsAssignableFrom(def.GetType())) { ListViewItem item = new ListViewItem(); item.Text = champ.NomChamp; item.Tag = def.NomProprieteSansCleTypeChamp; item.ImageIndex = GetIndexImage(restriction.GetRestriction(def.NomProprieteSansCleTypeChamp)); lstItems.Add(item); } } lstItems.Sort((x, y) => x.Text.CompareTo(y.Text)); if (typeof(IElementAChamps).IsAssignableFrom(restriction.TypeAssocie)) { CRoleChampCustom role = CRoleChampCustom.GetRoleForType(restriction.TypeAssocie); if (role != null) { CListeObjetsDonnees listeChampsCustom = CChampCustom.GetListeChampsForRole(CContexteDonneeSysteme.GetInstance(), role.CodeRole); foreach (CChampCustom champ in listeChampsCustom) { ListViewItem item = new ListViewItem(); item.Text = champ.Nom; item.Tag = champ.CleRestriction; item.ImageIndex = GetIndexImage(restriction.GetRestriction(champ.CleRestriction)); lstItems.Add(item); } lstItems.Sort((x, y) => x.Text.CompareTo(y.Text)); CListeObjetsDonnees listeFormulaires = new CListeObjetsDonnees(CContexteDonneeSysteme.GetInstance(), typeof(CFormulaire)); listeFormulaires.Filtre = CFormulaire.GetFiltreFormulairesForRole(role.CodeRole); foreach (CFormulaire formulaire in listeFormulaires) { ListViewItem item = new ListViewItem(); item.Text = "{" + formulaire.Libelle + "}"; item.Tag = formulaire.CleRestriction; item.ImageIndex = GetIndexImage(restriction.GetRestriction(formulaire.CleRestriction)); lstItems.Add(item); } } } m_wndListeChamps.Items.AddRange(lstItems.ToArray()); m_wndListeChamps.EndUpdate(); }
private void FillListeChamps() { if (m_parametre == null) { m_parametre = new CParametreRemplissageActiviteParIntervention(); } m_panelFormules.SuspendDrawing(); foreach (Control ctrl in m_panelFormules.Controls) { if (ctrl is CEditeurFormuleNommee) { ctrl.Visible = false; m_reserveEditeurs.Add(ctrl); } } ArrayList lst = new ArrayList(); // Recupère la liste des champs customs liés à des Activités CListeObjetsDonnees lstChamps = CChampCustom.GetListeChampsForRole(m_typeActivite.ContexteDonnee, CActiviteActeur.c_roleChampCustom); //CChampCustom[] champs = m_typeActivite.TousLesChampsAssocies; CChampCustom[] champs = (CChampCustom[])lstChamps.ToArray(typeof(CChampCustom)); foreach (CChampCustom champ in champs) { CFormuleForParametre formule = new CFormuleForParametre(champ); formule.Formule = m_parametre.GetFormuleForChamp(champ); lst.Add(formule); } lst.Sort(); m_listeExpressions = lst; int nY = 0; foreach (CFormuleForParametre formule in lst) { CEditeurFormuleNommee editeur = null; if (m_reserveEditeurs.Count > 0) { editeur = (CEditeurFormuleNommee)m_reserveEditeurs[0]; m_reserveEditeurs.Remove(editeur); } else { editeur = new CEditeurFormuleNommee(); editeur.Parent = m_panelFormules; } editeur.Visible = true; editeur.Width = m_panelFormules.ClientRectangle.Width; editeur.Location = new Point(0, nY); formule.Editeur = editeur; editeur.TextFormule.Enter += new EventHandler(OnEnterZoneFormule); editeur.Init(m_wndAideFormule.FournisseurProprietes, m_wndAideFormule.ObjetInterroge); editeur.Libelle = formule.ChampCustom.Nom; editeur.TabIndex = nY; editeur.Dock = DockStyle.Top; editeur.BringToFront(); nY += editeur.Size.Height + 1; editeur.Formule = formule.Formule; } m_panelFormules.ResumeDrawing(); }