Пример #1
0
        private void InsertNewITM(SteppedCalMethodViewModel item)
        {
            var stepped = new TRACK_COMPART_WORN_LIMIT_ITM
            {
                compartid_auto   = item.CompartId,
                MeasurePointId   = item.MeasurementPointId,
                track_tools_auto = item.ToolId,
                track_compart_worn_limit_itm_auto = item.WornCalculationMethodTypeId,

                start_depth_new        = item.StartDepthNew == null ? 0 : item.StartDepthNew,
                wear_depth_10_percent  = item.StartDepth_10 == null ? 0 : item.StartDepth_10,
                wear_depth_20_percent  = item.StartDepth_20 == null ? 0 : item.StartDepth_20,
                wear_depth_30_percent  = item.StartDepth_30 == null ? 0 : item.StartDepth_30,
                wear_depth_40_percent  = item.StartDepth_40 == null ? 0 : item.StartDepth_40,
                wear_depth_50_percent  = item.StartDepth_50 == null ? 0 : item.StartDepth_50,
                wear_depth_60_percent  = item.StartDepth_60 == null ? 0 : item.StartDepth_60,
                wear_depth_70_percent  = item.StartDepth_70 == null ? 0 : item.StartDepth_70,
                wear_depth_80_percent  = item.StartDepth_80 == null ? 0 : item.StartDepth_80,
                wear_depth_90_percent  = item.StartDepth_90 == null ? 0 : item.StartDepth_90,
                wear_depth_100_percent = item.StartDepth_100 == null ? 0 : item.StartDepth_100,
                wear_depth_110_percent = item.StartDepth_110 == null ? 0 : item.StartDepth_110,
                wear_depth_120_percent = item.StartDepth_120 == null ? 0 : item.StartDepth_120,
            };

            _context.TRACK_COMPART_WORN_LIMIT_ITM.Add(stepped);
        }
Пример #2
0
        private void UpdateITM(SteppedCalMethodViewModel item, TRACK_COMPART_WORN_LIMIT_ITM stepped)
        {
            stepped.start_depth_new = item.StartDepthNew == null ? 0 : item.StartDepthNew;

            stepped.wear_depth_10_percent  = item.StartDepth_10 == null ? 0 : item.StartDepth_10;
            stepped.wear_depth_20_percent  = item.StartDepth_20 == null ? 0 : item.StartDepth_20;
            stepped.wear_depth_30_percent  = item.StartDepth_30 == null ? 0 : item.StartDepth_30;
            stepped.wear_depth_40_percent  = item.StartDepth_40 == null ? 0 : item.StartDepth_40;
            stepped.wear_depth_50_percent  = item.StartDepth_50 == null ? 0 : item.StartDepth_50;
            stepped.wear_depth_60_percent  = item.StartDepth_60 == null ? 0 : item.StartDepth_60;
            stepped.wear_depth_70_percent  = item.StartDepth_70 == null ? 0 : item.StartDepth_70;
            stepped.wear_depth_80_percent  = item.StartDepth_80 == null ? 0 : item.StartDepth_80;
            stepped.wear_depth_90_percent  = item.StartDepth_90 == null ? 0 : item.StartDepth_90;
            stepped.wear_depth_100_percent = item.StartDepth_100 == null ? 0 : item.StartDepth_100;
            stepped.wear_depth_110_percent = item.StartDepth_110 == null ? 0 : item.StartDepth_110;
            stepped.wear_depth_120_percent = item.StartDepth_120 == null ? 0 : item.StartDepth_120;

            stepped.track_tools_auto = item.ToolId;
            stepped.MeasurePointId   = item.MeasurementPointId;

            _context.Entry(stepped).State = EntityState.Modified;
        }
Пример #3
0
        private void UpdateCalculationSteppedMethod(SteppedCalMethodViewModel 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_ITM.FirstOrDefault(t => t.track_compart_worn_limit_itm_auto == item.WornCalculationMethodTableAutoId);
                if (stepped == null)
                {
                    InsertNewITM(item);
                }
                else
                {
                    UpdateITM(item, stepped);
                }
            }
            else
            {
                InsertNewTRACKCOMPARTExtRecord(item);
                InsertNewITM(item);
            }
        }