Beispiel #1
0
        private void btnYes_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtPWD.Text.Trim()))
            {
                MessageBoxHelper.Show("证书口令不能为空,请输入!", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtPWD.Focus();
            }
            else if (this.txtPWD.Text.Trim().Length < 8)
            {
                MessageBoxHelper.Show("证书口令长度不足8位,请重新输入!", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtPWD.Focus();
            }
            else if (this.txtPWD.Text.Trim().Length > 0x10)
            {
                MessageBoxHelper.Show("证书口令长度不能大于16位,请重新输入!", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                TaxCard card = TaxCardFactory.CreateTaxCard();
                card.OpenDevice(this.txtPWD.Text.Trim(), "");
                int retCode = card.RetCode;
                switch (retCode)
                {
                case 0:
                    this.string_0     = this.txtPWD.Text.Trim();
                    base.DialogResult = DialogResult.OK;
                    base.Close();
                    return;

                case 0x3810002a:
                    MessageBoxHelper.Show("证书口令长度不足8个字符", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    this.txtPWD.Focus();
                    return;

                case 0x381063c0:
                    MessageBoxHelper.Show("证书密码被锁死,请解锁后重新登录", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    base.DialogResult = DialogResult.Cancel;
                    base.Close();
                    return;
                }
                if ((retCode < 0x381063cf) && (retCode > 0x381063c0))
                {
                    this.lblMsg.Text = (retCode - 0x381063c0).ToString();
                    this.txtPWD.Text = "";
                    this.txtPWD.Focus();
                }
                else
                {
                    MessageManager.ShowMsgBox("CA_" + retCode.ToString());
                    base.DialogResult = DialogResult.Cancel;
                    base.Close();
                }
            }
        }
Beispiel #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if ((this.aisinoMTX_0.Text.Trim().Length >= 8) && (this.aisinoMTX_0.Text.Trim().Length <= 0x10))
     {
         if ((this.aisinoMTX_2.Text.Trim().Length >= 8) && (this.aisinoMTX_2.Text.Trim().Length <= 0x10))
         {
             if ((this.aisinoMTX_1.Text.Trim().Length >= 8) && (this.aisinoMTX_1.Text.Trim().Length <= 0x10))
             {
                 if (this.aisinoMTX_2.Text.Trim() != this.aisinoMTX_1.Text.Trim())
                 {
                     MessageBoxHelper.Show("两次输入证书口令必须一致!", "修改证书口令", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 }
                 else if (this.aisinoMTX_2.Text.Trim() == "88888888")
                 {
                     MessageBoxHelper.Show("不能修改为初始证书口令!", "修改证书口令", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 }
                 else
                 {
                     Regex regex = new Regex(@"[\u4e00-\u9fa5]+");
                     if (regex.Match(this.aisinoMTX_2.Text.Trim()).Length != 0)
                     {
                         MessageBoxHelper.Show("证书口令中不能有汉字!", "修改证书口令", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                     }
                     else
                     {
                         TaxCard card = TaxCardFactory.CreateTaxCard();
                         if (this.bool_1)
                         {
                             card.OpenDevice(this.aisinoMTX_0.Text.Trim(), "");
                             if (card.RetCode != 0)
                             {
                                 if ((card.RetCode < 0x381063cf) && (card.RetCode > 0x381063c0))
                                 {
                                     MessageBoxHelper.Show("证书原口令错误,再有" + ((card.RetCode - 0x381063c0)).ToString() + "次后将锁死,请谨慎操作", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                     return;
                                 }
                                 if (card.RetCode == 0x381063c0)
                                 {
                                     MessageBoxHelper.Show("证书口令被锁死,请解锁后重新登录", "证书登录错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                     return;
                                 }
                                 MessageManager.ShowMsgBox("CA_" + card.RetCode.ToString());
                                 return;
                             }
                         }
                         int num3 = card.SignChangePassword(this.aisinoMTX_0.Text.Trim(), this.aisinoMTX_2.Text.Trim());
                         if (num3 != 0)
                         {
                             MessageManager.ShowMsgBox("CA_" + num3.ToString());
                         }
                         else
                         {
                             this.string_1     = this.aisinoMTX_2.Text.Trim();
                             base.DialogResult = DialogResult.OK;
                             base.Close();
                             if (this.bool_1)
                             {
                                 card.CloseDevice();
                             }
                         }
                     }
                 }
             }
             else
             {
                 MessageBoxHelper.Show("证书口令必须是8-16位,请重新输入!", "修改证书口令", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 this.aisinoMTX_1.Focus();
             }
         }
         else
         {
             MessageBoxHelper.Show("证书口令必须是8-16位,请重新输入!", "修改证书口令", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             this.aisinoMTX_2.Focus();
         }
     }
     else
     {
         MessageBoxHelper.Show("证书口令必须是8-16位,请重新输入!", "修改证书口令", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         this.aisinoMTX_0.Focus();
     }
 }