예제 #1
0
        private void InsertNewInflectionCalMethod(InflectionCalMethodViewModel item)
        {
            var newcat = new TRACK_COMPART_WORN_LIMIT_CAT
            {
                compartid_auto   = item.CompartId,
                MeasurePointId   = item.MeasurementPointId,
                track_tools_auto = item.ToolId,
                track_compart_worn_limit_cat_auto = item.WornCalculationMethodTypeId,

                adjust_base        = item.Adjust_base == null ? 0 : item.Adjust_base,
                hi_inflectionPoint = item.Hi_InflectionPoint == null ? 0 : item.Hi_InflectionPoint,
                hi_intercept1      = item.Hi_Intercept1 == null ? 0 : item.Hi_Intercept1,
                hi_intercept2      = item.Hi_Intercept2 == null ? 0 : item.Hi_Intercept2,
                hi_slope1          = item.Hi_Slope1 == null ? 0 : item.Hi_Slope1,
                hi_slope2          = item.Hi_Slope2 == null ? 0 : item.Hi_Slope2,
                mi_inflectionPoint = item.Mi_InflectionPoint == null ? 0 : item.Mi_InflectionPoint,
                mi_intercept1      = item.Mi_Intercept1 == null ? 0 : item.Mi_Intercept1,
                mi_intercept2      = item.Mi_Intercept2 == null ? 0 : item.Mi_Intercept2,
                mi_slope1          = item.Mi_Slope1 == null ? 0 : item.Mi_Slope1,
                mi_slope2          = item.Mi_Slope2 == null ? 0 : item.Mi_Slope2,
                slope = item.Slope == null ? 0 : item.Slope,
            };

            _context.TRACK_COMPART_WORN_LIMIT_CAT.Add(newcat);
        }
예제 #2
0
 private void UpdateExsistingInflectionCalculationMethod(InflectionCalMethodViewModel item, TRACK_COMPART_WORN_LIMIT_CAT cat)
 {
     cat.adjust_base           = item.Adjust_base == null ? 0 : item.Adjust_base;
     cat.hi_inflectionPoint    = item.Hi_InflectionPoint == null ? 0 : item.Hi_InflectionPoint;
     cat.hi_intercept1         = item.Hi_Intercept1 == null ? 0 : item.Hi_Intercept1;
     cat.hi_intercept2         = item.Hi_Intercept2 == null ? 0 : item.Hi_Intercept2;
     cat.hi_slope1             = item.Hi_Slope1 == null ? 0 : item.Hi_Slope1;
     cat.hi_slope2             = item.Hi_Slope2 == null ? 0 : item.Hi_Slope2;
     cat.mi_inflectionPoint    = item.Mi_InflectionPoint == null ? 0 : item.Mi_InflectionPoint;
     cat.mi_intercept1         = item.Mi_Intercept1 == null ? 0 : item.Mi_Intercept1;
     cat.mi_intercept2         = item.Mi_Intercept2 == null ? 0 : item.Mi_Intercept2;
     cat.mi_slope1             = item.Mi_Slope1 == null ? 0 : item.Mi_Slope1;
     cat.mi_slope2             = item.Mi_Slope2 == null ? 0 : item.Mi_Slope2;
     _context.Entry(cat).State = EntityState.Modified;
 }
예제 #3
0
        private void UpdateCalculationInflectionMethod(InflectionCalMethodViewModel item)
        {
            var checker = CheckEXTRecordExsistence(item.CompartId, item.ToolId, item.MeasurementPointId.Value);

            if (checker != null)
            {
                checker.track_compart_worn_calc_method_auto = item.WornCalculationMethodTypeId;
                _context.Entry(checker).State = EntityState.Modified;
                var stepped = _context.TRACK_COMPART_WORN_LIMIT_CAT.FirstOrDefault(t => t.track_compart_worn_limit_cat_auto == item.WornCalculationMethodTableAutoId);
                if (stepped == null)
                {
                    InsertNewInflectionCalMethod(item);
                }
                else
                {
                    UpdateExsistingInflectionCalculationMethod(item, stepped);
                }
            }
            else
            {
                InsertNewTRACKCOMPARTExtRecord(item);
                InsertNewInflectionCalMethod(item);
            }
        }