Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lstAttributeAssignments_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (index != -1 && index != lstAttributeAssignments.SelectedIndex)
            {
                pol.AttributeAssignmentElementReadWrite attrAux = lstAttributeAssignments.Items[index] as pol.AttributeAssignmentElementReadWrite;
                attrAux.AttributeId = txtAttributeId.Text;
                attrAux.Value       = txtAttributeAssignemnt.Text;
                lstAttributeAssignments.Items.RemoveAt(index);
                lstAttributeAssignments.Items.Insert(index, attrAux);
            }
            pol.AttributeAssignmentElementReadWrite attr = lstAttributeAssignments.SelectedItem as pol.AttributeAssignmentElementReadWrite;
            index = lstAttributeAssignments.SelectedIndex;

            try
            {
                LoadingData = true;
                if (attr != null)
                {
                    txtAttributeId.Text         = attr.AttributeId;
                    txtAttributeAssignemnt.Text = (string)attr.GetTypedValue(rtm.DataTypeDescriptor.String, 0);
                }
            }
            finally
            {
                LoadingData = false;
            }
        }
Пример #2
0
 private void btnAttributeAssignmentsAdd_Click(object sender, System.EventArgs e)
 {
     pol.ObligationElementReadWrite          obligation = lstObligations.SelectedItem as pol.ObligationElementReadWrite;
     pol.AttributeAssignmentElementReadWrite oAtt       = new pol.AttributeAssignmentElementReadWrite("TODO: Add AttributeId", Consts.Schema1.InternalDataTypes.XsdString,
                                                                                                      string.Empty, obligation.SchemaVersion);
     obligation.AttributeAssignment.Add(oAtt);
     lstAttributeAssignments.Items.Add(oAtt);
 }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lstObligations_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (index != -1)
            {
                pol.AttributeAssignmentElementReadWrite attrAux = lstAttributeAssignments.Items[index] as pol.AttributeAssignmentElementReadWrite;
                attrAux.AttributeId = txtAttributeId.Text;
                attrAux.Value       = txtAttributeAssignemnt.Text;
            }
            if (obligationIndex != -1 && obligationIndex != lstObligations.SelectedIndex)
            {
                pol.ObligationElementReadWrite obliAux = lstObligations.Items[obligationIndex] as pol.ObligationElementReadWrite;
                obliAux.ObligationId = txtId.Text;
                if (cmbEffect.Text.Equals(pol.Effect.Deny.ToString()))
                {
                    obliAux.FulfillOn = pol.Effect.Deny;
                }
                else if (cmbEffect.Text.Equals(pol.Effect.Permit.ToString()))
                {
                    obliAux.FulfillOn = pol.Effect.Permit;
                }
                lstObligations.Items.RemoveAt(obligationIndex);
                lstObligations.Items.Insert(obligationIndex, obliAux);
            }
            obligationIndex = lstObligations.SelectedIndex;
            pol.ObligationElementReadWrite obligation = lstObligations.SelectedItem as pol.ObligationElementReadWrite;

            if (!LoadingData)
            {
                try
                {
                    LoadingData = true;

                    if (obligation != null)
                    {
                        txtId.Text = obligation.ObligationId;
                        cmbEffect.SelectedIndex = cmbEffect.FindStringExact(obligation.FulfillOn.ToString());

                        lstAttributeAssignments.Items.Clear();
                        foreach (pol.AttributeAssignmentElementReadWrite attr in obligation.AttributeAssignment)
                        {
                            lstAttributeAssignments.Items.Add(attr);
                        }
                        txtAttributeId.Text         = string.Empty;
                        txtAttributeAssignemnt.Text = string.Empty;
                    }
                    index = -1;
                }
                finally
                {
                    LoadingData = false;
                }
            }
            else
            {
                obligationIndex = -1;
            }
        }
Пример #4
0
        private void btnAttributeAssignmentsRemove_Click(object sender, System.EventArgs e)
        {
            index = -1;
            pol.ObligationElementReadWrite          obligation = lstObligations.SelectedItem as pol.ObligationElementReadWrite;
            pol.AttributeAssignmentElementReadWrite attribute  = lstAttributeAssignments.SelectedItem as pol.AttributeAssignmentElementReadWrite;

            try
            {
                LoadingData = true;

                txtAttributeAssignemnt.Text = string.Empty;
                txtAttributeId.Text         = string.Empty;

                obligation.AttributeAssignment.RemoveAt(lstAttributeAssignments.SelectedIndex);
                lstAttributeAssignments.Items.RemoveAt(lstAttributeAssignments.SelectedIndex);
            }
            finally
            {
                LoadingData = false;
            }
        }
		/// <summary>
		/// Adds an object to the end of the CollectionBase.
		/// </summary>
		/// <param name="value">The Object to be added to the end of the CollectionBase. </param>
		/// <returns>The CollectionBase index at which the value has been added.</returns>
		public int Add( AttributeAssignmentElementReadWrite value )  
		{
			return( List.Add( value ) );
		}
Пример #6
0
 /// <summary>
 /// Adds an object to the end of the CollectionBase.
 /// </summary>
 /// <param name="value">The Object to be added to the end of the CollectionBase. </param>
 /// <returns>The CollectionBase index at which the value has been added.</returns>
 public int Add(AttributeAssignmentElementReadWrite value)
 {
     return(List.Add(value));
 }
Пример #7
0
 private void btnAttributeAssignmentsAdd_Click(object sender, System.EventArgs e)
 {
     pol.ObligationElementReadWrite obligation = lstObligations.SelectedItem as pol.ObligationElementReadWrite;
     pol.AttributeAssignmentElementReadWrite oAtt = new pol.AttributeAssignmentElementReadWrite("TODO: Add AttributeId",Consts.Schema1.InternalDataTypes.XsdString,
         string.Empty, obligation.SchemaVersion );
     obligation.AttributeAssignment.Add( oAtt );
     lstAttributeAssignments.Items.Add( oAtt );
 }