/// <summary> /// To get the Client's Monthly Target Data /// </summary> /// <param name="clientCode"></param> /// <param name="year"></param> /// <returns></returns> public List <ClientTargetViewModel> GetClientTargetData(string clientCode, int year) { List <ClientTargetViewModel> clientTargetViewModels = new List <ClientTargetViewModel>(); try { List <ClientTargetModel> clientTargetModels = _clientDataRepository.GetClientTargetData(clientCode, year); foreach (ClientTargetModel ctm in clientTargetModels) { ClientTargetViewModel ctvm = new ClientTargetViewModel(); ctvm.AnnualCharges = ctm.AnnualCharges; ctvm.CalendarYear = ctm.CalendarYear; ctvm.GrossCollectionRate = ctm.GrossCollectionRate; ctvm.Month = ctm.Month.MonthName; ctvm.Charges = ctm.Charges; ctvm.Payments = ctm.Payments; ctvm.Revenue = ctm.Revenue; ctvm.IsManualEntry = ctm.IsManualEntry; clientTargetViewModels.Add(ctvm); } return(clientTargetViewModels); } catch (Exception ex) { _logger.Log(ex, LogLevel.Error, ex.Message); return(null); } }
public MonthWiseClientTargetViewModel SaveClientTargetData([FromBody] ClientTargetViewModel clientTargetData) { MonthWiseClientTargetViewModel monthWiseClientTargetViewModel = new MonthWiseClientTargetViewModel(); if (clientTargetData != null) { List <ClientTargetViewModel> clientTargetViewModels = _clientDataBusiness.SaveClientTargetData(clientTargetData); if (clientTargetViewModels != null && clientTargetViewModels.Count > 0) { monthWiseClientTargetViewModel.clientTargetViewModels = clientTargetViewModels; monthWiseClientTargetViewModel.ValidationViewModel = new ValidationViewModel(); monthWiseClientTargetViewModel.ValidationViewModel.Success = true; } else { monthWiseClientTargetViewModel.clientTargetViewModels = null; monthWiseClientTargetViewModel.ValidationViewModel = new ValidationViewModel(); monthWiseClientTargetViewModel.ValidationViewModel.Success = false; } return(monthWiseClientTargetViewModel); } else { monthWiseClientTargetViewModel.clientTargetViewModels = null; monthWiseClientTargetViewModel.ValidationViewModel = new ValidationViewModel(); monthWiseClientTargetViewModel.ValidationViewModel.Success = false; return(monthWiseClientTargetViewModel); } }
/// <summary> /// To Save the Clients Monthly Target Data through the Quick mode /// </summary> /// <param name="clientTargetData"></param> /// <returns></returns> public List <ClientTargetViewModel> SaveClientTargetData(ClientTargetViewModel clientTargetData) { try { List <ClientTargetModel> clientTargetModels = _clientDataRepository.SaveClientTargetData(new ClientTargetModel() { Client = new ClientDetails() { ClientCode = clientTargetData.ClientCode }, ClientId = 0, CalendarYear = clientTargetData.CalendarYear, AnnualCharges = clientTargetData.AnnualCharges, GrossCollectionRate = clientTargetData.GrossCollectionRate, }); List <ClientTargetViewModel> clientTargetViewModels = new List <ClientTargetViewModel>(); foreach (ClientTargetModel ctm in clientTargetModels) { ClientTargetViewModel ctvm = new ClientTargetViewModel(); ctvm.AnnualCharges = ctm.AnnualCharges; ctvm.CalendarYear = ctm.CalendarYear; ctvm.GrossCollectionRate = ctm.GrossCollectionRate; ctvm.Month = ctm.Month.MonthName; ctvm.Charges = ctm.Charges; ctvm.Payments = ctm.Payments; ctvm.Revenue = ctm.Revenue; clientTargetViewModels.Add(ctvm); } return(clientTargetViewModels); } catch (Exception ex) { _logger.Log(ex, LogLevel.Error, ex.Message); return(null); } }