Esempio n. 1
0
        private void BlockMachine(Kv kv)
        {
            String machineKey;

            BlockMachineE blockMachineE = (BlockMachineE)kv.GetInt32("BlockMachineE");

            switch (blockMachineE)
            {
            case BlockMachineE.Initialized:
                machineKey = WmiHelper.GetMachineKey();
                if (!String.IsNullOrEmpty(machineKey))
                {
                    MessageForm.Show(this, MsgE.InfoBlockMachine);
                    kv.Set("MachineKey", machineKey);
                    kv.Set("BlockMachine", (int)BlockMachineE.Done);
                }
                SocketClient.SendAvResponse(kv);
                break;

            case BlockMachineE.Done:
                machineKey = kv.Get("MachineKey");
                if (!String.IsNullOrEmpty(machineKey))
                {
                    MessageForm.Show(this, MsgE.ErrorBlockMachine);
                }
                break;
            }
        }
Esempio n. 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtBanReason.Text != string.Empty)
            {
                KvUserData.UserID        = this.userID;
                KvUserData.BanStartDate  = dtpStartDate.Text;
                KvUserData.BanStartTime  = dtpStartTime.Text;
                KvUserData.BanReason     = txtBanReason.Text;
                KvUserData.BanMachineKey = WmiHelper.GetMachineKey();
                if (rbDate.Checked)
                {
                    KvUserData.BanEndDate = dtpEndDate.Text;
                    KvUserData.BanEndTime = dtpEndTime.Text;
                }
                else if (rbForever.Checked)
                {
                    KvUserData.BanEndDate = "";
                    KvUserData.BanEndTime = "";
                }
                else if (rbDuration.Checked)
                {
                    KvUserData.BanEndDate = dtServerTime.ToString();
                    if (cbDays.Text.Trim().Length > 0)
                    {
                        dtServerTime          = dtServerTime.AddDays(Convert.ToInt32(cbDays.Text));
                        KvUserData.BanEndTime = dtServerTime.ToString();
                    }
                    if (cbHours.Text.Trim().Length > 0)
                    {
                        dtServerTime          = dtServerTime.AddHours(Convert.ToInt32(cbHours.Text));
                        KvUserData.BanEndTime = dtServerTime.ToString();
                    }
                }

                DialogResult dr = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmBanUser, userName);
                if (dr == DialogResult.Yes)
                {
                    DataSet ds = SocketClient.BanUser(KvUserData);
                }
                SubmitClicked(dr);
            }
            else
            {
                MessageForm.Error(this.ParentForm, MsgE.ErrorBanReason);
            }
        }