Exemplo n.º 1
0
        public void ValidatePositions(int organizationID, ReferenceType refType, int auxID)
        {
            CustomFields fields = new CustomFields(LoginUser);

            fields.LoadByReferenceType(organizationID, refType, auxID);
            int i = 0;

            foreach (CustomField field in fields)
            {
                field.Position = i;
                i++;
            }
            fields.Save();
        }
Exemplo n.º 2
0
        public void MovePositionDown(int customFieldID)
        {
            CustomFields fields1 = new CustomFields(LoginUser);

            fields1.LoadByCustomFieldID(customFieldID);
            ValidatePositions(fields1[0].OrganizationID, fields1[0].RefType, fields1[0].AuxID);
            if (fields1.IsEmpty || fields1[0].Position >= GetMaxPosition(fields1[0].OrganizationID, fields1[0].RefType, fields1[0].AuxID))
            {
                return;
            }

            CustomFields fields2 = new CustomFields(LoginUser);

            fields2.LoadByPosition(fields1[0].OrganizationID, fields1[0].RefType, fields1[0].AuxID, fields1[0].Position + 1);
            if (!fields2.IsEmpty)
            {
                fields2[0].Position = fields2[0].Position - 1;
                fields2.Save();
            }

            fields1[0].Position = fields1[0].Position + 1;
            fields1.Save();
        }