Exemplo n.º 1
0
        private void BT_ok_Click(object sender, EventArgs e)
        {
            if (TB_Code.Text.Trim() == "")
            {
                MessageBox.Show("输入不能为空!");
                return;
            }

            string[] data = TB_Code.Text.Trim().Split('.');
            if (data.Length != 4)
            {
                MessageBox.Show("输入位数不正确!");
                return;
            }
            if (Type == 1)
            {
                TxtData.XMLConfigure.IpAddress = TB_Code.Text.Trim();
            }

            else
            {
                TxtData.XMLConfigure.SlaveIpAddress = TB_Code.Text.Trim();
            }


            if (!db.EditIp(TxtData.XMLConfigure.IpAddress, TxtData.XMLConfigure.SlaveIpAddress))
            {
                MessageBox.Show("数据库出错");
                return;
            }

            this.Close();
        }
Exemplo n.º 2
0
        private void BT_ok_Click(object sender, EventArgs e)
        {
            if (TB_Code.Text.Trim() == "")
            {
                MessageBox.Show("输入不能为空!");
                return;
            }
            switch (Type)
            {
            case 1:
            {
                string[] data = TB_Code.Text.Trim().Split('.');
                if (data.Length != 4)
                {
                    MessageBox.Show("输入位数不正确!");
                    return;
                }
                TxtData.XMLConfigure.IpAddress = TB_Code.Text.Trim();
                break;
            }

            case 2:
            {
                if (TB_Code.Text.Trim().Length != 6)
                {
                    MessageBox.Show("输入位数不等于6!");
                    return;
                }

                //2014.08.08
                //修改加密方式

                int Ind = TxtData.XMLConfigure.RegCode.ToUpper().IndexOf(TB_Code.Text.Trim().ToUpper());
                if (Ind < 0 || Ind % 6 != 0)
                {
                    MessageBox.Show("输入不正确!");
                    return;
                }

                TxtData.XMLConfigure.RestrictCode = TB_Code.Text.Trim();
                break;
            }
            }

            if (!db.EditIp(TxtData.XMLConfigure.IpAddress, TxtData.XMLConfigure.RestrictCode))
            {
                MessageBox.Show("数据库出错");
                return;
            }
            if (Type == 2)
            {
                // TxtData.XMLConfigure.RestrictCode=
                PublicFunc.ReadXMLConfigure();
            }

            this.Close();
        }