public OxoTrim(FdpTrim fromTrim)
 {
     Id = fromTrim.TrimId.GetValueOrDefault();
     DocumentId = fromTrim.DocumentId;
     ProgrammeId = fromTrim.ProgrammeId;
     Gateway = fromTrim.Gateway;
     CreatedOn = fromTrim.CreatedOn;
     CreatedBy = fromTrim.CreatedBy;
     UpdatedOn = fromTrim.UpdatedOn;
     UpdatedBy = fromTrim.UpdatedBy;
     IsActive = fromTrim.IsActive;
     DPCK = fromTrim.DPCK;
     Name = fromTrim.Name;
     Level = fromTrim.Level;
     Abbreviation = fromTrim.Abbreviation;
     TrimId = fromTrim.TrimId;
     BMC = fromTrim.BMC;
 }
Exemple #2
0
 public OxoTrim(FdpTrim fromTrim)
 {
     Id           = fromTrim.TrimId.GetValueOrDefault();
     DocumentId   = fromTrim.DocumentId;
     ProgrammeId  = fromTrim.ProgrammeId;
     Gateway      = fromTrim.Gateway;
     CreatedOn    = fromTrim.CreatedOn;
     CreatedBy    = fromTrim.CreatedBy;
     UpdatedOn    = fromTrim.UpdatedOn;
     UpdatedBy    = fromTrim.UpdatedBy;
     IsActive     = fromTrim.IsActive;
     DPCK         = fromTrim.DPCK;
     Name         = fromTrim.Name;
     Level        = fromTrim.Level;
     Abbreviation = fromTrim.Abbreviation;
     TrimId       = fromTrim.TrimId;
     BMC          = fromTrim.BMC;
 }
        // Trim and mappings

        public async Task<FdpTrim> DeleteFdpTrim(FdpTrim trimToDelete)
        {
            return await Task.FromResult(_trimDataStore.FdpTrimDelete(trimToDelete));
        }
 public async Task<ImportError> AddTrim(ImportQueueFilter filter, FdpTrim trimToAdd)
 {
     var task = await Task.FromResult(_trimDataStore.FdpTrimSave(trimToAdd));
     return await Task.FromResult(_importDataStore.ImportErrorGet(filter));
 }
        public async Task<ActionResult> AddMissingTrim(ImportExceptionParameters parameters)
        {
            var filter = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);
            var trim = new FdpTrim()
            {
                ProgrammeId = parameters.ProgrammeId.GetValueOrDefault(),
                Gateway = parameters.Gateway,
                Name = parameters.TrimName,
                Abbreviation = parameters.TrimAbbreviation,
                Level = parameters.TrimLevel,
                DPCK = parameters.DPCK,
                BMC = parameters.DerivativeCode
            };
            importView.CurrentException = await DataContext.Import.AddTrim(filter, trim);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet);
        }
        public FdpTrim FdpTrimDelete(FdpTrim trimToDelete)
        {
            FdpTrim retVal = new EmptyFdpTrim();
            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = DynamicParameters.FromCDSId(CurrentCDSID);
                    para.Add("@FdpTrimId", trimToDelete.FdpTrimId.GetValueOrDefault(), DbType.Int32);

                    retVal = conn.Query<FdpTrim>("dbo.Fdp_Trim_Delete", para, commandType: CommandType.StoredProcedure).FirstOrDefault();
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }
        public FdpTrim FdpTrimSave(FdpTrim trim)
        {
            FdpTrim retVal = new EmptyFdpTrim();
            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = DynamicParameters.FromCDSId(CurrentCDSID);
                    para.Add("@ProgrammeId", trim.ProgrammeId, DbType.Int32);
                    para.Add("@Gateway", trim.Gateway, DbType.String);
                    para.Add("@DerivativeCode", trim.BMC, DbType.String);
                    para.Add("@TrimName", trim.Name, DbType.String);
                    para.Add("@TrimAbbreviation", trim.Abbreviation, DbType.String);
                    para.Add("@TrimLevel", trim.Level, DbType.String);
                    para.Add("@DPCK", trim.DPCK, DbType.String);

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