示例#1
0
        private void btnDeposit_Click(object sender, System.EventArgs e)
        {
            InputNumForm inputNumForm = new InputNumForm(this);

            inputNumForm.ShowDialog();
            if (inputNumForm.Data != null)
            {
                string res = connection.SendMessage('4', inputNumForm.Data.ToString());
                lblBalance.Text = "Deposit was successfull";//res;
                conditionDictionary["Check tape"] -= 0.1;
                conditionDictionary["Cartridge"]  -= 0.02;
            }
        }
示例#2
0
        private void buttonStaff_Click(object sender, System.EventArgs e)
        {
            (sender as Button).Enabled = false;
            btnBalance.Enabled         = false;
            btnDeposit.Enabled         = false;
            btnWithdraw.Enabled        = false;
            btnStaff.Enabled           = false;
            btnEndWork.Enabled         = false;
            btn_Card.Enabled           = false;

            InputNumForm inputNumForm = new InputNumForm(this);

            inputNumForm.ShowDialog();

            if (inputNumForm.Data != "")
            {
                connection = new Connection();
                var passwordText = inputNumForm.Data;

                var res = connection.SendMessage('7', inputNumForm.Data.ToString());
                if (res == "Exist")
                {
                    ServiceStaffForm serviceStaffForm = new ServiceStaffForm(this.conditionDictionary);
                    serviceStaffForm.ShowDialog();
                    connection.SendMessage('6', "Check tape:" + Convert.ToString(conditionDictionary["Check tape"])
                                           + "|Cartridge:" + Convert.ToString(conditionDictionary["Cartridge"]));
                    connection.SendMessage('0', "");
                    connection.EndConnection();
                }
                else
                {
                    connection.SendMessage('0', "");
                    connection.EndConnection();
                    lblError.Text = res;
                }
            }

            (sender as Button).Enabled = true;
            btn_Card.Enabled           = true;
        }