public List <FeeObject> GetNotificationFees(out CalculationFactor calculationFactor) { try { return(_feeManager.GetNotificationFees(out calculationFactor) ?? new List <FeeObject>()); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } }
public List <FeeObject> GetNotificationFees(out CalculationFactor calculationFactor) { try { using (var db = new ImportPermitEntities()) { const int appStage = (int)AppStage.Notification; var fees = db.Fees.Where(k => k.ImportStageId == appStage).Include("FeeType").Include("ImportStage").ToList().ToList(); if (!fees.Any()) { calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } var appSettings = db.ImportSettings.ToList(); if (!appSettings.Any()) { calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } var feeSum = 0.0; const int expend = (int)FeeTypeEnum.Expeditionary; var expenditionaryFee = 0.0; fees.ForEach(m => { if (m.FeeTypeId != expend) { feeSum += m.Amount; } else { expenditionaryFee = m.Amount; } }); var appSettingObject = ModelMapper.Map <ImportSetting, ImportSettingObject>(appSettings[0]); if (appSettingObject != null && appSettingObject.Id < 1) { calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } calculationFactor = new CalculationFactor { Fees = feeSum, ExpenditionaryFee = expenditionaryFee, ImportSettingObject = appSettingObject }; var objList = new List <FeeObject>(); fees.ForEach(app => { var feeObject = ModelMapper.Map <Fee, FeeObject>(app); if (feeObject != null && feeObject.FeeId > 0) { feeObject.FeeTypeName = app.FeeType.Name; feeObject.ImportStageName = app.ImportStage.Name; objList.Add(feeObject); } }); return(!objList.Any() ? new List <FeeObject>() : objList); } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } }
public List <FeeObject> GetAppliationStageFees(out CalculationFactor calculationFactor) { try { using (var db = new ImportPermitEntities()) { const int appStage = (int)AppStage.Application; var fees = db.Fees.Where(k => k.ImportStageId == appStage).Include("FeeType").Include("ImportStage").ToList(); if (!fees.Any()) { calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } var priceVolumeThresholds = db.ImportSettings.ToList(); if (!priceVolumeThresholds.Any()) { calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } var priceVolumeThreshold = priceVolumeThresholds[0].PriceVolumeThreshold; const int statutoryFeeId = (int)FeeTypeEnum.Statutory_Fee; var statutoryFee = fees.Find(m => m.FeeTypeId == statutoryFeeId); if (statutoryFee == null || statutoryFee.FeeId < 1) { calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } calculationFactor = new CalculationFactor { Fees = statutoryFee.Amount, PriceVolumeThreshold = priceVolumeThreshold }; var objList = new List <FeeObject>(); fees.ForEach(app => { var feeObject = ModelMapper.Map <Fee, FeeObject>(app); if (feeObject != null && feeObject.FeeId > 0) { if (feeObject.FeeTypeId == statutoryFeeId) { feeObject.FeeTypeName = app.FeeType.Name; } else { feeObject.FeeTypeName = app.FeeType.Name; } feeObject.ImportStageName = app.ImportStage.Name; objList.Add(feeObject); } }); return(!objList.Any() ? new List <FeeObject>() : objList); } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); calculationFactor = new CalculationFactor(); return(new List <FeeObject>()); } }