Beispiel #1
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);
            }
        }