public override List <CoefType> GetUsedCoefType(MethodConditions conditions) { return(new List <CoefType>() { CoefType.SpecialEco7 }); }
/// <summary> /// Возвращает используемые в формуле типы коэффициентов /// </summary> /// <returns></returns> public List <CoefType> GetUsedCoefType(MethodConditions conditions) { var allTypes = new List <CoefType>(); var implement = GetImplementation(conditions.MethodType); if (implement == null) { return(allTypes); } allTypes = implement.GetUsedCoefType(conditions); if (conditions.UseAll || conditions.UseDopCoef) { allTypes.Add(CoefType.DopCoef); } if (!conditions.GetAllUsed) { if (conditions.IsDouble) { allTypes = allTypes.Where(x => DoubleCoefs.Contains(x)).ToList(); } else { allTypes = allTypes.Where(x => !DoubleCoefs.Contains(x)).ToList(); } } return(allTypes); }
/// <summary> /// Возвращает список используемых в формуле конкретного расчета коэффициентов /// </summary> /// <param name="calcId"></param> /// <param name="methodId"></param> /// <returns></returns> public List <ChosenCoefModel> GetChosenCoefsList(MethodConditions conditions) { OMCalcMethod method = OMCalcMethod.Where(x => x.Id == conditions.MethodId).SelectAll().ExecuteFirstOrDefault(); //var coefTypes = GetCoefTypes(method.MethodType_Code, useMax, method.UseDopCoef ?? false, isDouble, false); conditions.MethodType = method.MethodType_Code; conditions.UseDopCoef = method.UseDopCoef ?? false; var coefTypes = GetUsedCoefType(conditions); var chosenCoefGrid = new List <ChosenCoefModel>(); var coefIds = OMCalcCoefConnection.Where(x => x.CalcId == conditions.CalcId).SelectAll().Execute().Select(x => x.CoefId).ToList(); foreach (var coefType in coefTypes) { OMCalcCoefs coef = null; if (coefIds.Count > 0) { coef = OMCalcCoefs.Where(x => x.CoefType_Code == coefType && coefIds.Contains(x.Id)).SelectAll().ExecuteFirstOrDefault(); } if (conditions.CalcId == -1 || coef == null) { chosenCoefGrid.Add(new ChosenCoefModel() { Id = -1, Name = "", Value = 1, Value2 = 1, CoefType_Code = coefType, CoefType = coefType.GetEnumDescription(), Mark = GetCoefTypeMark(coefType) }); } else { chosenCoefGrid.Add(new ChosenCoefModel() { Id = coef.Id, Name = coef.Name, Value = coef.Value, Value2 = coef.Value2, CoefType_Code = coefType, CoefType = coefType.GetEnumDescription(), Mark = GetCoefTypeMark(coefType), ActualS = coef.ActualS, ActualPo = coef.ActualPo }); } } return(chosenCoefGrid); }
public override List <CoefType> GetUsedCoefType(MethodConditions conditions) { var allTypes = new List <CoefType>() { CoefType.BaseAp, CoefType.Vri, CoefType.Correct, CoefType.Location, CoefType.K1 }; if (!conditions.UseAll) { if (!conditions.UseMaxFunction) { allTypes.Remove(CoefType.K1); } } return(allTypes); }
/// <summary> /// Возвращает формулу /// </summary> /// <param name="methodId"></param> /// <param name="method"></param> /// <param name="useMax"></param> /// <param name="useDopCoef"></param> /// <returns></returns> public string GetFormula(MethodConditions conditions) { if (conditions.MethodId.HasValue) { OMCalcMethod met = OMCalcMethod.Where(x => x.Id == conditions.MethodId).SelectAll().ExecuteFirstOrDefault(); conditions.MethodType = met.MethodType_Code; conditions.UseDopCoef = met.UseDopCoef ?? false; } string res = ""; var implement = GetImplementation(conditions.MethodType); if (implement == null) { return(res); } res = implement.GetFormula(conditions.UseMaxFunction); if (conditions.UseDopCoef) { res += " x Kдоп"; } return(res); }
/// <summary> /// Возвращает используемые в формуле типы коэффициентов /// </summary> /// <returns></returns> public abstract List <CoefType> GetUsedCoefType(MethodConditions conditions);