This question is locked. New answers and comments are not allowed.
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.
Thank you,
regards Norbert
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