示例#1
0
    // Use this for initialization
    void Start()
    {
        anchor = GameObject.Find("Anchor");
        GenerateCells();

        GenerateNewColorItem();

        callback = UpdateInventory;
        APIInventory.LoadInventory(callback);
    }
示例#2
0
    private static void DropToCellLogic()
    {
        Debug.Log("DropToCellLogic");
        Debug.Log("draggingItem.isNew " + draggingItem.isNew);
        Debug.Log("dropCell.isDeleteCell " + dropCell.isDeleteCell);

        if (draggingItem.isNew)
        {
            if (dropCell.isDeleteCell)
            {
                MoveItemBack();
            }
            else if (dropCell.isOccupied)
            {
                Debug.Log("Can't exchange position with new ");
            }
            else
            {
                ColorInventoryItem item = new ColorInventoryItem();
                item.color = GetColorFromSliders();
                item.x     = dropCell.x;
                item.y     = dropCell.y;
                APIInventory.AddElement(item, callback);
                Destroy(draggingItem.gameObject);
                GenerateNewColorItem();
            }
        }
        else
        {
            if (dropCell.isDeleteCell)
            {
                APIInventory.DeleteElement(draggingItem.cell.x, draggingItem.cell.y, callback);
                Destroy(draggingItem.gameObject);
            }
            else
            {
                APIInventory.ChangePosition(draggingItem.cell.x, draggingItem.cell.y, dropCell.x, dropCell.y, callback);
                Destroy(draggingItem.gameObject);
            }
        }
    }
        public ActionResult Index()
        {
            string             token      = GetToken();
            UserModel          um         = GetUser();
            string             error      = "";
            List <POCountList> reportData = new List <POCountList>();

            List <AdjustmentModel> adjs = new List <AdjustmentModel>();

            List <SupplierModel> sups = new List <SupplierModel>();

            List <PurchaseOrderModel> pos = new List <PurchaseOrderModel>();

            List <InventoryDetailModel> invs = new List <InventoryDetailModel>();

            try
            {
                reportData = APIReport.GetPoForfiveMonths(token, out error);

                // adjustment count
                adjs = APIAdjustment.GetAdjustmentByStatus(token, ConAdjustment.Active.PENDING, out error);
                if (adjs == null)
                {
                    ViewBag.AdjCount = 0;
                }
                else
                {
                    ViewBag.AdjCount = adjs.Where(x => x.Raisedto == um.Userid).Count();
                }

                sups = APISupplier.GetSupplierByStatus(ConSupplier.Active.ACTIVE, token, out error);
                if (sups == null)
                {
                    ViewBag.SupCount = 0;
                }
                else
                {
                    ViewBag.SupCount = sups.Count;
                }

                // purchase order count
                pos = APIPurchaseOrder.GetPurchaseOrderByStatus(ConPurchaseOrder.Status.PENDING, token, out error);
                if (pos == null)
                {
                    ViewBag.POCount = 0;
                }
                else
                {
                    ViewBag.POCount = pos.Count;
                }

                // item restock level needed count
                invs = APIInventory.GetAllInventoryDetails(token, out error);
                if (invs == null)
                {
                    ViewBag.RestockCount = 0;
                }
                else
                {
                    ViewBag.RestockCount = invs.Where(x => x.RecommendedOrderQty > 0).Count();
                }
                return(View("Index", reportData));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", "Error", new { error = ex.Message }));
            }
        }