public static CustomField GetCustomField(LoginUser loginUser, int customFieldID)
        {
            CustomFields customFields = new CustomFields(loginUser);

            customFields.LoadByCustomFieldID(customFieldID);
            if (customFields.IsEmpty)
            {
                return(null);
            }
            else
            {
                return(customFields[0]);
            }
        }
        public CustomPortalColumnProxy GetProxy()
        {
            CustomPortalColumnProxy result = new CustomPortalColumnProxy();

            result.CustomFieldID  = this.CustomFieldID;
            result.StockFieldID   = this.StockFieldID;
            result.Position       = this.Position;
            result.OrganizationID = this.OrganizationID;
            result.CustomColumnID = this.CustomColumnID;

            if (result.CustomFieldID != null)
            {
                CustomFields cf = new CustomFields(BaseCollection.LoginUser);
                cf.LoadByCustomFieldID((int)result.CustomFieldID);

                TicketTypes ticketTypes = new TicketTypes(BaseCollection.LoginUser);
                ticketTypes.LoadAllPositions(BaseCollection.LoginUser.OrganizationID);

                TicketType ticketType = ticketTypes.FindByTicketTypeID(cf[0].AuxID);
                if (ticketType == null)
                {
                    result.FieldText = cf[0].Name;
                }
                else
                {
                    result.FieldText = string.Format("{0} ({1})", cf[0].Name, ticketType.Name);
                }
            }
            else
            {
                ReportTableFields rt = new ReportTableFields(BaseCollection.LoginUser);
                rt.LoadByReportTableFieldID((int)result.StockFieldID);
                result.FieldText = rt[0].Alias;
            }



            return(result);
        }
Ejemplo n.º 3
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();
        }