Ejemplo n.º 1
0
        public ActionResult UpdateWarehouseSelectionAjax([DataSourceRequest] DataSourceRequest request, WarehouseProgramViewModel WarehouseAllocation)
        {
            if (WarehouseAllocation != null && ModelState.IsValid)
            {
                List<TransportBidPlanDetail> inDb = _transportBidPlanDetailService.FindBy(w =>
                                w.BidPlanID == WarehouseAllocation.BidPlanID
                                && w.DestinationID == WarehouseAllocation.WoredaID
                                && w.SourceID == WarehouseAllocation.WarehouseID
                                );
                TransportBidPlanDetail psnp = new TransportBidPlanDetail
                    {
                        BidPlanID = WarehouseAllocation.BidPlanID,
                        SourceID = WarehouseAllocation.WarehouseID,
                        DestinationID = WarehouseAllocation.WoredaID,
                        Quantity = WarehouseAllocation.PSNP,
                        ProgramID=2
                    };
                UpdateBidPlanDetail(psnp);

                TransportBidPlanDetail relief = new TransportBidPlanDetail
                {
                    BidPlanID = WarehouseAllocation.BidPlanID,
                    SourceID = WarehouseAllocation.WarehouseID,
                    DestinationID = WarehouseAllocation.WoredaID,
                    Quantity = WarehouseAllocation.Relief,
                    ProgramID = 1
                };
                UpdateBidPlanDetail(relief);
            }

            return Json(new[] { WarehouseAllocation }.ToDataSourceResult(request, ModelState));
        }
Ejemplo n.º 2
0
        public ActionResult CreateWarehouseSelectionAjax([DataSourceRequest] DataSourceRequest request,WarehouseProgramViewModel warehouseAllocation,
                                                                                                      int transportBidPlanID, int selectedWoreda = 0)
        {
            if (warehouseAllocation!=null && ModelState.IsValid)
            {
                var reliefDetail = new TransportBidPlanDetail()
                {
                    BidPlanID = transportBidPlanID,
                    DestinationID = selectedWoreda,
                    SourceID = warehouseAllocation.WarehouseID,
                    ProgramID = 1,
                    Quantity = _transportBidPlanDetailService.GetHrdCommodityAmount(selectedWoreda),
                };
                UpdateBidPlanDetail(reliefDetail);
                var psnpDetail = new TransportBidPlanDetail()
                {
                    BidPlanID = transportBidPlanID,
                    DestinationID = selectedWoreda,
                    SourceID = warehouseAllocation.WarehouseID,
                    ProgramID = 2,
                    Quantity = _transportBidPlanDetailService.GetWoredaGroupedPsnpAmount(selectedWoreda),
                };
                UpdateBidPlanDetail(psnpDetail);
            }

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