private void btnRemoteDB_Click(object sender, EventArgs e) { if (txtRemoteDb.Text == "") { MessageBox.Show("远程数据库连接为空"); return; } string filePath = System.Windows.Forms.Application.StartupPath + "\\setting.ini"; if (!File.Exists(filePath)) { File.Create(filePath); } CIniFile myFile = new CIniFile(filePath); try { myFile.IniWriteValue("Setting", "RemoteDataBase", txtRemoteDb.Text); if (setRemoteDbEvent != null) { setRemoteDbEvent(this.txtRemoteDb.Text); } MessageBox.Show("保存成功"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSaveSetting_Click(object sender, EventArgs e) { if (txtDM.Text == "") { MessageBox.Show("店码为空"); return; } string filePath = System.Windows.Forms.Application.StartupPath + "\\setting.ini"; if (!File.Exists(filePath)) { File.Create(filePath); } CIniFile myFile = new CIniFile(filePath); try { myFile.IniWriteValue("Setting", "DianMa", txtDM.Text); if (setSettingEvent != null) { setSettingEvent(txtDM.Text); } MessageBox.Show("保存成功"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnGenerate_Click(object sender, EventArgs e) { ExportXmlIn(txtXmlPath.Text, txtComCode.Text, txtComName.Text, date_k_in.Value); ExportXmlOut(txtXmlPath.Text, txtComCode.Text, txtComName.Text, date_k_in.Value); ExportXmlInit(txtXmlPath.Text, txtComCode.Text, txtComName.Text, date_k_in.Value); MessageBox.Show("已生成药监上传数据。"); btnGenerate.Enabled = false; //生成了当天的数据,则存入设置文件 string filePath = System.Windows.Forms.Application.StartupPath + "\\setting.ini"; if (!File.Exists(filePath)) { File.Create(filePath); } CIniFile myFile = new CIniFile(filePath); try { myFile.IniWriteValue("Setting", "ZxUploadXmlDateIn", this.date_k_in.Value.ToShortDateString()); myFile.IniWriteValue("Setting", "ZxUploadXmlDateOut", this.date_k_out.Value.ToShortDateString()); myFile.IniWriteValue("Setting", "ZxUploadXmlDateInit", this.date_k_init.Value.ToShortDateString()); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FormMain_Load(object sender, EventArgs e) { string txtFilePath = System.Windows.Forms.Application.StartupPath + "\\setting.ini"; if (System.IO.File.Exists(txtFilePath)) { CIniFile myFile = new CIniFile(txtFilePath); this.dm = myFile.IniReadValue("Setting", "DianMa"); } tlabelDm.Text = "店码:" + dm; }
private void btnSavePath_Click(object sender, EventArgs e) { if (this.txt_zx_xml_path.Text == "") { MessageBox.Show("路径为空"); return; } if (this.txt_zx_xml_comcode.Text == "") { MessageBox.Show("单位编号为空"); return; } if (this.txt_zx_xml_comname.Text == "") { MessageBox.Show("单位名称为空"); return; } string filePath = System.Windows.Forms.Application.StartupPath + "\\setting.ini"; if (!File.Exists(filePath)) { File.Create(filePath); } CIniFile myFile = new CIniFile(filePath); try { myFile.IniWriteValue("Setting", "ZxUploadXmlPath", this.txt_zx_xml_path.Text); myFile.IniWriteValue("Setting", "ZxUploadXmlComcode", this.txt_zx_xml_comcode.Text); myFile.IniWriteValue("Setting", "ZxUploadXmlComname", this.txt_zx_xml_comname.Text); if (setZxXmlPathEvent != null) { setZxXmlPathEvent(this.txt_zx_xml_path.Text); } MessageBox.Show("保存成功"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }