예제 #1
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            if (CommHelper.IsIPAddress(textBox_IPAddress.Text))
            {
                Config vConfig = new Config();
                vConfig.DBSource   = textBox_IPAddress.Text;
                vConfig.DBName     = textBox_DB_Name.Text;
                vConfig.DBPassword = textBox_DB_Password.Text;
                vConfig.DBPort     = Convert.ToInt32(numericUpDown_DB_Port.Value);
                vConfig.DBUserName = textBox_DB_UserName.Text;

                vConfig.PowerPort      = Convert.ToInt32(numericUpDown_Power_Port.Value);
                vConfig.WatchHousePort = Convert.ToInt32(numericUpDown_WM_Port.Value);

                vConfig.EmployeeUrl = textBox_Emplyee_Address.Text; // string.Format("http://{0}/EmployeeInfo", textBox_Emplyee_Address.Text );
                vConfig.PicUrl      = textBox_Pic_Address.Text;     //string.Format("http://{0}/Photo", textBox_Pic_Address.Text);

                vConfig.Save();
                DialogResult = DialogResult.OK;
                MessageBox.Show("保存成功", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("请输入正确的IP地址", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        bool verifyIPAddress()
        {
            bool vResult = false;

            if (CommHelper.IsIPAddress(textBox_IPAddress.Text))
            {
                vResult = true;
            }
            else
            {
                MessageBox.Show("IP地址输入错误", "信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (CommHelper.IsIPAddress(textBox_SubMask.Text))
            {
                vResult = true;
            }
            else
            {
                MessageBox.Show("子网掩码输入错误", "信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (CommHelper.IsIPAddress(textBox_GateWay.Text))
            {
                vResult = true;
            }
            else
            {
                MessageBox.Show("网关输入错误", "信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (CommHelper.IsIPAddress(textBox_ServerIP.Text))
            {
                vResult = true;
            }
            else
            {
                MessageBox.Show("服务器IP地址输入错误", "信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(vResult);
        }