Ejemplo n.º 1
0
        private DispatchAllocationViewModel GetAllocationModelForClose(DispatchAllocation dispatch)
        {
            //TODO:Make sure if includeproperties are loaded correctly
            var fdp              = _fdpService.FindById(dispatch.FDPID);
            var donorid          = (dispatch.DonorID) ?? -1;
            var donor            = (donorid != -1) ? _donorService.FindById(donorid).Name : "-";
            var monthid          = (dispatch.Month) ?? -1;
            var month            = (monthid != -1) ? Cats.Helpers.RequestHelper.MonthName(monthid) : "-";
            var projectcodeId    = (dispatch.ProjectCodeID) ?? -1;
            var projectcodevalue = (projectcodeId != -1) ? _projectCodeService.GetProjectCodeValueByProjectCodeId(projectcodeId) : "-";
            DispatchAllocationViewModel model = new DispatchAllocationViewModel(fdp);

            model.Amount                      = dispatch.Amount;
            model.BidRefNo                    = dispatch.BidRefNo;
            model.FDPName                     = dispatch.FDP.Name;
            model.RequisitionNo               = dispatch.RequisitionNo;
            model.Round                       = dispatch.Round;
            model.Year                        = dispatch.Year;
            model.ProgramName                 = dispatch.Program.Name;
            model.CommodityName               = dispatch.Commodity.Name;
            model.MonthName                   = month;
            model.ShippingInstruction         = dispatch.ShippingInstruction;
            model.ProjectCodeValue            = projectcodevalue;
            model.RemainingQuantityInQuintals = dispatch.RemainingQuantityInQuintals;
            return(model);
        }