Ejemplo n.º 1
0
        public FdpDerivativeMapping FdpDerivativeMappingGet(DerivativeMappingFilter filter)
        {
            FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping();

            using (var conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    para.Add("@FdpDerivativeMappingId", filter.DerivativeMappingId.GetValueOrDefault(), DbType.Int32);

                    var results = conn.Query <FdpDerivativeMapping>("Fdp_DerivativeMapping_Get", para, commandType: CommandType.StoredProcedure);
                    if (results.Any())
                    {
                        retVal = results.First();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return(retVal);
        }
Ejemplo n.º 2
0
        public FdpDerivativeMapping FdpDerivativeMappingCopy(FdpDerivativeMapping derivativeMappingToCopy, int toDocumentId)
        {
            FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping();

            using (var conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();

                    para.Add("@FdpDerivativeMappingId", derivativeMappingToCopy.FdpDerivativeMappingId, DbType.Int32);
                    para.Add("@DocumentId", toDocumentId, DbType.Int32);
                    para.Add("@CDSId", CurrentCDSID, DbType.String);

                    var rows = conn.Execute("Fdp_DerivativeMapping_Copy", para, commandType: CommandType.StoredProcedure);

                    retVal = FdpDerivativeMappingGet(new DerivativeMappingFilter {
                        DerivativeMappingId = derivativeMappingToCopy.FdpDerivativeMappingId
                    });
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return(retVal);
        }
Ejemplo n.º 3
0
        public FdpDerivativeMapping FdpDerivativeMappingDelete(FdpDerivativeMapping derivativeMapping)
        {
            FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping();

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    para.Add("@FdpDerivativeMappingId", derivativeMapping.FdpDerivativeMappingId, DbType.Int32);
                    para.Add("@CDSId", CurrentCDSID, DbType.String);

                    var results = conn.Query <FdpDerivativeMapping>("Fdp_DerivativeMapping_Delete", para, commandType: CommandType.StoredProcedure);
                    if (results.Any())
                    {
                        retVal = results.First();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return(retVal);
        }
        public FdpDerivativeMapping FdpDerivativeMappingDelete(FdpDerivativeMapping derivativeMapping)
        {
            FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping();
            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    para.Add("@FdpDerivativeMappingId", derivativeMapping.FdpDerivativeMappingId, DbType.Int32);
                    para.Add("@CDSId", CurrentCDSID, DbType.String);

                    var results = conn.Query<FdpDerivativeMapping>("Fdp_DerivativeMapping_Delete", para, commandType: CommandType.StoredProcedure);
                    if (results.Any())
                    {
                        retVal = results.First();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }
 private void InitialiseMembers()
 {
     DerivativeMapping = new EmptyFdpDerivativeMapping();
     IdentifierPrefix  = "Page";
     Programmes        = Enumerable.Empty <Programme>();
     Bodies            = Enumerable.Empty <ModelBody>();
     Engines           = Enumerable.Empty <ModelEngine>();
     Transmissions     = Enumerable.Empty <ModelTransmission>();
     Gateways          = Enumerable.Empty <Gateway>();
     CarLines          = Enumerable.Empty <CarLine>();
     ModelYears        = Enumerable.Empty <ModelYear>();
     CurrentAction     = DerivativeMappingAction.NotSet;
     Documents         = Enumerable.Empty <OXODoc>();
 }
Ejemplo n.º 6
0
        public FdpDerivativeMapping FdpDerivativeMappingSave(FdpDerivativeMapping derivativeMapping)
        {
            FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping();

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();

                    para.Add("@ImportDerivativeCode", derivativeMapping.ImportDerivativeCode, DbType.String);
                    para.Add("@DocumentId", derivativeMapping.DocumentId, DbType.Int32);
                    //para.Add("@ProgrammeId", derivativeMapping.ProgrammeId, DbType.Int32);
                    //para.Add("@Gateway", derivativeMapping.Gateway, DbType.String);
                    if (!string.IsNullOrEmpty(derivativeMapping.DerivativeCode))
                    {
                        para.Add("@DerivativeCode", derivativeMapping.DerivativeCode, DbType.String);
                    }
                    para.Add("@BodyId", derivativeMapping.BodyId, DbType.Int32);
                    para.Add("@EngineId", derivativeMapping.EngineId, DbType.Int32);
                    para.Add("@TransmissionId", derivativeMapping.TransmissionId, DbType.Int32);
                    para.Add("@CDSId", CurrentCDSID, DbType.String);

                    var results = conn.Query <FdpDerivativeMapping>("Fdp_DerivativeMapping_Save", para, commandType: CommandType.StoredProcedure);
                    var fdpDerivativeMappings = results as IList <FdpDerivativeMapping> ?? results.ToList();
                    if (fdpDerivativeMappings.Any())
                    {
                        retVal = fdpDerivativeMappings.First();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return(retVal);
        }
        public FdpDerivativeMapping FdpDerivativeMappingGet(DerivativeMappingFilter filter)
        {
            FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping();
            using (var conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    para.Add("@FdpDerivativeMappingId", filter.DerivativeMappingId.GetValueOrDefault(), DbType.Int32);

                    var results = conn.Query<FdpDerivativeMapping>("Fdp_DerivativeMapping_Get", para, commandType: CommandType.StoredProcedure);
                    if (results.Any())
                    {
                        retVal = results.First();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }
 private void InitialiseMembers()
 {
     DerivativeMapping = new EmptyFdpDerivativeMapping();
     IdentifierPrefix = "Page";
     Programmes = Enumerable.Empty<Programme>();
     Bodies = Enumerable.Empty<ModelBody>();
     Engines = Enumerable.Empty<ModelEngine>();
     Transmissions = Enumerable.Empty<ModelTransmission>();
     Gateways = Enumerable.Empty<Gateway>();
     CarLines = Enumerable.Empty<CarLine>();
     ModelYears = Enumerable.Empty<ModelYear>();
     CurrentAction = DerivativeMappingAction.NotSet;
     Documents = Enumerable.Empty<OXODoc>();
 }
        public FdpDerivativeMapping FdpDerivativeMappingCopy(FdpDerivativeMapping derivativeMappingToCopy, int toDocumentId)
        {
            FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping();
            using (var conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();

                    para.Add("@FdpDerivativeMappingId", derivativeMappingToCopy.FdpDerivativeMappingId, DbType.Int32);
                    para.Add("@DocumentId", toDocumentId, DbType.Int32);
                    para.Add("@CDSId", CurrentCDSID, DbType.String);

                    var rows = conn.Execute("Fdp_DerivativeMapping_Copy", para, commandType: CommandType.StoredProcedure);

                    retVal = FdpDerivativeMappingGet(new DerivativeMappingFilter { DerivativeMappingId = derivativeMappingToCopy.FdpDerivativeMappingId });
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }
        public FdpDerivativeMapping FdpDerivativeMappingSave(FdpDerivativeMapping derivativeMapping)
        {
            FdpDerivativeMapping retVal = new EmptyFdpDerivativeMapping();
            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();

                    para.Add("@ImportDerivativeCode", derivativeMapping.ImportDerivativeCode, DbType.String);
                    para.Add("@DocumentId", derivativeMapping.DocumentId, DbType.Int32);
                    //para.Add("@ProgrammeId", derivativeMapping.ProgrammeId, DbType.Int32);
                    //para.Add("@Gateway", derivativeMapping.Gateway, DbType.String);
                    if (!string.IsNullOrEmpty(derivativeMapping.DerivativeCode))
                    {
                        para.Add("@DerivativeCode", derivativeMapping.DerivativeCode, DbType.String);
                    }
                    para.Add("@BodyId", derivativeMapping.BodyId, DbType.Int32);
                    para.Add("@EngineId", derivativeMapping.EngineId, DbType.Int32);
                    para.Add("@TransmissionId", derivativeMapping.TransmissionId, DbType.Int32);
                    para.Add("@CDSId", CurrentCDSID, DbType.String);

                    var results = conn.Query<FdpDerivativeMapping>("Fdp_DerivativeMapping_Save", para, commandType: CommandType.StoredProcedure);
                    var fdpDerivativeMappings = results as IList<FdpDerivativeMapping> ?? results.ToList();
                    if (fdpDerivativeMappings.Any())
                    {
                        retVal = fdpDerivativeMappings.First();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }