Пример #1
0
        private void lbMenuItems_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (lbMenuItems.GetItemText(lbMenuItems.SelectedItem).Equals("Stock Count"))
            {
                Common.appSession.sPreferedMethod = "Scan";
                frm_StockList frm_StockList = new frm_StockList();
                frm_StockList.Show();

            }

            if (lbMenuItems.GetItemText(lbMenuItems.SelectedItem).Equals("Manual Stock Count"))
            {
                Common.appSession.sPreferedMethod = "Manual";
                frm_ManualSerialCode frm_ManualSerialCode = new frm_ManualSerialCode();
                frm_ManualSerialCode.Show();
            }

            if (lbMenuItems.GetItemText(lbMenuItems.SelectedItem).Equals("Synchronise"))
            {
                Cursor.Current = Cursors.WaitCursor;
                Cursor tmpCursor = Cursor.Current;

                SQLite.SendInventoryCount();

                Cursor.Current = Cursors.Default;

                Cursor.Current = Cursors.WaitCursor;

                SQLite.GetStockMasterData();
                SQLite.GetServerAreas();
                SQLite.GetServerWareHouses();
                SQLite.GetServerVersion();

                Cursor.Current = Cursors.Default;
            }
        }
        private void menuItem4_Click(object sender, EventArgs e)
        {
            //Save
            var result = MessageBox.Show("Confirm that you counted " + txtQty.Text + " bags of " + cboSerial.Text + " in " + cboWarehouse.Text + "?", "Confirm Count", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (txtQty.Text.Length > 0 && cboWarehouse.Text.Length > 0)
            {
                if (Common.IsNumeric(txtQty.Text))
                {
                    if (result == DialogResult.Yes)
                    {
                        SQLite.InsertInventoryCount(DateTime.Now, Common.appSession.sUserIpk, cboSerial.Text, cboWarehouse.Text, Convert.ToInt32(txtQty.Text), Common.countSession.sSerialCode, lblBatchCode.Text, txtWeight.Text, lblStation.Text, 1);
                        SQLite.InsertMasterStockItem(Common.appSession.sArea, Common.countSession.sCurrentWarehouse, Common.countSession.sSerialCode, lblStation.Text, Common.countSession.sBatchCode);

                        this.Close();
                        if (Common.appSession.sPreferedMethod.Equals("Scan"))
                        {
                            frm_StockList frm_StockList = new frm_StockList();
                            frm_StockList.Show();
                        }
                        else
                        {
                            frm_ManualSerialCode frm_ManualSerialCode = new frm_ManualSerialCode();
                            frm_ManualSerialCode.Show();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Please ensure the quantity of bags is numeric.", "Non Numeric Quantity", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                }
            }
            else if (cboSerial.Text.Length == 0 && txtQty.Text.Length == 0)
                MessageBox.Show("Please capture the relevant information.", "Missing Detail", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);

            
        }
        private void frm_StockConfirmation_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
            {
                
                // Enter
                if (cboSerial.Text.Length > 0 && cboWarehouse.Text.Length > 0)
                {
                    if (Common.IsNumeric(txtQty.Text))
                    {
                        var result = MessageBox.Show("Confirm that you counted " + txtQty.Text + " bags of " + cboSerial.Text + " in " + cboWarehouse.Text + "?", "Confirm Count", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                        if (result == DialogResult.Yes)
                        {
                            SQLite.InsertInventoryCount(DateTime.Now, Common.appSession.sUserIpk, cboStockCode.Text, cboWarehouse.Text, Convert.ToInt16(txtQty.Text), cboSerial.Text, Common.countSession.sBatchCode, lblWeight.Text, lblStation.Text, 1);
                            this.Close();
                            frm_StockList frm_StockList = new frm_StockList();
                            frm_StockList.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please ensure the quantity of bags is numeric.", "Non Numeric Quantity", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                    }
                }
                else if (cboSerial.Text.Length == 0 && cboSerial.Text.Length == 0)
                {
                    MessageBox.Show("Please indicate the serial number.", "Missing Serial Number", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
                }

                
            }

            if ((e.KeyCode == System.Windows.Forms.Keys.Escape))
            {
                // Escape
                this.Close();
            }

        }