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 m_lnkSelectFormulaires_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { C2iExpression formule = GetFormuleValideElementEdite(m_txtFormuleElementEdite); if (formule != null) { Type tpEdite = formule.TypeDonnee.TypeDotNetNatif; CFiltreData filtre = new CFiltreData(CFormulaire.c_champTypeElementEdite + "=@1", tpEdite.ToString()); CRoleChampCustom role = CRoleChampCustom.GetRoleForType(tpEdite); if (role != null) { filtre = CFiltreData.GetOrFiltre(filtre, CFormulaire.GetFiltreFormulairesForRole(role.CodeRole)); } CListeObjetDonneeGenerique <CFormulaire> listeFormulaires = new CListeObjetDonneeGenerique <CFormulaire>( CSc2iWin32DataClient.ContexteCourant, filtre); m_menuFormulaires.Items.Clear(); foreach (CFormulaire formulaire in listeFormulaires) { CDbKey nKeyForm = formulaire.DbKey; ToolStripMenuItem itemForm = new ToolStripMenuItem(formulaire.Libelle); itemForm.Tag = nKeyForm; itemForm.Checked = m_listeDbKeysFormulaires.Contains(nKeyForm); itemForm.Click += new EventHandler(itemForm_Click); itemForm.Enabled = true; m_menuFormulaires.Items.Add(itemForm); } m_menuFormulaires.Show(m_lnkSelectFormulaires, new Point(0, m_lnkSelectFormulaires.Height)); } }
/// ////////////////////////////////////////////////////////////////// protected static CResultAErreur ExecuteActionFormulaireCustom(CActionSur2iLinkAfficheFormulaireCustom action, object objetCible) { CResultAErreur result = CResultAErreur.True; CFormulaire formulaire = new CFormulaire(CSc2iWin32DataClient.ContexteCourant); if (formulaire.ReadIfExists(action.IdFormulaireInDb)) { if (formulaire.Role != null) { bool bObjetOk = false; if (objetCible != null) { CRoleChampCustom role = CRoleChampCustom.GetRoleForType(objetCible.GetType()); if (role != null && formulaire.HasRole(role.CodeRole)) { bObjetOk = true; } } if (!bObjetOk) { result.EmpileErreur(I.T("The object does not correspond to the expected type of the form|30091")); return(result); } } CTimosApp.Navigateur.AffichePage(new CFormFormulaireCustom(formulaire, objetCible)); } else { result.EmpileErreur(I.T("Form|30092") + action.IdFormulaireInDb + (I.T(" does not exist |30093"))); } return(result); }
/// ///////////////////////////////////////////// public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, I.T("Alarm type|20246"), typeof(CTypeAlarme), typeof(CDefinisseurChampsPourTypeSansDefinisseur)); }
//---------------------------------------------------------------------------- /// <summary> /// Utilisée pour la recherche de références externes liées à cette Action /// </summary> /// <param name="contexteGetRef"></param> /// <returns></returns> public object[] GetReferencesExternesExplicites(CContexteGetReferenceExterne contexteGetRef) { if (contexteGetRef != null) { CContexteDonnee contexte = (CContexteDonnee)contexteGetRef.GetObjetAttache(typeof(CContexteDonnee)); if (contexte != null) { if (ExpressionEntiteDestination != null) { Type typeDestination = ExpressionEntiteDestination.TypeDonnee.TypeDotNetNatif; if ((typeof(IElementAChamps)).IsAssignableFrom(typeDestination)) { CRoleChampCustom role = CRoleChampCustom.GetRoleForType(typeDestination); Type[] typeDefinisseursChamps = role.TypeDefinisseurs; if (typeDefinisseursChamps.Length > 0) { CObjetDonneeAIdNumeriqueAuto definisseur = (CObjetDonneeAIdNumeriqueAuto)Activator.CreateInstance(typeDefinisseursChamps[0], new object[] { contexte }); if (DbKeyDefinisseurChampsCustomEntiteDestination != null) { if (definisseur.ReadIfExists(DbKeyDefinisseurChampsCustomEntiteDestination)) { return new object[] { definisseur } } ; } } } } } } return(new object[] { }); } }
//////////////////////////////////////////// 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 static void ImporterChamps() { StreamReader reader = new StreamReader("C:\\Partage\\Import Orange\\Champs controles.txt", Encoding.Default); string strLigne = reader.ReadLine(); strLigne = reader.ReadLine(); using (CContexteDonnee contexte = new CContexteDonnee(CSessionClient.GetSessionUnique().IdSession, true, false)) { while (strLigne != null) { CRoleChampCustom roleSite = CRoleChampCustom.GetRole(CSite.c_roleChampCustom); CRoleChampCustom roleWorkBook = CRoleChampCustom.GetRole(CDossierSuivi.c_roleChampCustom); CRoleChampCustom roleCaracteristique = CRoleChampCustom.GetRole(CCaracteristiqueEntite.c_roleChampCustom); string[] datas = strLigne.Split('\t'); if (datas.Length >= 1) { CChampCustom champ = new CChampCustom(contexte); if (!champ.ReadIfExists(new CFiltreData(CChampCustom.c_champNom + "=@1", datas[0]))) { champ.CreateNewInCurrentContexte(); } champ.Nom = datas[0]; C2iTypeDonnee tp = new C2iTypeDonnee(TypeDonnee.tString); if (datas.Length > 1) { if (datas[1].ToUpper() == "BOOL") { tp = new C2iTypeDonnee(TypeDonnee.tBool); } else if (datas[1].ToUpper() == "DATE") { tp = new C2iTypeDonnee(TypeDonnee.tDate); } } champ.TypeDonneeChamp = tp; champ.Categorie = ""; if (datas.Length > 2) { champ.Categorie = datas[2]; } CRoleChampCustom role = roleCaracteristique; champ.Role = role; } strLigne = reader.ReadLine(); } reader.Close(); CResultAErreur result = contexte.SaveAll(true); if (!result) { CFormAfficheErreur.Show(result.Erreur); } } }
//------------------------------------------------------------------------- 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 RedefinitRoleAssocie() { CRoleChampCustom role = m_cmbRoleFormulaire.SelectedValue as CRoleChampCustom; if (role != null && role.CodeRole != sc2i.custom.CRoleFormulaireSurImpressionWin32.c_roleChampCustom) { m_panelEditionFormulaire.TypeEdite = role.TypeAssocie; m_typeAssocie = role.TypeAssocie; } Actual(); }
//---------------------------------------------------------------------------------- private void InitPanelDefinisseurChamps() { if (ActionCopierEntite.ExpressionEntiteDestination != null) { Type typeDestination = ActionCopierEntite.ExpressionEntiteDestination.TypeDonnee.TypeDotNetNatif; if ((typeof(IElementAChamps)).IsAssignableFrom(typeDestination)) { m_panelDefinisseurChamps.Visible = !m_chkFullCopy.Checked; CContexteDonnee ctx = ActionCopierEntite.Process.ContexteDonnee; CRoleChampCustom role = CRoleChampCustom.GetRoleForType(typeDestination); Type[] typeDefinisseursChamps = role.TypeDefinisseurs; if (typeDefinisseursChamps.Length > 0) { // Init la textBoxSelectionne m_txtSelectDefinisseurChampsCustom.InitForSelect(typeDefinisseursChamps[0], "Libelle", false); CObjetDonneeAIdNumeriqueAuto objet = (CObjetDonneeAIdNumeriqueAuto)Activator.CreateInstance(typeDefinisseursChamps[0], new object[] { ctx }); if (ActionCopierEntite.DbKeyDefinisseurChampsCustomEntiteDestination != null) { if (objet.ReadIfExists(ActionCopierEntite.DbKeyDefinisseurChampsCustomEntiteDestination)) { m_txtSelectDefinisseurChampsCustom.ElementSelectionne = objet; } else { m_txtSelectDefinisseurChampsCustom.ElementSelectionne = null; } } else { m_txtSelectDefinisseurChampsCustom.ElementSelectionne = null; } } } else { m_panelDefinisseurChamps.Visible = false; } } }
/// //////////////////////////////////////////////////////////////////// public CResultAErreur SerializeFiltre(C2iSerializer serializer) { InitCombos(); int nVersion = GetNumVersion(); CResultAErreur result = serializer.TraiteVersion(ref nVersion); if (!result) { return(result); } string strCodeRole = ""; if (m_cmbRole.SelectedValue is CRoleChampCustom) { strCodeRole = ((CRoleChampCustom)m_cmbRole.SelectedValue).CodeRole; } serializer.TraiteString(ref strCodeRole); m_cmbRole.SelectedValue = CRoleChampCustom.GetRole(strCodeRole); return(result); }
//------------------------------------------------------- private void InitSelectFormulaire(CTextBoxZoomFormule editeur) { if (editeur == null) { return; } C2iExpression formule = GetFormuleValideElementEdite(editeur); CFormulaire formulaireSel = null; C2iTextBoxFiltreRapide selecteur = null; if (editeur == m_txtFormuleElementSecondaire) { formulaireSel = m_txtSelectFormulaireSecondaire.ElementSelectionne as CFormulaire; selecteur = m_txtSelectFormulaireSecondaire; } if (formule != null && selecteur != null) { Type tpEdite = formule.TypeDonnee.TypeDotNetNatif; CFiltreData filtre = new CFiltreData(CFormulaire.c_champTypeElementEdite + "=@1", tpEdite.ToString()); CRoleChampCustom role = CRoleChampCustom.GetRoleForType(tpEdite); if (role != null) { filtre = CFiltreData.GetOrFiltre(filtre, CFormulaire.GetFiltreFormulairesForRole(role.CodeRole)); } selecteur.InitAvecFiltreDeBase(typeof(CFormulaire), "Libelle", filtre, true); if (formulaireSel != null && formulaireSel.TypeElementEdite == tpEdite) { selecteur.ElementSelectionne = formulaireSel; } else { selecteur.ElementSelectionne = null; } } }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Operation", typeof(COperation), typeof(CTypeOperation)); }
/// ////////////////////////////////////////////////// public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, I.T("Workflow step|20067"), typeof(CEtapeWorkflow), typeof(CTypeEtapeWorkflow)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Alarms", typeof(CAlarme), typeof(CTypeAlarme)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Member Activity", typeof(CActiviteActeur), typeof(CTypeActiviteActeur)); }
public static void Autoexec() { CRoleChampCustom.RegisterRole(CRoleFormulaireSurImpressionWin32.c_roleChampCustom, "Overdraw", null); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, I.T("Delivery|20120"), typeof(CLivraisonEquipement), typeof(CTypeLivraisonEquipement)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Custom Table type", typeof(CTypeTableParametrable), typeof(CDefinisseurChampsPourTypeSansDefinisseur)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, I.T("Order|20116"), typeof(CCommande), typeof(CTypeCommande)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "WorkBook", typeof(CDossierSuivi), typeof(CTypeDossierSuivi)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "EDM Document", typeof(CDocumentGED)); }
/// ///////////////////////////////////////////// public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Snmp agent", typeof(CAgentSnmp)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Resource type", typeof(CTypeRessource), typeof(CDefinisseurChampsPourTypeSansDefinisseur)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Constraint", typeof(CContrainte), typeof(CTypeContrainte)); }
public static void RegisterRole() { CRoleChampCustom.RegisterRole(CTypeConsommable.c_roleChampCustom, I.T("Consumable Type|10033"), typeof(CTypeConsommable), typeof(CFamilleEquipement)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Diary entry", typeof(CEntreeAgenda), typeof(CTypeEntreeAgenda)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Ticket", typeof(CTicket), typeof(CTypeTicket), typeof(COrigineTicket)); }
public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, "Organisational entity / element", typeof(CRelationElement_EO), typeof(CDefinisseurChampsCustomTypeEoPourType)); }
//------------------------------------------------------------------- public static void Autoexec() { CRoleChampCustom.RegisterRole(c_roleChampCustom, I.T("Workflow Step Type|10002"), typeof(CTypeEtapeWorkflow), typeof(CDefinisseurChampsPourTypeSansDefinisseur)); }