예제 #1
0
 private void  除记录ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("是否确删除用户:" + sel_uname + " (ID:" + sel_uid.ToString() + ")? 注意,操作不可取消!", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes && sel_uid != -1)
     {
         bool endTry     = false;
         bool hasSucceed = false;
         while (!endTry && !hasSucceed)
         {
             InternetUtilities mInternetUTilities = new InternetUtilities();
             string            responce           = mInternetUTilities.POSTText("action=11&duid=" + sel_uid.ToString() + "&uid=" + MDIParent1.uid.ToString() + "&token=" + MDIParent1.token);
             if (mInternetUTilities.isSucceed(responce))
             {
                 MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 hasSucceed = true;
             }
             else
             {
                 if (MessageBox.Show("操作失败!服务器返回信息:" + mInternetUTilities.msg, "提示", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry)
                 {
                     endTry = true;
                 }
             }
         }
     }
     updateData();
     sel_uid   = -1;
     sel_uname = "";
 }
예제 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Regex macMatch        = new Regex(@"^([0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F])$");
            Regex permissionMatch = new Regex(@"^(((\d,?)+))$");

            if (permissionMatch.Match(txtPermission.Text).Success&& macMatch.Match(txtMAC.Text).Success)
            {
                bool endTry     = false;
                bool hasSucceed = false;
                while (!endTry && !hasSucceed)
                {
                    InternetUtilities mInternetUTilities = new InternetUtilities();
                    string            responce           = mInternetUTilities.POSTText("action=8&uid=" + MDIParent1.uid + "&token=" + MDIParent1.token + "&lkname=" +
                                                                                       txtName.Text + "&mac=" + txtMAC.Text + "&access=" + txtPermission.Text);
                    if (mInternetUTilities.isSucceed(responce))
                    {
                        MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        hasSucceed = true;
                        this.Close();
                    }
                    else
                    {
                        if (MessageBox.Show("操作失败!服务器返回信息:" + mInternetUTilities.msg, "提示", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry)
                        {
                            endTry = true;
                        }
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("输入有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #3
0
파일: AddUser.cs 프로젝트: sunnyden/SMLock
 private void button2_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtGid.Text) && !String.IsNullOrEmpty(txtUname.Text) && !String.IsNullOrEmpty(txtPwd.Text))
     {
         bool endTry     = false;
         bool hasSucceed = false;
         while (!endTry && !hasSucceed)
         {
             InternetUtilities mInternetUTilities = new InternetUtilities();
             string            responce           = mInternetUTilities.POSTText("action=13&uid=" + MDIParent1.uid + "&token=" + MDIParent1.token + "&npwd=" +
                                                                                txtPwd.Text + "&nuname=" + txtUname.Text + "&ngid=" + txtGid.Text);
             if (mInternetUTilities.isSucceed(responce))
             {
                 MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 hasSucceed = true;
                 this.Close();
             }
             else
             {
                 if (MessageBox.Show("操作失败!服务器返回信息:" + mInternetUTilities.msg, "提示", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) != DialogResult.Retry)
                 {
                     endTry = true;
                 }
                 this.Close();
             }
         }
     }
     else
     {
         MessageBox.Show("输入有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }