Ordering doesn't work (2012.1.118.1)

2 posts, 0 answers
  1. Norbert
    Norbert avatar
    35 posts
    Member since:
    Dec 2009

    Posted 03 Feb 2012 Link to this post

    Hello guys,

    I'm trying JustCode and I think the ordering function (Ctrl + Alt + F) does not work.
    I've also tried from menu and Context menu - no success.

    The code is beeing formatted but the ordering is the same...and yes I've put the flag in the options menu.

    namespace ES.Abs.Services.CalculatorService.Rules
    {
        #region usings
        //.NET
        using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.Linq;
        using System.Text;
        using System.IO;
        using System.Xml.Linq;
        //internal references
        using ES.Abs.AppManager;
        using ES.Abs.Core;
        using ES.Abs.Data;
        //3rd party references
     
        #endregion
        public abstract class CalculationRuleBase : ICalculationRule
        {
            public T GetParameter<T>(string name)
            {
                CalcruleParameter parameter = this.GetParameterCore(name);
                if ( parameter == null )
                {
                    throw new ArgumentException(string.Format("Der Parameter {0} kann nicht gefunden werden.", name));
                }
                else
                {
                    try
                    {
                        var result = this.ChangeType<T>(parameter.Value);
                        return result;
                    }
                    catch
                    {
                        throw new ArgumentException(string.Format("Der Parameter {0} kann nicht in den Typ {1} konvertiert werden.", name, typeof(T).Name));
                    }
                }
            }
     
            public virtual CalcruleType RuleType
            {
                get
                {
                    return CalcruleType.None;
                }
            }
     
            public abstract string Name
            {
                get;
            }
     
            public abstract string Description
            {
                get;
            }
     
            public abstract string ParameterKey
            {
                get;
            }
     
            public abstract string RuleVersion
            {
                get;
            }
     
            public abstract void Initialize(AppVersion appVersion);
     
            public abstract void Validate();
     
            public abstract void Calculate();
     
     
            private CalcruleParameter GetParameterCore(string name)
            {
                CalcruleParameter parameter;
                using ( IRepository<CalcruleParameter> rep = AppNew.Instance.GetService<IRepository<CalcruleParameter>>() )
                {
                    parameter = rep.Get(p => p.Name == name
                                          && p.RuleTypeId_FK == (int)this.RuleType
                                          && p.ParameterKey == this.ParameterKey);
                }
                return parameter;
            }
     
            private T ChangeType<T>(object value)
            {
                return (T)ChangeType(typeof(T), value);
            }
     
            private object ChangeType(Type t, object value)
            {
                TypeConverter tc = TypeDescriptor.GetConverter(t);
                return tc.ConvertFrom(value);
            }
     
     
        }
    }

    Thank you,
    regards Norbert
  2. Borislav
    Admin
    Borislav avatar
    35 posts

    Posted 07 Feb 2012 Link to this post

    Hello Norbert,

    Thanks for reporting this issue. I have investigated it and it seems the ordering of the class members is working as it should. In JustCode Options / Code Style / C# / Ordering page you can specify how the ordering should work for you. For example there is a listbox, where you can specify the public members to be ordered before the private ones. It you want the members to be sorted by name, you should check the check-box 'Sort alphabetically similar elements'. For more details please check the JustCode documentation.

    Please note that for the moment we do not support ordering of elements, which are located in regions. We are currently working on supporting ordering in regions and we will do our best to release it as soon as possible.

    I have created a PITS item with you code snippet and associated it to your account so you can track its progress: 9632

    Regards,
    Borislav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
Back to Top