private static string ReadCard() { string strCardCode = ""; string strFolder = Path.Combine(Application.StartupPath, "CardReader"); string strReaderFile = Path.Combine(strFolder, strReadCardKey + ".ini"); if (File.Exists(strReaderFile)) { IniClass iniClass = new IniClass(strReaderFile); strCardCode = iniClass.ReadValue("Reader", "Card"); } return(strCardCode); }
private void 检查更新ToolStripMenuItem_Click(object sender, EventArgs e) { try { var iniPath = System.Configuration.ConfigurationManager.ConnectionStrings["WUPDATE"].ConnectionString; if (string.IsNullOrEmpty(iniPath)) { iniPath = "Update.ini"; } var filePath = System.IO.Path.Combine(Application.StartupPath, iniPath); IniClass ini = new IniClass(filePath); Ztop.Todo.WindowsClient.WindowsClientUpdate.ServiceSoapClient one = new WindowsClientUpdate.ServiceSoapClient("ServiceSoap", "http://10.22.102.3:8060/Service.asmx"); string clientVersion = ini.IniReadValue("update", "version");//客户端版本 string serviceVersion = one.GetVersion(); //string serviceVersion = service.GetVersion();//服务端版本 if (clientVersion != serviceVersion) { DialogResult dialogResult = MessageBox.Show("有新版本,是否更新?", "升级", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dialogResult == DialogResult.OK) { Stop(); this.Close(); _loginForm.Close(); //Application.Exit(); //Application.ExitThread(); var updateExe = System.Configuration.ConfigurationManager.ConnectionStrings["UPDATEEXE"].ConnectionString; if (string.IsNullOrEmpty(updateExe)) { updateExe = "Ztop.Todo.Update.exe"; } Process.Start(updateExe); } else { return; } } else { MessageBox.Show("已更新至最新版本!"); } }catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void OK_Click(object sender, EventArgs e) { if (this.RadioButton1.Checked == true) { //连接Access数据库 //成功则返回false if (PubClass.mDatabaseClass.mConn.State != ConnectionState.Open) { //MessageBox.Show(mDatabaseClass.ErrorInfo); MessageBox.Show("Access数据库连接失败!"); return; } else { this.DialogResult = System.Windows.Forms.DialogResult.OK; } //access,将数据库信息写入到配置文件ipSet.ini中 PubClass.MDatabaseType = "2"; string[] arytemp = { "0", "0", "0", "0", "2" }; IniClass.AddDbInfo(arytemp); //mDatabaseClass.Dispose(); this.Close(); return; } try { if (string.IsNullOrEmpty(this.TxtDBIp.Text)) { MessageBox.Show("数据库的IP地址不能为空"); return; } if (string.IsNullOrEmpty(this.TxtDBName.Text)) { MessageBox.Show("数据库的名称不能为空"); return; } if (string.IsNullOrEmpty(this.TxtUserName.Text)) { MessageBox.Show("数据库的用户名称不能为空"); return; } //If Me.txtPwd.Text = "" Then // MsgBox("数据库的用户密码不能为空", , gProjectName) // Return //End If //5个公共变量前4 PubClass.SqlDbAddress = this.TxtDBIp.Text.Trim(); PubClass.SqlDbName = this.TxtDBName.Text.Trim(); PubClass.SqlDbUserName = TxtUserName.Text.Trim(); PubClass.SqlDbPwd = TxtPwd.Text.Trim(); //成功则返回false if (PubClass.mDatabaseClass.ConnectSql(PubClass.SqlDbAddress, PubClass.SqlDbName, PubClass.SqlDbUserName, PubClass.SqlDbPwd) == true) { MessageBox.Show("请重新确认系统的配置信息或检查网络连接是否畅通"); return; } else { this.DialogResult = System.Windows.Forms.DialogResult.OK; } //sqlserver,将数据库信息写入到配置文件ipSet.ini中 //5个公共变量后1 PubClass.MDatabaseType = "1"; string[] arytemp = { PubClass.SqlDbAddress, PubClass.SqlDbName, PubClass.SqlDbUserName, PubClass.SqlDbPwd, "1" }; IniClass.AddDbInfo(arytemp); //mDatabaseClass.Dispose(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); //mDatabaseClass.Dispose(); } }