public static void DeleteAllRestrictions(this NameParameterForAnalysis parameter) { foreach (var parameterForAnalysis in StaticData.ConditionsForParameterForAnalysis.Keys) { parameterForAnalysis.DeleteFromRestrictions(); } }
public ParameterForAnalysis(PropertiesSystem _propertiesSystem, NameParameterForAnalysis parameter, Func <double?> calculate) { TypeParameter = parameter; propertiesSystem = _propertiesSystem; _propertiesSystem.ParametersForAnalysis.Add(TypeParameter, this); Calculate = calculate; }
public static object ToPair(this NameParameterForAnalysis parameter) { return(new { Name = parameter.GetDesignation(), Description = parameter.GetDescription(), Value = parameter.GetName() }); }
public static UnitType GetUnit(this NameParameterForAnalysis parameter) { if (Units.TryGetValue(parameter, out UnitType unitType)) { return(unitType); } throw new ArgumentException(paramName: parameter.ToString(), message: String.Format("Тип для параметра {0} не найден", parameter.ToString())); }
public static string GetDesignation(this NameParameterForAnalysis parameter) { if (Designations.TryGetValue(parameter, out string designation)) { return(designation); } else { return(parameter.ToString()); } }
public static bool DeleteFromRestrictions(this NameParameterForAnalysis parameter) { if (!StaticData.ConditionsForParameterForAnalysis.ContainsKey(parameter)) { return(false); } StaticData.ConditionsForParameterForAnalysis.Remove(parameter); parameter.VerificateParameterForCurrentSystem(); return(true); }
public static object ToParameter(this NameParameterForAnalysis parameter, double?value, bool correct) { return(new { Name = parameter.GetName(), Designation = parameter.GetDesignation(), Description = parameter.GetDescription(), Unit = parameter.GetUnit().GetDesignation(), Value = value.HasValue ? value.Value.ToString() : "_", Correct = correct }); }
public static object ToRestriction(this NameParameterForAnalysis parameter, ConditionType conditionType, double value) { dynamic result = new ExpandoObject(); result.name = parameter.GetDesignation(); result.description = parameter.GetDescription(); result.unit = parameter.GetUnit().GetDesignation(); result.condition = conditionType.GetDesignation(); result.value = value; result.restrictionName = parameter.GetName(); return(result); }
public static List <NameParameterWithEnter> GetDependences(this NameParameterForAnalysis parameter) { List <NameParameterWithEnter> dependences = new List <NameParameterWithEnter>(); if (Dependences.TryGetValue(parameter, out dependences)) { return(dependences); } else { return(dependences); } }
private static void VerificateParameterForCurrentSystem(this NameParameterForAnalysis parameter) { StaticData.CurrentSystems.ParametersForAnalysis[parameter].Verification(out string message); }
public static void AddToRestrictions(this NameParameterForAnalysis parameter, ConditionType conditionType, double value) { StaticData.ConditionsForParameterForAnalysis.Add(parameter, new Condition(conditionType, value)); parameter.VerificateParameterForCurrentSystem(); }
public static bool AddedToRestrictions(this NameParameterForAnalysis parameter) { return(StaticData.ConditionsForParameterForAnalysis.Keys.Contains(parameter)); }
public static string GetName(this NameParameterForAnalysis parameter) { return(Enum.GetName(typeof(NameParameterForAnalysis), parameter)); }
public static double Calculate(this NameParameterForAnalysis parameter) { return(0); }
public Restriction(NameParameterForAnalysis parameter, Condition condition) { ParameterForAnalysis = parameter; ConditionType = condition.ConditionType; Value = condition.Value; }