public IActionResult GetTotalQtyFromRequisitions(List <int> requistionlist)
        {
            List <StationeryRetrievalProduct> srpList = srformservice.CreateSRPListFromRFIdList(requistionlist);

            RequisitionStationaryViewModel rsvm = new RequisitionStationaryViewModel();

            rsvm.srpList = srpList;
            return(PartialView("partial_reqAndwarehouse", rsvm));
        }
Пример #2
0
        /*public IActionResult GetTotalQtyFromRequisitions(List<int> selectedRequisition)
         * {
         *  IDictionary<string, List<int>> dict_reqwarehouseitem = new Dictionary<string, List<int>>();
         *  //List<int> qtycount = new List<int>();
         *  int inventorycount;
         *  foreach (var item in selectedRequisition)
         *  {
         *      List<RequisitionFormsProduct> reqformproduct = srfservice.GetReqFormProducts(item);
         *
         *      foreach (var productitem in reqformproduct)
         *      {
         *          inventorycount = pservice.FindProductQuantityByProductName(productitem.Product.ProductName);
         *          if (dict_reqwarehouseitem.ContainsKey(productitem.Product.ProductName))
         *          {
         *              dict_reqwarehouseitem[productitem.Product.ProductName][0] = dict_reqwarehouseitem[productitem.Product.ProductName][0] + productitem.ProductApproved - productitem.ProductCollectedTotal;
         *          }
         *          else
         *          {
         *              List<int> qtycount = new List<int>();
         *              qtycount.Add(productitem.ProductApproved);
         *              qtycount.Add(inventorycount);
         *              dict_reqwarehouseitem.Add(productitem.Product.ProductName, qtycount);
         *          }
         *      }
         *  }
         *
         *  List<StationeryProductViewModel> spvmlist = new List<StationeryProductViewModel>();
         *
         *  foreach (KeyValuePair<string, List<int>> product in dict_reqwarehouseitem)
         *  {
         *      // do something with entry.Value or entry.Key
         *      StationeryProductViewModel spvm = new StationeryProductViewModel();
         *      spvm.productname = product.Key;
         *      spvm.productcount = product.Value[0];
         *      spvm.warehousecount = product.Value[1];
         *      spvmlist.Add(spvm);
         *  }
         *
         *  //dict_reqwarehouseitem.Keys.Count();
         *  return Ok(spvmlist);
         * }*/

        public IActionResult GetTotalQtyFromRequisitions(List <int> selectedRequisition)
        {
            List <StationeryRetrievalProduct> srpList = srfservice.CreateSRPListFromRFIdList(selectedRequisition);

            RequisitionStationaryViewModel rsvm = new RequisitionStationaryViewModel();

            rsvm.srpList = srpList;
            if (srpList != null)
            {
                return(Ok(srpList));
            }
            else
            {
                return(null);
            }
        }