/// <summary>
        /// Adds a new attributes to the collection and saves it the CmsFile for this collection in the database. 
        /// </summary>
        /// <param name="name">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="value">
        /// A <see cref="System.String"/>
        /// </param>
        public void Add(string name, string value)
        {
            CmsFileAttribute attr = new CmsFileAttribute();
            attr.FileID = fileID;
            attr.Name = name;
            attr.Value = value;
            attr.SortOrder = this.nvc.Count;
            attr.Save();

            nvc.Add(name,value);
        }
        protected void ButtonAddAttribute_OnClick(object sender, EventArgs e)
        {
            CmsFileAttribute attr = new CmsFileAttribute();
            DataBindingManagerAttribute.DataSource = attr;
            DataBindingManagerAttribute.PullData();
            attr.FileID = CurrentDirectory.ID;
            attr.SortOrder = DataGridAttributes.Items.Count + 1;
            attr.Save();

            MessageBox1.ShowMessage(MessageBox.MessageBoxMode.Info, "Attribute has been added.");
            BindAttributes();
            DataBindingManagerAttribute.Reset();
        }
Esempio n. 3
0
 /// <summary>
 /// Copy the CmsFileAttribute to another CmsFile.  
 /// </summary>
 /// <param name="fileID">
 /// A <see cref="Guid"/>
 /// </param>
 public void CopyTo(Guid fileID)
 {
     CmsFileAttribute a = new CmsFileAttribute();
     a.FileID = fileID;
     a.Name = this.Name;
     a.Value = this.Value;
     a.SortOrder = this.SortOrder;
     a.Save();
 }