private void btnSet_Click(object sender, EventArgs e) { IPAddress ip; int iport = 0; if (cmbServerIP.Text == "") { MessageBox.Show("请选择或者填写服务IP!"); cmbServerIP.Focus(); return; } if (txtServerPort.Text == "") { MessageBox.Show("请填写服务端口号!"); txtServerPort.Focus(); return; } //回传接收IP if (!IPAddress.TryParse(cmbServerIP.Text.Trim(), out ip)) { MessageBox.Show("服务IP为非IP类型,请重新输入!", "错误"); cmbServerIP.Focus(); return; } if (!int.TryParse(txtServerPort.Text.Trim(), out iport) || iport < 0 || iport > 65536) { MessageBox.Show("服务端口应是介于0至65536间的数值,请重新输入!", "错误"); txtServerPort.Focus(); return; } ini.WriteValue("INFOSET", "ServerPort", txtServerPort.Text); ini.WriteValue("INFOSET", "ServerIP", cmbServerIP.Text); }
private void button1_Click(object sender, EventArgs e) { if (txtServer.Text.Trim() == "") { MessageBox.Show("服务器不能为空,请输入!", "提示"); txtServer.Focus(); return; } ; if (txtDb.Text.Trim() == "") { MessageBox.Show("数据库不能为空,请输入!", "提示"); txtDb.Focus(); return; } ; if (txtDbuser.Text.Trim() == "") { MessageBox.Show("数据库用户名不能为空,请输入!", "提示"); txtDbuser.Focus(); return; } ; //写INI文件 IniFiles ini = new IniFiles(@Application.StartupPath + "\\Config.ini"); ini.WriteValue("Database", "ServerName", txtServer.Text.Trim()); ini.WriteValue("Database", "DataBase", txtDb.Text.Trim()); ini.WriteValue("Database", "LogID", txtDbuser.Text.Trim()); }
private void btnSet_Click(object sender, EventArgs e) { ini.WriteValue("CMDCOM", "COM", comboPortName.Text); ini.WriteValue("CMDCOM", "BaudRate", comboBaudrate.Text); ini.WriteValue("CMDCOM", "DataBits", txt_DataBits.Text); ini.WriteValue("CMDCOM", "Parity", cob_Parity.Text); ini.WriteValue("CMDCOM", "StopBits", cob_StopBits.Text); ini.WriteValue("AudioCOM", "COM", comSndPortName.Text); ini.WriteValue("AudioCOM", "BaudRate", comSndBaudrate.Text); ini.WriteValue("AudioCOM", "DataBits", txt_SndDataBits.Text); ini.WriteValue("AudioCOM", "Parity", cob_SndParity.Text); ini.WriteValue("AudioCOM", "StopBits", cob_SndStopBits.Text); }
private void btnSetFolder_Click(object sender, EventArgs e) { if (txtRevTar.Text == "") { MessageBox.Show("请选择接收Tar包文件夹路径!"); return; } if (txtTarBuild.Text == "") { MessageBox.Show("请选择Tar包生成文件夹路径!"); return; } if (txtUnTar.Text == "") { MessageBox.Show("请选择解压Tar包文件夹路径!"); return; } if (txtXMLBuild.Text == "") { MessageBox.Show("请选择生成XML存放文件夹路径!"); return; } if (txtBeUnTar.Text == "") { MessageBox.Show("请选择同步反馈解压Tar包文件夹路径!"); return; } if (txtBeBuildXML.Text == "") { MessageBox.Show("请选择同步反馈生成XML文件夹路径!"); return; } if (txtMedia.Text == "") { MessageBox.Show("请选择音频存放文件夹路径!"); return; } inis.WriteValue("FolderSet", "RevTarFolder", txtRevTar.Text); inis.WriteValue("FolderSet", "UnTarFolder", txtUnTar.Text); inis.WriteValue("FolderSet", "SndTarFolder", txtTarBuild.Text); inis.WriteValue("FolderSet", "XmlBuildFolder", txtXMLBuild.Text); inis.WriteValue("FolderSet", "BeUnTarFolder", txtBeUnTar.Text); inis.WriteValue("FolderSet", "BeXmlFileMakeFolder", txtBeBuildXML.Text); inis.WriteValue("FolderSet", "AudioFileFolder", txtMedia.Text); }
private void btnSet_Click(object sender, EventArgs e) { inis.WriteValue("INFOSET", "SourceID", txtSourceID.Text); inis.WriteValue("INFOSET", "SourceName", txtSourceName.Text); inis.WriteValue("INFOSET", "SourceType", txtSourceType.Text); }
private void btnSet_Click(object sender, EventArgs e) { // inis.WriteValue("INFOSET", "YXURL", txtYXPlat.Text); inis.WriteValue("INFOSET", "BJURL", txtZJPlat.Text); }
private void btnLogin_Click(object sender, EventArgs e) { if (txtCode.Text.Trim() == "") { MessageBox.Show("用户编码不能为空,请输入!", "提示"); txtCode.Focus(); return; } ; if (txtUser.Text.Trim() == "") { MessageBox.Show("用户名称不能为空,请输入!", "提示"); txtUser.Focus(); return; } ; if (txtPass.Text.Trim() == "") { MessageBox.Show("用户密码不能为空,请输入!", "提示"); txtPass.Focus(); return; } ; dbAccess dA = new dbAccess(); dA.conn.ConnectionString = GetConnectString(); try { if (dA.OpenConn()) { if (dA.loginJudge(txtCode.Text.Trim(), txtUser.Text.Trim(), txtPass.Text.Trim(), dA) != 1) { MessageBox.Show("登录失败,请重新检查用户编码、用户姓名、登录密码!!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCode.Focus(); return; } } else { MessageBox.Show("数据库连接失败,请检查连接设置!", "提示"); return; } bool flag = Convert.ToBoolean(Ini.ReadValue("LOGIN", "LandingCompletion")); if (!flag) { Ini.WriteValue("LOGIN", "LandingCompletion", "true"); } mainForm sMain = new mainForm(); mainForm.dba = dA; sMain.Show(); this.Hide(); } catch (Exception e1) { MessageBox.Show(e1.Message + "\r\n请重新设置数据库连接!", "错误"); return; } finally { if (dA.ConnState == ConnectionState.Open) { dA.CloseConn(); } dA = null; } }