Пример #1
0
        private async void btn_Lock_click(object sender, EventArgs e)
        {
            Station currentstation = (await _repo.GetAssignedStation(user.EmployeeID));

            if (noSelections())
            {
                return;
            }

            if (this.Lockedstate == false)
            {
                //Tillstånd i Locked state

                lstbxOpen.Enabled = false;                 //Nu AV-aktiveras ProductOrders-listan
                int pickedPO = getOpenListChoiceInt();


                //Hårdkodat??
                await _repo.SetLockOnkPOAsync(pickedPO, currentstation.StationID);

                btn_Finished.Enabled   = true;
                btn_Refresh.Enabled    = false;
                btn_Refresh.Text       = "";
                btn_Finished.BackColor = Color.Lime;
                btn_Lock.Text          = "Press to UNLOCK";
                btn_Finished.Text      = "FINISHED";
                btn_Lock.BackColor     = Color.Yellow;
                this.Lockedstate       = true;
                btnUnlocker.Enabled    = true;
                btnUnlocker.Text       = "UNLOCK STATION - RELEASE PO";
            }

            else
            {
                //STATES FÖR UPPLÅST LÄGE


                //btnUnlocker.PerformClick();

                btn_Finished.Enabled   = false;
                btn_Refresh.Enabled    = true;
                btn_Refresh.Text       = "Refresh";
                btn_Finished.BackColor = Color.Gray;
                btn_Lock.Text          = "Lock";
                btn_Finished.Text      = "";
                btn_Lock.BackColor     = Color.Beige;
                this.Lockedstate       = false;
                lstbxOpen.Enabled      = true;

                //disables the "first unlocker button"
                btnUnlocker.Enabled = false;


                //Unlocks the PO
                ProductOrder PO = await _repo.GetLockedPOByStation(currentstation.StationID);

                await _repo.SetLockOnkPOAsync(PO.ProductOrderID, 0);
            }

            ProductOrder lockedPOs = await _repo.GetLockedPOByStation(currentstation.StationID);

            if (lockedPOs is ProductOrder)
            {
                Product lockedProduct = await _repo.GetProductInfoFromPO(lockedPOs.ProductOrderID);

                lblLockedPO.Text = "Order:" + lockedPOs.OrderID + ", PO:" + lockedPOs.ProductOrderID + ", " + lockedProduct.ProductName;
            }
            else
            {
                lblLockedPO.Text = "";
            }
            //RefreshLockStatus(currentstation);
        }