Example #1
0
        public ImportQueue ProcessTakeRateData(ImportQueue importQueue)
        {
            TakeRateSummary takeRateFile = new EmptyTakeRateSummary();

            using (var conn = DbHelper.GetDBConnection())
            {
                using (var tran = conn.BeginTransaction())
                {
                    try
                    {
                        var para = new DynamicParameters();
                        para.Add("@FdpImportId", importQueue.ImportId, DbType.Int32);

                        var results = conn.Query <TakeRateSummary>("dbo.Fdp_ImportData_ProcessTakeRateData", para,
                                                                   commandType: CommandType.StoredProcedure, commandTimeout: 600, transaction: tran);
                        var takeRateSummaries = results as IList <TakeRateSummary> ?? results.ToList();
                        if (results != null && takeRateSummaries.Any())
                        {
                            takeRateFile = takeRateSummaries.First();
                        }

                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex);
                        throw;
                    }
                }
            }
            var retVal = ImportQueueGet(importQueue.ImportQueueId.GetValueOrDefault());

            retVal.TakeRateId = takeRateFile.TakeRateId;
            return(retVal);
        }
 private void InitialiseMembers()
 {
     TakeRate  = new EmptyTakeRateSummary();
     TakeRates = new PagedResults <TakeRateSummary>();
     Statuses  = Enumerable.Empty <TakeRateStatus>();
     CurrentTakeRateDataItem = new EmptyTakeRateDataItem();
     CurrentAction           = TakeRateDataItemAction.NotSet;
     IdentifierPrefix        = "Page";
     Document           = new EmptyTakeRateDocument();
     MarketReviewStatus = MarketReviewStatus.NotSet;
 }
        public ImportQueue ImportQueueBulkImportProcess(ImportQueue importQueue)
        {
            TakeRateSummary takeRateFile = new EmptyTakeRateSummary();

            using (var conn = DbHelper.GetDBConnection())
            {
                using (var tran = conn.BeginTransaction())
                {
                    try
                    {
                        var para = new DynamicParameters();
                        para.Add("@FdpImportId", importQueue.ImportId, DbType.Int32);
                        //para.Add("@FdpVolumeHeaderId", null, DbType.Int32, ParameterDirection.Output);

                        if (importQueue.LineNumber.HasValue)
                        {
                            para.Add("@LineNumber", importQueue.LineNumber, DbType.Int32);
                        }

                        var results = conn.Query<TakeRateSummary>("dbo.Fdp_ImportData_Process", para,
                            commandType: CommandType.StoredProcedure, commandTimeout: 600, transaction: tran);
                        var takeRateSummaries = results as IList<TakeRateSummary> ?? results.ToList();
                        if (results != null && takeRateSummaries.Any())
                        {
                            takeRateFile = takeRateSummaries.First();
                        }

                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex);
                        throw;
                    }
                }
            }
            var retVal = ImportQueueGet(importQueue.ImportQueueId.GetValueOrDefault());
            retVal.TakeRateId = takeRateFile.TakeRateId;
            return retVal;
        }
        public TakeRateSummary FdpTakeRateHeaderGet(TakeRateFilter filter)
        {
            TakeRateSummary retVal = new EmptyTakeRateSummary();

            using (var conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    para.Add("@FdpVolumeHeaderId", filter.TakeRateId, DbType.Int32);
                   
                    var results = conn.Query<TakeRateSummary>("dbo.Fdp_TakeRateHeader_Get", para, commandType: CommandType.StoredProcedure);
                    var takeRateDocumentHeaders = results as IList<TakeRateSummary> ?? results.ToList();
                    if (takeRateDocumentHeaders.Any())
                    {
                        retVal = takeRateDocumentHeaders.First();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }
        public TakeRateSummary FdpTakeRateDataClone(TakeRateFilter filter)
        {
            TakeRateSummary retVal = new EmptyTakeRateSummary();

            using (var conn = DbHelper.GetDBConnection())
            {
                using (var tran = conn.BeginTransaction())
                {
                    try
                    {
                        var para = DynamicParameters.FromCDSId(CurrentCDSID);
                        para.Add("@SourceFdpVolumeHeaderId", filter.TakeRateId, DbType.Int32);
                        para.Add("@DestinationDocumentId", filter.DocumentId, DbType.Int32);
                        para.Add("@Comment", filter.Comment.Trim(), DbType.String);

                        var results = conn.Query<TakeRateSummary>("dbo.Fdp_TakeRateData_Clone", 
                            transaction: tran, 
                            param: para,
                            commandType: CommandType.StoredProcedure);
                        if (results != null && results.Any())
                        {
                            retVal = results.First();
                        }
                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex);
                        throw;
                    }
                }
            }
            return retVal;
        }
 private void InitialiseMembers()
 {
     TakeRate = new EmptyTakeRateSummary();
     TakeRates = new PagedResults<TakeRateSummary>();
     Statuses = Enumerable.Empty<TakeRateStatus>();
     CurrentTakeRateDataItem = new EmptyTakeRateDataItem();
     CurrentAction = TakeRateDataItemAction.NotSet;
     IdentifierPrefix = "Page";
     Document = new EmptyTakeRateDocument();
     MarketReviewStatus = MarketReviewStatus.NotSet;
 }
 public FdpOxoDoc()
 {
     Header = new EmptyTakeRateSummary();
     Document = new EmptyOxoDocument();
 }
 public FdpOxoDoc()
 {
     Header   = new EmptyTakeRateSummary();
     Document = new EmptyOxoDocument();
 }