/// ////////////////////////////////////////
        private void m_lnkNouvelleVariable_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            string strNom = "";

            if (!(m_comboVariableListe.SelectedValue is CVariableDynamique))
            {
                CFormAlerte.Afficher(I.T("Select list variable first|30055"), EFormAlerteType.Exclamation);
                return;
            }
            CVariableDynamique      variable = (CVariableDynamique)m_comboVariableListe.SelectedValue;
            CTypeResultatExpression type     = variable.TypeDonnee.GetTypeElements();
            CDbKey dbKey = null;

            if (CFormEditNomVariable.EditeNomVariable(ref strNom, ref type, ref dbKey, false))
            {
                if (m_variableNew == null)
                {
                    m_variableNew = new CVariableProcessTypeComplexe();
                    m_variableNew.SetTypeDonnee(type);
                }
                m_variableNew.Nom = strNom;
                FillListeVariables();
                m_comboVariable.SelectedValue = m_variableNew;
            }
        }
        public static bool EditeNomVariable(ref string strNom, ref CTypeResultatExpression typeDonnee, ref CDbKey dbKeyInitial, bool bAvecIdInitial)
        {
            CFormEditNomVariable form = new CFormEditNomVariable();

            form.m_txtNomVariable.Text = strNom;
            form.InitComboBoxType(typeDonnee != null ? typeDonnee.TypeDotNetNatif : null);
            if (typeDonnee != null)
            {
                form.m_panelType.LockEdition         = true;
                form.m_chkTableau.Checked            = typeDonnee.IsArrayOfTypeNatif;
                form.m_cmbTypeElements.SelectedValue = typeDonnee.TypeDotNetNatif;
                form.m_txtKeyInitiale.Text           = dbKeyInitial != null?dbKeyInitial.StringValue:"";
            }
            form.m_panelIdInitial.Visible = bAvecIdInitial;
            bool bResult = form.ShowDialog() == DialogResult.OK;

            if (bResult)
            {
                strNom = form.m_txtNomVariable.Text;
                if (!form.m_panelType.LockEdition)
                {
                    Type tp = (Type)form.m_cmbTypeElements.SelectedValue;
                    if (tp == null || tp == typeof(DBNull))
                    {
                        tp = null;
                    }
                    typeDonnee = new CTypeResultatExpression(
                        (Type)form.m_cmbTypeElements.SelectedValue,
                        form.m_chkTableau.Checked);
                }
                if (form.m_txtKeyInitiale != null)
                {
                    int nId = -1;
                    if (int.TryParse(form.m_txtKeyInitiale.Text, out nId))
                    {
                        dbKeyInitial = CDbKey.GetNewDbKeyOnIdAUtiliserPourCeuxQuiNeGerentPasLeDbKey(nId);
                    }
                    else
                    {
                        dbKeyInitial = CDbKey.CreateFromStringValue(form.m_txtKeyInitiale.Text);
                    }
                }
                else
                {
                    bResult = false;
                }
            }
            form.Dispose();
            return(bResult);
        }
Exemple #3
0
        private void m_lnkNouvelleVariable_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string strNom = "";
            CTypeResultatExpression type = new CTypeResultatExpression(typeof(int), false);
            CDbKey dbKey = null;

            if (CFormEditNomVariable.EditeNomVariable(ref strNom, ref type, ref dbKey, false))
            {
                if (m_variableNew == null)
                {
                    m_variableNew = new CVariableProcessTypeComplexe();
                    m_variableNew.SetTypeDonnee(type);
                }
                m_variableNew.Nom = strNom;
                FillListeVariables();
                m_comboBoxVariables.SelectedValue = m_variableNew;
            }
        }