Example #1
0
        public JsonResult ReadCheques()
        {
            var cheques = _transporterChequeService.GetAllTransporterCheque().Where(t => t.Status < 4).Select(c =>
            {
                var transporterChequeDetail = c.TransporterChequeDetails.FirstOrDefault();
                return(transporterChequeDetail != null ? new
                {
                    chequeNo = c.CheckNo,
                    Transporter = transporterChequeDetail.TransporterPaymentRequest.TransportOrder.Transporter.Name,
                    c.Amount,
                    PreparedBy = c.UserProfile.FirstName + " " + c.UserProfile.LastName,

                    ApprovedBy = c.AppovedBy != null ? _userProfileService.FindById((int)c.AppovedBy).FirstName + " " +
                                 _userProfileService.FindById((int)c.AppovedBy).LastName : "",
                    DateApproved = c.AppovedDate.Date.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()),
                    transporterChequeId = c.TransporterChequeId,
                    State = c.Status,
                    Status = c.BusinessProcess.CurrentState.BaseStateTemplate.Name,
                    ButtonStatus = c.BusinessProcess.CurrentState.BaseStateTemplate.Name,
                    c.BankName
                } : null);
            });

            return(Json(cheques, JsonRequestBehavior.AllowGet));
        }
Example #2
0
 public static IEnumerable <NeedAssessmentPlanViewModel> GetNeedAssessmentPlanInfo(IEnumerable <Plan> plans, List <WorkflowStatus> statuses)
 {
     return(plans.Select(viewModel =>
     {
         var firstOrDefault = viewModel.NeedAssessments.FirstOrDefault();
         return firstOrDefault != null ? new NeedAssessmentPlanViewModel
         {
             AssessmentName = viewModel.PlanName,
             PlanID = viewModel.PlanID,
             NeedAssessmentID = firstOrDefault.NeedAID,
             //NeedAssessmentID = viewModel.NeedAssessments.First().NeedAID,
             StartDate = viewModel.StartDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()),
             EndDate = viewModel.EndDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()),
             StatuID = viewModel.Status,
             Status = statuses.Find(t => t.WorkflowID == (int)WORKFLOW.Plan && t.StatusID == viewModel.Status).Description
                      //Year = (int) viewModel.NeedAssessments.First().Year
         }: new NeedAssessmentPlanViewModel
         {
             AssessmentName = viewModel.PlanName,
             PlanID = viewModel.PlanID,
             //NeedAssessmentID = viewModel.NeedAssessments.First().NeedAID,
             StartDate = viewModel.StartDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()),
             EndDate = viewModel.EndDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()),
             StatuID = viewModel.Status,
             //Status = statuses.Find(t => t.WorkflowID == (int)WORKFLOW.Plan && t.StatusID == viewModel.Status).Description
             //Year = (int) viewModel.NeedAssessments.First().Year
         };
     }));
 }
Example #3
0
        public static List <RequisitionViewModel> ReturnRequisitionGroupByReuisitionNo(List <ReliefRequisition> requisition)
        {
            if (requisition == null)
            {
                return(new List <RequisitionViewModel>());
            }


            var result = (from req in requisition
                          select new RequisitionViewModel()
            {
                RequisitionNo = req.RequisitionNo,
                RequisitionId = req.RequisitionID,
                RequisitionDate = DateTime.Parse(req.RequestedDate.ToString()),
                Commodity = req.Commodity.Name,
                BenficiaryNo = req.ReliefRequisitionDetails.Sum(a => a.BenficiaryNo),
                Amount = req.ReliefRequisitionDetails.Sum(a => a.Amount).ToPreferedWeightUnit(),
                Status = int.Parse(req.Status.ToString()),
                Region = req.AdminUnit.Name,
                RegionId = (int)req.RegionID,
                Zone = req.AdminUnit1.Name,
                Program = req.Program.Name,
                ProgramId = req.ProgramID,
                Round = req.Round,
                Month = req.Month,
                MonthName = RequestHelper.GetMonthList().Find(t => t.Id == req.Month).Name,
                AmountAllocated = req.ReliefRequisitionDetails.Sum(a => a.Amount),
                StrRequisitionDate = req.RequestedDate.Value.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference())
            });

            var r = new List <RequisitionViewModel>();

            foreach (var req in requisition)
            {
                var n = new RequisitionViewModel();
                n.RequisitionNo   = req.RequisitionNo;
                n.RequisitionId   = req.RequisitionID;
                n.RequisitionDate = DateTime.Parse(req.RequestedDate.ToString());
                n.Commodity       = req.Commodity.Name;
                n.BenficiaryNo    = req.ReliefRequisitionDetails.Sum(a => a.BenficiaryNo);
                var m = req.ReliefRequisitionDetails.Sum(a => a.Amount);
                n.Amount             = m.ToPreferedWeightUnit();
                n.Status             = int.Parse(req.Status.ToString());
                n.Region             = req.AdminUnit.Name;
                n.RegionId           = (int)req.RegionID;
                n.Zone               = req.AdminUnit1.Name;
                n.Program            = req.Program.Name;
                n.Round              = req.Round;
                n.Month              = req.Month;
                n.MonthName          = RequestHelper.GetMonthList().Find(t => t.Id == req.Month).Name;
                n.AmountAllocated    = req.ReliefRequisitionDetails.Sum(a => a.Amount);
                n.StrRequisitionDate = req.RequestedDate.Value.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference());

                r.Add(n);
            }

            return(r.ToList());
        }
Example #4
0
 private List <DispatchViewModel> SetDatePreference(List <DispatchViewModel> dispatches)
 {
     foreach (var dispatchViewModel in dispatches)
     {
         dispatchViewModel.CreatedDatePref =
             dispatchViewModel.CreatedDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference());
         dispatchViewModel.DispatchDatePref =
             dispatchViewModel.DispatchDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference());
     }
     return(dispatches);
 }
Example #5
0
        public static IEnumerable <NotificationViewModel> ReturnNotificationViewModel(List <Notification> notification)
        {
            return(notification.Select(notify => new NotificationViewModel()
            {
                NotificationId = notify.NotificationId,
                Text = notify.Text,

                Url = notify.Url,
                RecordId = notify.RecordId,
                IsRead = notify.IsRead,
                TypeOfNotification = notify.TypeOfNotification,
                StrCreatedDate = notify.CreatedDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()),
                Role = notify.Id
            }));
        }
Example #6
0
 public static IEnumerable <NeedAssessmentHeaderViewModel> ReturnViewModelApproved(List <NeedAssessment> needAssessmentMain)
 {
     return(needAssessmentMain.Select(need => new NeedAssessmentHeaderViewModel()
     {
         NeedAID = need.NeedAID,
         Region = need.Region,
         RegionName = need.AdminUnit.Name,
         Season = need.Season1.SeasonID,
         SeasonName = need.Season1.Name,
         NeedADate = (DateTime)need.NeedADate,
         NeedAApproved = need.NeedAApproved,
         NeedACreaterName = need.UserProfile1.UserName,
         NeedACreatedBy = need.NeddACreatedBy,
         TypeOfNeedAssessment = need.TypeOfNeedAssessment1.TypeOfNeedAssessmentID,
         Date = need.NeedADate.Value.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference())
     }));
 }
Example #7
0
 public static IEnumerable <DonationHeaderViewModel> GetReceiptHeaderPlanViewModel(List <DonationPlanHeader> donationPlanHeaders)
 {
     return(donationPlanHeaders.Select(plan => new DonationHeaderViewModel()
     {
         DonationHeaderPlanID = plan.DonationHeaderPlanID,
         SINumber = plan.ShippingInstruction.Value,
         ProgramName = plan.Program.Name,
         ProgramID = plan.ProgramID,
         DonorName = plan.Donor.Name,
         DonorID = plan.DonorID,
         DateOfAllocation = plan.AllocationDate.Value.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()),
         CommodityName = plan.Commodity.Name,
         CommodityID = plan.CommodityID,
         IsCommited = plan.IsCommited,
         // Vessel = plan.Vessel,
         StrETA = plan.ETA.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference()),
         // ReferenceNo = plan.ReferenceNo,
         //strEnteredBy  = plan.UserProfile.FirstName + " " + plan.UserProfile.LastName
     }));
 }
Example #8
0
        private IEnumerable <ContributionDetailViewModel> GetContributionDetail(Contribution contribution)
        {
            var contributionDetail = contribution.ContributionDetails;

            return(from contributionDetails in contributionDetail
                   select new ContributionDetailViewModel()
            {
                ContributionDetailID = contributionDetails.ContributionDetailID,
                ContributionID = contributionDetails.ContributionID,
                CurrencyID = contributionDetails.CurrencyID,
                Currency = contributionDetails.Currency.Name,
                PledgeReferenceNumber = contributionDetails.PledgeReferenceNo,
                PledgeDate = contributionDetails.PledgeDate,
                Amount = contributionDetails.Amount,
                PledgeDatePref = contributionDetails.PledgeDate.ToCTSPreferedDateFormat(UserAccountHelper.UserCalendarPreference())
            });
        }
Example #9
0
        private DeliveryViewModel EditGoodsReceivingNote(Delivery delivery)
        {
            if (delivery == null)
            {
                return(new DeliveryViewModel());
            }
            var dispatch = _dispatchService.Get(t => t.DispatchID == delivery.DispatchID, null,
                                                "FDP,FDP.AdminUnit,FDP.AdminUnit.AdminUnit2,FDP.AdminUnit.AdminUnit2.AdminUnit2,Transporter,Hub").FirstOrDefault();

            var deliveryViewModel = new DeliveryViewModel();

            deliveryViewModel.DispatchID           = delivery.DispatchID;
            deliveryViewModel.DeliveryDate         = delivery.DeliveryDate;
            deliveryViewModel.DocumentReceivedBy   = delivery.DocumentReceivedBy;
            deliveryViewModel.DocumentReceivedDate = delivery.DocumentReceivedDate;
            deliveryViewModel.DeliveryID           = delivery.DeliveryID;
            //distribution.DonorID=dispatch.
            deliveryViewModel.DriverName       = delivery.DriverName;
            deliveryViewModel.FDPID            = delivery.FDPID;
            deliveryViewModel.HubID            = delivery.HubID;
            deliveryViewModel.TransporterID    = delivery.TransporterID;
            deliveryViewModel.InvoiceNo        = delivery.InvoiceNo;
            deliveryViewModel.PlateNoPrimary   = delivery.PlateNoPrimary;
            deliveryViewModel.PlateNoTrailler  = delivery.PlateNoTrailler;
            deliveryViewModel.RequisitionNo    = delivery.RequisitionNo;
            deliveryViewModel.FDP              = dispatch.FDP.Name;
            deliveryViewModel.Region           = dispatch.FDP.AdminUnit.AdminUnit2.AdminUnit2.Name;
            deliveryViewModel.Zone             = dispatch.FDP.AdminUnit.AdminUnit2.Name;
            deliveryViewModel.Woreda           = dispatch.FDP.AdminUnit.Name;
            deliveryViewModel.Hub              = dispatch.Hub.Name;
            deliveryViewModel.DeliveryBy       = delivery.DeliveryBy;
            deliveryViewModel.ReceivedBy       = delivery.ReceivedBy;
            deliveryViewModel.ReceivedDate     = delivery.ReceivedDate;
            deliveryViewModel.ReceivingNumber  = delivery.ReceivingNumber;
            deliveryViewModel.InvoiceNo        = delivery.InvoiceNo;
            deliveryViewModel.WayBillNo        = delivery.WayBillNo;
            deliveryViewModel.RequisitionNo    = delivery.RequisitionNo;
            deliveryViewModel.Transporter      = dispatch.Transporter.Name;
            deliveryViewModel.Status           = delivery.Status;
            deliveryViewModel.ActionTypeRemark = delivery.ActionTypeRemark;
            var pref = UserAccountHelper.UserCalendarPreference();

            deliveryViewModel.DeliveryDatePref = delivery.DeliveryDate.HasValue
                                                         ? delivery.DeliveryDate.Value.ToCTSPreferedDateFormat(pref)
                                                         : "";
            deliveryViewModel.ReceivedDatePref = delivery.ReceivedDate.HasValue
                                                         ? delivery.ReceivedDate.Value.ToCTSPreferedDateFormat(pref)
                                                         : "";
            deliveryViewModel.DocumentReceivedDatePref = delivery.DocumentReceivedDate.HasValue
                                                                 ? delivery.DocumentReceivedDate.Value.
                                                         ToCTSPreferedDateFormat(pref)
                                                                 : "";

            deliveryViewModel.ContainsDiscripancy =
                delivery.DeliveryDetails.Any(t => t.ReceivedQuantity < t.SentQuantity);
            //foreach (var dispatchDetail in dispatch.DispatchDetails)
            //{
            //    var deliveryDetail = new DistributionDetail();
            //    deliveryDetail.DistributionID = distribution.DistributionID;
            //    deliveryDetail.DistributionDetailID = Guid.NewGuid();
            //    deliveryDetail.CommodityID = dispatchDetail.CommodityID;
            //    deliveryDetail.ReceivedQuantity = 0;
            //    deliveryDetail.SentQuantity = dispatchDetail.RequestedQuantityInMT;
            //    deliveryDetail.UnitID = dispatchDetail.UnitID;


            //}
            return(deliveryViewModel);
        }