Esempio n. 1
0
        protected void btnAddAnAttribute_onClick(object sender, EventArgs e)
        {
            string        newAttName = txtNewAttributeName.Text;
            string        result     = "";
            MetadataNewDa MNDa       = new MetadataNewDa();

            if (newAttName.Length > 0)
            {
                if (MNDa.AttributeExists(newAttName))
                {
                    result = "An attribute called '" + newAttName + "' already exists. The new attribute was not created.";
                    btnCreateNewAttributeNext.Visible = false;
                }
                {
                    try
                    {
                        MNDa.CreateNewAttribute(newAttName);
                        result = "The new attribute '" + newAttName + "' was successfully created.";
                        btnCreateNewAttributeNext.Visible = true;
                    }
                    catch (Exception err)
                    {
                        result = "An error occured while creating the new attribute '" + newAttName + "'. The attribute was not added.";
                        btnCreateNewAttributeNext.Visible = false;
                    }
                }
            }
            lblCreateNewAttributeResult.Text = result;
            lblCreateNewAttributeName.Text   = newAttName;
            lblCreateNewAttributeId.Text     = MNDa.GetAnAttribute(newAttName).Rows[0]["AttributeId"].ToString();
            viewMode = "createNewAttributeStep2";
            setViewMode();
        }