Exemplo n.º 1
0
        private Func <bool> MakeInsertDelegate(DrivePlanUploadModel model)
        {
            var driveRecordBll = new DriveRecordsBll();

            return(() =>
            {
                var inserted = driveRecordBll.Insert(model.DriveRecords);
                if (inserted.Id > 0)
                {
                    model.DriveSignPoints.ForEach(item => item.DriveRecordId = inserted.Id);
                    model.DriveTrainNoAndLines.ForEach(item => item.DriveRecordId = inserted.Id);
                    model.TrainFormations.ForEach(item => item.DriveRecordId = inserted.Id);

                    var signBll = new DriveSignPointBll();
                    var trainBll = new DriveTrainNoAndLineBll();
                    var formationsBll = new TrainFormationBll();

                    signBll.BulkInsert(model.DriveSignPoints);
                    trainBll.BulkInsert(model.DriveTrainNoAndLines);
                    formationsBll.BulkInsert(model.TrainFormations);

                    return true;
                }

                return false;
            });
        }
Exemplo n.º 2
0
        private void MakeSureDatetimeHasLegalValue(DrivePlanUploadModel model)
        {
            MakeSureDatetimeHasLegalValue(model.DriveRecords);

            model.DriveSignPoints.ForEach(MakeSureDatetimeHasLegalValue);
            model.DriveTrainNoAndLines.ForEach(MakeSureDatetimeHasLegalValue);
            model.TrainFormations.ForEach(MakeSureDatetimeHasLegalValue);
        }