Esempio n. 1
0
 public static ReliefRequisitionViewModel BindReliefRequisitionViewModel(ReliefRequisition reliefRequisition, List<WorkflowStatus> statuses, string datePref)
 {
     var requisition = new ReliefRequisitionViewModel();
     requisition.ProgramID = reliefRequisition.ProgramID;
     requisition.Program = reliefRequisition.Program.Name;
     requisition.Region = reliefRequisition.AdminUnit.Name;
     requisition.RequisitionNo = reliefRequisition.RequisitionNo;
     requisition.RegionID = reliefRequisition.RegionID;
     requisition.RegionalRequestID = reliefRequisition.RegionalRequestID;
     if (reliefRequisition.RequestedDate.HasValue)
         requisition.RequestedDateEt = reliefRequisition.RequestedDate.Value.ToCTSPreferedDateFormat(datePref);
     //);
     requisition.Round = reliefRequisition.Round;
     requisition.Status = statuses.Find(t => t.WorkflowID == (int)WORKFLOW.RELIEF_REQUISITION && t.StatusID == reliefRequisition.Status.Value).Description;
     requisition.RequestedDate = reliefRequisition.RequestedDate.Value;
     requisition.StatusID = reliefRequisition.Status;
     requisition.RequisitionID = reliefRequisition.RequisitionID;
     requisition.CommodityID = reliefRequisition.CommodityID;
     requisition.ZoneID = reliefRequisition.ZoneID;
     requisition.Zone = reliefRequisition.AdminUnit1.Name;
     requisition.Commodity = reliefRequisition.Commodity.Name;
     requisition.Month = RequestHelper.MonthName(reliefRequisition.Month);
     return requisition;
 }
Esempio n. 2
0
        public static List<ReliefRequisitionViewModel> BindRequisitionViewModel(List<ReliefRequisition> reliefRequisitions)
        {
            var reliefRequisitionViewModels = new List<ReliefRequisitionViewModel>();

            foreach (var reliefRequisition in reliefRequisitions)
            {
                var reliefRequisitionViewModel = new ReliefRequisitionViewModel();
                reliefRequisitionViewModel.RequisitionNo = reliefRequisition.RequisitionNo;
                reliefRequisitionViewModel.RequestedDate = (DateTime)reliefRequisition.RequestedDate;
                reliefRequisitionViewModel.Status = reliefRequisition.Status.ToString();
                reliefRequisitionViewModels.Add(reliefRequisitionViewModel);
            }
            return reliefRequisitionViewModels;
        }
Esempio n. 3
0
        public ActionResult Requisition_Update([DataSourceRequest] DataSourceRequest request, ReliefRequisitionViewModel reliefRequisitionViewModel)
        {
            if (reliefRequisitionViewModel != null && ModelState.IsValid)
            {
                var target = _reliefRequisitionService.FindById(reliefRequisitionViewModel.RequisitionID);
                if (target != null)
                {

                    target.RequisitionNo = reliefRequisitionViewModel.RequisitionNo;

                    _reliefRequisitionService.EditReliefRequisition(target);
                }
            }

            return Json(new[] { reliefRequisitionViewModel }.ToDataSourceResult(request, ModelState));
        }