Beispiel #1
0
        private void btnAjouter_Click(object sender, EventArgs e)
        {
            string msgErreur;

            string libelle        = (string)txtAsso.Text;
            string nomResponsable = (string)txtNomResponsable.Text;
            int    idMission      = (int)cbxMission.SelectedValue;
            int    idPays         = (int)cbxPays.SelectedValue;

            AssociationManager.GetInstance().CreerAssociation(libelle, nomResponsable, idMission, idPays, out msgErreur);

            if (msgErreur == "")
            {
                MessageBox.Show(" Enregistrement Ajouté", "Sucess");
            }
            else
            {
                MessageBox.Show(msgErreur, "Probleme");
            }
        }
        public FormConsultAssociationMission()
        {
            InitializeComponent();
            List <Pays> lesPays = PaysManager.GetInstance().GetPays();

            lesAssociations = AssociationManager.GetInstance().GetAssociations();
            dtgConsultAssociation.DataSource = null;
            dtgConsultAssociation.DataSource = lesAssociations;

            lesMissions = MissionManager.GetInstance().GetMission();
            dtgConsultMissions.DataSource = null;
            dtgConsultMissions.DataSource = lesMissions;

            cbxPays.DisplayMember = "Libelle";
            cbxPays.ValueMember   = "Id";
            cbxPays.DataSource    = lesPays;

            cbxPays.Visible = false;
            dtgConsultAssociation.Visible = false;
            dtgConsultMissions.Visible    = false;
        }
Beispiel #3
0
        internal HeaderInfo GenerateHeaderInfo(PSObject input, OutGridViewCommand parentCmdlet)
        {
            HeaderInfo headerInfo = new HeaderInfo();
            List <MshResolvedExpressionParameterAssociation> activeAssociationList;

            // Get properties from the default property set of the object
            activeAssociationList = AssociationManager.ExpandDefaultPropertySet(input, _expressionFactory);
            if (activeAssociationList.Count > 0)
            {
                // we got a valid set of properties from the default property set..add computername for
                // remoteobjects (if available)
                if (PSObjectHelper.ShouldShowComputerNameProperty(input))
                {
                    activeAssociationList.Add(new MshResolvedExpressionParameterAssociation(null,
                                                                                            new PSPropertyExpression(RemotingConstants.ComputerNameNoteProperty)));
                }
            }
            else
            {
                // We failed to get anything from the default property set
                activeAssociationList = AssociationManager.ExpandAll(input);
                if (activeAssociationList.Count > 0)
                {
                    // Remove PSComputerName and PSShowComputerName from the display as needed.
                    AssociationManager.HandleComputerNameProperties(input, activeAssociationList);
                    FilterActiveAssociationList(activeAssociationList);
                }
                else
                {
                    // We were unable to retrieve any properties, so we leave an empty list
                    activeAssociationList = new List <MshResolvedExpressionParameterAssociation>();
                }
            }

            for (int k = 0; k < activeAssociationList.Count; k++)
            {
                string propertyName = null;

                MshResolvedExpressionParameterAssociation association = activeAssociationList[k];

                // set the label of the column
                if (association.OriginatingParameter != null)
                {
                    object key = association.OriginatingParameter.GetEntry(FormatParameterDefinitionKeys.LabelEntryKey);
                    if (key != AutomationNull.Value)
                    {
                        propertyName = (string)key;
                    }
                }

                if (propertyName == null)
                {
                    propertyName = association.ResolvedExpression.ToString();
                }

                ColumnInfo columnInfo = new OriginalColumnInfo(propertyName, propertyName, propertyName, parentCmdlet);

                headerInfo.AddColumn(columnInfo);
            }

            return(headerInfo);
        }