private void CControlePourInventaire_Load(object sender, EventArgs e) { CListeEntitesDeMemoryDb <CChampCustom> lstChamps = new CListeEntitesDeMemoryDb <CChampCustom>(CTimosInventoryDb.GetTimosDatas()); lstChamps.Filtre = CChampCustom.GetFiltreChampsForRole(CReleveEquipement.c_roleChampCustom); if (lstChamps.Count() == 0) { m_panelChampsCustom.Visible = false; } else { m_panelChampsCustom.Visible = true; foreach (CChampCustom champOrg in lstChamps) { CChampCustom champ = new CChampCustom(CTimosInventoryDb.GetInventaireDatas()); if (!champ.ReadIfExist(champOrg.Id)) { champ = champOrg.GetChampInMemoryDb(CTimosInventoryDb.GetInventaireDatas()); } if (champ != null) { CControleForCustomFieldReleve ctrl = new CControleForCustomFieldReleve(); m_panelChampsCustom.Controls.Add(ctrl); ctrl.Dock = DockStyle.Left; ctrl.Init(champ); ctrl.OnValueChanged += new EventHandler(ctrlCustom_OnValueChanged); } } } Height = m_panelTop.Height + m_lblLigneBas.Height + (m_panelChampsCustom.Controls.Count > 0 ? m_panelChampsCustom.Height : 0); }
//-------------------------------------- private void InitChamps() { m_txtNomChamp.Text = m_champEdite.NomChamp; m_txtDescription.Text = m_champEdite.Description; m_lblDataType.Text = new CTypeChampBasique(m_champEdite.TypeChamp).Libelle; m_chkNoUpdate.Checked = m_champEdite.NoUpdateFromSnmp; m_chkNoWriteSNMP.Checked = m_champEdite.IsReadOnly; m_lblAcces.Text = m_champEdite.IsReadOnly ? I.T("Read only|20296") : I.T("Read/write|20297"); CFournisseurGeneriqueProprietesDynamiques fournisseur = new CFournisseurGeneriqueProprietesDynamiques(); CEntiteSnmpPourSupervision entiteTest = m_typeEntite.GetEntiteDeTest(); m_txtFormuleIndex.Init(fournisseur, new CObjetPourSousProprietes(entiteTest)); m_txtFormuleIndex.Formule = m_champEdite.FormuleIndex; TypeDonnee typeChampMap = TypeDonnee.tString; switch (m_champEdite.TypeChamp) { case ETypeChampBasique.Bool: typeChampMap = TypeDonnee.tBool; break; case ETypeChampBasique.Date: typeChampMap = TypeDonnee.tDate; break; case ETypeChampBasique.Decimal: typeChampMap = TypeDonnee.tDouble; break; case ETypeChampBasique.Int: typeChampMap = TypeDonnee.tEntier; break; case ETypeChampBasique.String: typeChampMap = TypeDonnee.tString; break; default: break; } m_txtSelectChampCustom.InitAvecFiltreDeBase(typeof(CChampCustom), "Nom", CFiltreData.GetAndFiltre(CChampCustom.GetFiltreChampsForRole(CEntiteSnmp.c_roleChampCustom), new CFiltreData(CChampCustom.c_champType + "=@1", (int)typeChampMap)), false); CChampCustom champ = new CChampCustom(m_contexteDonnee); if (m_champToCustom.IdChampCustom != null && champ.ReadIfExists(m_champToCustom.IdChampCustom.Value)) { m_txtSelectChampCustom.ElementSelectionne = champ; } else { m_txtSelectChampCustom.ElementSelectionne = null; } }
public void AppliquerFiltre() { Filtre = new CFiltreData( ); if (m_cmbRole.SelectedValue is CRoleChampCustom) { Filtre = CFiltreData.GetAndFiltre(Filtre, CChampCustom.GetFiltreChampsForRole(((CRoleChampCustom)m_cmbRole.SelectedValue).CodeRole)); } if (m_txtLibelle.Text != string.Empty) { Filtre = CFiltreData.GetAndFiltre( Filtre, new CFiltreData(CChampCustom.c_champNom + " like @1", "%" + m_txtLibelle.Text + "%")); } if (m_txtFolderName.Text != string.Empty) { Filtre = CFiltreData.GetAndFiltre(Filtre, new CFiltreData(CChampCustom.c_champFolder + " LIKE @1", "%" + m_txtFolderName.Text + "%")); } OnAppliqueFiltre(new object(), null); }
//-------------------------------------------------------------- private void CFormCreerEquipement_Load(object sender, EventArgs e) { m_lblSite.Text = m_releveEqpt.ReleveSite.Site.Libelle; if (m_releveEqpt.ReleveEquipementParent != null) { m_panelEqptParent.Visible = true; m_lblEqptParent.Text = m_releveEqpt.ReleveEquipementParent.NumeroSerie + " " + m_releveEqpt.ReleveEquipementParent.TypeEquipement.Libelle + " (" + m_releveEqpt.ReleveEquipementParent.CoordonneeComplete + ")"; } else { m_panelEqptParent.Visible = false; } m_txtSerial.Text = m_releveEqpt.NumeroSerie; m_selectTypeEquipement.Init(m_releveEqpt, true); m_panelCoordonnee.Init(m_releveEqpt, true); CListeEntitesDeMemoryDb <CChampCustom> lstChamps = new CListeEntitesDeMemoryDb <CChampCustom>(CTimosInventoryDb.GetTimosDatas()); lstChamps.Filtre = CChampCustom.GetFiltreChampsForRole(CReleveEquipement.c_roleChampCustom); if (lstChamps.Count() == 0) { m_panelChampsCustom.Visible = false; } else { m_panelChampsCustom.Visible = true; foreach (CChampCustom champOrg in lstChamps) { CChampCustom champ = new CChampCustom(CTimosInventoryDb.GetInventaireDatas()); if (!champ.ReadIfExist(champOrg.Id)) { champ = champOrg.GetChampInMemoryDb(CTimosInventoryDb.GetInventaireDatas()); } if (champ != null) { CControleForCustomFieldReleve ctrl = new CControleForCustomFieldReleve(); m_panelChampsCustom.Controls.Add(ctrl); ctrl.Dock = DockStyle.Left; ctrl.Init(champ); } } } foreach (Control ctrl in m_panelChampsCustom.Controls) { CControleForCustomFieldReleve c = ctrl as CControleForCustomFieldReleve; if (c != null) { c.InitChamps(m_releveEqpt); } } }
//------------------------------------------------------- private void InitChamps() { if (m_blocWorkflow == null) { return; } m_txtSelectWorkflow.Init(typeof(CTypeWorkflow), "Libelle", false); if (m_blocWorkflow.DbKeyTypeWorkflow != null) { CTypeWorkflow wkf = new CTypeWorkflow(CSc2iWin32DataClient.ContexteCourant); if (wkf.ReadIfExists(m_blocWorkflow.DbKeyTypeWorkflow)) { m_txtSelectWorkflow.ElementSelectionne = wkf; } } m_txtSelectTypeProjet.Init(typeof(CTypeProjet), "Libelle", false); if (m_blocWorkflow.DbKeyTypeProjet != null) { CTypeProjet typeProjet = new CTypeProjet(CSc2iWin32DataClient.ContexteCourant); if (typeProjet.ReadIfExists(m_blocWorkflow.DbKeyTypeProjet)) { m_txtSelectTypeProjet.ElementSelectionne = typeProjet; } } m_cmbProjectField.Init(typeof(CChampCustom), CFiltreData.GetAndFiltre(CChampCustom.GetFiltreChampsForRole(CWorkflow.c_roleChampCustom), new CFiltreData( CChampCustom.c_champTypeObjetDonnee + "=@1", typeof(CProjet).ToString())), "Nom", false); if (m_blocWorkflow.IdChampProjet != null) { CChampCustom champ = new CChampCustom(CSc2iWin32DataClient.ContexteCourant); if (champ.ReadIfExists(m_blocWorkflow.IdChampProjet.Value)) { m_cmbProjectField.ElementSelectionne = champ; } } m_listeAffectations.Clear(); m_listeAffectations.AddRange(m_blocWorkflow.AffectationsCreationEtDemarrage); m_txtFormuleGanttId.Init(new CFournisseurPropDynStd(), typeof(CEtapeWorkflow)); m_txtFormuleGanttId.Formule = m_blocWorkflow.FormuleGanttId; m_chkGererIterations.Checked = m_blocWorkflow.GererIteration; }
//------------------------------------------------------------------------ private static void AddChampsCustom(CContexteDonnee ctx, CMemoryDb db) { CListeObjetDonneeGenerique <CChampCustom> lst = new CListeObjetDonneeGenerique <CChampCustom>(ctx); lst.Filtre = CChampCustom.GetFiltreChampsForRole(CReleveEquipement.c_roleChampCustom); lst.ReadDependances("ListeValeurs"); foreach (CChampCustom champTimos in lst) { if (champTimos.TypeDonneeChamp.TypeDonnee != TypeDonnee.tObjetDonneeAIdNumeriqueAuto) { AssureChampInMemoryDb(champTimos, db); } } }
/// //////////////////////////////////////////////////////////////////////// public void InitPanel ( IDefinisseurChampCustomRelationObjetDonnee definisseur, Type typeFormGererChamps, Type typeFormGererFormulaires ) { m_definisseur = definisseur; m_typeFormGererChamps = typeFormGererChamps; m_typeFormGererFormulaires = typeFormGererFormulaires; if (m_bAvecAffectationDirecteDesChamps) { CListeObjetsDonnees listeChamps = new CListeObjetsDonnees(definisseur.ContexteDonnee, typeof(CChampCustom)); listeChamps.Filtre = CChampCustom.GetFiltreChampsForRole(definisseur.RoleChampCustomDesElementsAChamp.CodeRole); m_panelListeChampsCustom.Init( listeChamps, m_definisseur.RelationsChampsCustomListe, (CObjetDonneeAIdNumeriqueAuto)definisseur, "Definisseur", "ChampCustom" ); } CListeObjetsDonnees listeFormulaires = new CListeObjetsDonnees(definisseur.ContexteDonnee, typeof(CFormulaire)); listeFormulaires.Filtre = CFormulaire.GetFiltreFormulairesForRole(definisseur.RoleChampCustomDesElementsAChamp.CodeRole); //listeFormulaires.Filtre = new CFiltreData(CFormulaire.c_champCodeRole + "=@1", definisseur.RoleChampCustomDesElementsAChamp.CodeRole); m_panelListeFormulaires.Init( listeFormulaires, m_definisseur.RelationsFormulairesListe, (IObjetAContexteDonnee)definisseur, "Definisseur", "Formulaire" ); m_panelListeChampsCustom.RemplirGrille(); m_panelListeFormulaires.RemplirGrille(); if (!m_bAvecAffectationDirecteDesChamps) { m_panelConteneurGererChamps.Visible = false; } }
//------------------------------------------------------------------------- protected override void InitPanel() { CFiltreData filtre = new CFiltreData(); if (m_strCodeRole != "") { m_panelListe.FiltreDeBase = CChampCustom.GetFiltreChampsForRole(m_strCodeRole); } m_panelListe.InitFromListeObjets( m_listeObjets, typeof(CChampCustom), typeof(CFormEditionChampCustom), null, ""); m_panelListe.RemplirGrille(); m_panelListe.ControlFiltreStandard = new CPanelFiltreChampCustom(); m_panelListe.MultiSelect = true; }
public CDefinitionProprieteDynamique[] GetDefinitionsChamps(CObjetPourSousProprietes objet, CDefinitionProprieteDynamique defParente) { List <CDefinitionProprieteDynamique> listeProps = new List <CDefinitionProprieteDynamique>(); if (objet.TypeAnalyse != null && objet.TypeAnalyse == typeof(CLocalAlarme)) { CListeObjetsDonnees lstChamps = new CListeObjetsDonnees(CContexteDonneeSysteme.GetInstance(), typeof(CChampCustom)); lstChamps.Filtre = CChampCustom.GetFiltreChampsForRole(CAlarme.c_roleChampCustom); using (CMemoryDb db = new CMemoryDb()) { foreach (CChampCustom champ in lstChamps) { CLocalChampTypeAlarme localChamp = CTypeAlarme.GetChampTypeAlarme(db, champ); listeProps.Add(new CDefinitionProprieteDynamiqueChampAlarme(localChamp)); } } } return(listeProps.ToArray()); }
public static DataSet GetEquipments(C2iSessionWeb sessionWeb, int nIdSiteContenant) { using (CContexteDonnee ctx = new CContexteDonnee(sessionWeb.Session.IdSession, true, false)) { CMemoryDb db = new CMemoryDb(); db.EnforceConstraints = false; //Identifie les champs custom interessants CListeObjetDonneeGenerique <CChampCustom> lstChamps = new CListeObjetDonneeGenerique <CChampCustom>(ctx); lstChamps.Filtre = CChampCustom.GetFiltreChampsForRole(CReleveEquipement.c_roleChampCustom); StringBuilder blChampsCustom = new StringBuilder(); foreach (CChampCustom champ in lstChamps) { blChampsCustom.Append(champ.Id); blChampsCustom.Append(","); AssureChampInMemoryDb(champ, db); } if (blChampsCustom.Length > 0) { blChampsCustom.Remove(blChampsCustom.Length - 1, 1); } //Ajout des équipements CListeObjetDonneeGenerique <CEquipement> equipements = new CListeObjetDonneeGenerique <CEquipement>(ctx); equipements.Filtre = new CFiltreData(CSite.c_champId + "=@1", nIdSiteContenant); equipements.AssureLectureFaite(); equipements.ReadDependances("EquipementsContenus.ParametragesSystemesCoordonnees", "RelationsChampsCustom"); equipements.Filtre = new CFiltreData(CEquipement.c_champIdEquipementContenant + " is null"); equipements.InterditLectureInDB = true; foreach (CEquipement eqt in equipements) { AddDetailEquipementToDb(eqt, null, blChampsCustom.ToString(), db); } return(db); } }