private UnderBankingDTO Map(tblRecollection tbl)
 {
     var costcentre = _context.tblCostCentre.FirstOrDefault(s => s.Id == tbl.FromCostCentreId);
     var dto = new UnderBankingDTO();
     dto.MasterId = tbl.Id;
     dto.DateCreated = tbl.IM_DateCreated;
     dto.DateLastUpdated = tbl.IM_DateLastUpdated;
     dto.StatusId = tbl.IM_Status;
     dto.Description = tbl.Description;
     dto.Amount = tbl.Amount;
     dto.CostCentreId = tbl.FromCostCentreId;
     var items = tbl.tblRecollectionItem.ToList();
     dto.TotalReceivedAmount = items.Sum(s => s.Amount);
     dto.Items = items.Select(s => new UnderBankingItemDTO{Amount = s.Amount,Id = s.Id,IsConfirmed = s.IsComfirmed, UnderBankingId = s.RecollectionId} ).ToArray();
     dto.CostCentreName = costcentre != null ? costcentre.Name : "";
     return dto;
 }
        private UnderBankingItemSummary MapSummary(tblRecollection s)
        {
            if (s == null) return null;
            var salesman = _ctx.tblCostCentre.FirstOrDefault(n => n.Id == s.CostCentreId);
            var costcentre = _ctx.tblCostCentre.FirstOrDefault(n => n.Id == s.FromCostCentreId);
            var reco = new UnderBankingItemSummary(s.Id)
            {

                CostCentreId = s.FromCostCentreId,
                CostCentreName = costcentre!=null?costcentre.Name:"",
                CostCentreType = costcentre != null ? ((CostCentreType)costcentre.CostCentreType).ToString() : "",
                SalesmanId = s.CostCentreId,
                SalesmanName = salesman != null ? salesman.Name : "",
                Description = s.Description,
                Amount = s.Amount,
                ReceivedAmount = s.tblRecollectionItem.Sum(o => o.Amount),
                ConfirmedAmount = s.tblRecollectionItem.Where(o=>o.IsComfirmed).Sum(o => o.Amount),
                _DateCreated = s.IM_DateCreated,
                _DateLastUpdated = s.IM_DateLastUpdated,
                
            };
            return reco;
        }
Example #3
0
 /// <summary>
 /// Create a new tblRecollection object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="costCentreId">Initial value of the CostCentreId property.</param>
 /// <param name="fromCostCentreId">Initial value of the FromCostCentreId property.</param>
 /// <param name="amount">Initial value of the Amount property.</param>
 /// <param name="isReceived">Initial value of the IsReceived property.</param>
 /// <param name="dateInserted">Initial value of the DateInserted property.</param>
 /// <param name="iM_DateCreated">Initial value of the IM_DateCreated property.</param>
 /// <param name="iM_DateLastUpdated">Initial value of the IM_DateLastUpdated property.</param>
 /// <param name="iM_Status">Initial value of the IM_Status property.</param>
 public static tblRecollection CreatetblRecollection(global::System.Guid id, global::System.Guid costCentreId, global::System.Guid fromCostCentreId, global::System.Decimal amount, global::System.Boolean isReceived, global::System.DateTime dateInserted, global::System.DateTime iM_DateCreated, global::System.DateTime iM_DateLastUpdated, global::System.Int32 iM_Status)
 {
     tblRecollection tblRecollection = new tblRecollection();
     tblRecollection.Id = id;
     tblRecollection.CostCentreId = costCentreId;
     tblRecollection.FromCostCentreId = fromCostCentreId;
     tblRecollection.Amount = amount;
     tblRecollection.IsReceived = isReceived;
     tblRecollection.DateInserted = dateInserted;
     tblRecollection.IM_DateCreated = iM_DateCreated;
     tblRecollection.IM_DateLastUpdated = iM_DateLastUpdated;
     tblRecollection.IM_Status = iM_Status;
     return tblRecollection;
 }
Example #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tblRecollection EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotblRecollection(tblRecollection tblRecollection)
 {
     base.AddObject("tblRecollection", tblRecollection);
 }
 private UnderBankingItem Map(tblRecollection s)
 {
     if (s == null) return null;
     var reco = new UnderBankingItem(s.Id)
                    {
                        
                        FromCostCentreId = s.CostCentreId,
                        Description = s.Description,
                        Amount = s.Amount,
                        _DateCreated = s.IM_DateCreated,
                        _DateLastUpdated = s.IM_DateLastUpdated,
                        TotalReceivedAmount = s.tblRecollectionItem.Sum(o=>o.Amount),
                    };
     return reco;
 }