Ejemplo n.º 1
0
        public JsonResult InsertRequestPR(List <CentralModel> ItemRequestList, CentralModel central)
        {
            var Data = dBCentral.InsertRequestPRDB(central, Session["UserID"].ToString());

            if (Data != 0)
            {
                var DataGrid = dBCentral.InsertItemRequestPRDB(ItemRequestList, central);
            }

            return(Json(Data));
        }
Ejemplo n.º 2
0
        public JsonResult UpdateItemRequestForReceiving(List <CentralModel> ItemRequestList, CentralModel central)
        {
            int i = 0;
            int totalCollected = 0;

            foreach (CentralModel centrallist in ItemRequestList)
            {
                if (centrallist.ItemReceived != null)
                {
                    totalCollected = int.Parse(centrallist.ItemReceived ?? "0") + int.Parse(centrallist.collected);

                    if (totalCollected > int.Parse(centrallist.qty))
                    {
                        return(Json("Qty_Limit"));
                    }
                    else
                    {
                        if (centrallist.ItemReceived == "0")
                        {
                            return(Json("NotAllowed"));
                        }
                    }

                    i++;
                }
            }

            if (i == 0)
            {
                return(Json(0));
            }

            var Data2 = dBCentral.UpdateItemRequestReceivedDB(ItemRequestList, central, Session["UserID"].ToString());

            if (Data2 == 0)
            {
                return(Json("system_error"));
            }
            else
            {
                return(Json(Data2));
            }
        }