Exemple #1
0
 public OxoDerivative(FdpDerivative fromDerivative)
 {
     DocumentId     = fromDerivative.DocumentId;
     ProgrammeId    = fromDerivative.ProgrammeId;
     Gateway        = fromDerivative.Gateway;
     CreatedOn      = fromDerivative.CreatedOn;
     CreatedBy      = fromDerivative.CreatedBy;
     UpdatedOn      = fromDerivative.UpdatedOn;
     UpdatedBy      = fromDerivative.UpdatedBy;
     IsActive       = fromDerivative.IsActive;
     BodyId         = fromDerivative.BodyId;
     EngineId       = fromDerivative.EngineId;
     TransmissionId = fromDerivative.TransmissionId;
     DerivativeCode = fromDerivative.DerivativeCode;
 }
 public OxoDerivative(FdpDerivative fromDerivative)
 {
     DocumentId = fromDerivative.DocumentId;
     ProgrammeId = fromDerivative.ProgrammeId;
     Gateway = fromDerivative.Gateway;
     CreatedOn = fromDerivative.CreatedOn;
     CreatedBy = fromDerivative.CreatedBy;
     UpdatedOn = fromDerivative.UpdatedOn;
     UpdatedBy = fromDerivative.UpdatedBy;
     IsActive = fromDerivative.IsActive;
     BodyId = fromDerivative.BodyId;
     EngineId = fromDerivative.EngineId;
     TransmissionId = fromDerivative.TransmissionId;
     DerivativeCode = fromDerivative.DerivativeCode;
 }
 // Derivatives and mappings
 
 public async Task<FdpDerivative> DeleteFdpDerivative(FdpDerivative derivativeToDelete)
 {
     return await Task.FromResult(_derivativeDataStore.FdpDerivativeDelete(derivativeToDelete));
 }
 public async Task<ImportError> AddDerivative(ImportQueueFilter filter, FdpDerivative derivativeToAdd)
 {
     var task = await Task.FromResult(_derivativeDataStore.FdpDerivativeSave(derivativeToAdd));
     return await Task.FromResult(_importDataStore.ImportErrorGet(filter));
 }
        public async Task<ActionResult> AddMissingDerivative(ImportExceptionParameters parameters)
        {
            var filter = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);
            var derivative = new FdpDerivative()
            {
                ProgrammeId = parameters.ProgrammeId.GetValueOrDefault(),
                Gateway = parameters.Gateway,
                DerivativeCode = parameters.DerivativeCode,
                BodyId = parameters.BodyId.GetValueOrDefault(),
                EngineId = parameters.EngineId.GetValueOrDefault(),
                TransmissionId = parameters.TransmissionId.GetValueOrDefault()
            };
            importView.CurrentException = await DataContext.Import.AddDerivative(filter, derivative);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet);
        }
        public FdpDerivative FdpDerivativeSave(FdpDerivative derivative)
        {
            FdpDerivative retVal = new EmptyFdpDerivative();
            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = DynamicParameters.FromCDSId(CurrentCDSID);
                    para.Add("@ProgrammeId", derivative.ProgrammeId.GetValueOrDefault(), DbType.Int32);
                    para.Add("@Gateway", derivative.Gateway, DbType.String);
                    para.Add("@DerivativeCode", derivative.DerivativeCode, DbType.String);
                    para.Add("@BodyId", derivative.BodyId.GetValueOrDefault(), DbType.Int32);
                    para.Add("@EngineId", derivative.EngineId.GetValueOrDefault(), DbType.String);
                    para.Add("@TransmissionId", derivative.TransmissionId.GetValueOrDefault(), DbType.Int32);

                    retVal = conn.Query<FdpDerivative>("dbo.Fdp_Derivative_Save", para, commandType: CommandType.StoredProcedure).FirstOrDefault();
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }
        public FdpDerivative FdpDerivativeDelete(FdpDerivative derivativeToDelete)
        {
            FdpDerivative retVal = new EmptyFdpDerivative();
            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = DynamicParameters.FromCDSId(CurrentCDSID);
                    para.Add("@FdpDerivativeId", derivativeToDelete.FdpDerivativeId.GetValueOrDefault(), DbType.Int32);

                    retVal = conn.Query<FdpDerivative>("dbo.Fdp_Derivative_Delete", para, commandType: CommandType.StoredProcedure).FirstOrDefault();
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }