private void ConfirmBtn_Click(object sender, EventArgs e) { //向我的文档写入配置文件 string strPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); ClsThisAddinConfig clsConfig = new ClsThisAddinConfig(strPath); //写入父节点CurrentAccount中配置名为AccountingFirmName的值,作为事务所名称 clsConfig.WriteConfig("CurrentAccount", "AccountingFirmName", AccountingFirmName.Text.ToString()); //写入父节点CurrentAccount中配置名为Auditee的值,作为被审计单位名称 clsConfig.WriteConfig("CurrentAccount", "Auditee", Auditee.Text.ToString()); //写入父节点CurrentAccount中读取配置名为ReplyAddress的值,作为回函地址 clsConfig.WriteConfig("CurrentAccount", "ReplyAddress", ReplyAddress.Text.ToString()); //从父节点CurrentAccount中读取配置名为PostalCode的值,作为回函邮编 clsConfig.WriteConfig("CurrentAccount", "PostalCode", PostalCode.Text.ToString()); //从父节点CurrentAccount中读取配置名为AuditDeadline的值,作为审计截止日,默认为2019年12月31日 clsConfig.WriteConfig("CurrentAccount", "AuditDeadline", AuditDeadline.Text.ToString()); //从父节点CurrentAccount中读取配置名为Contact的值,作为联系人名称,默认为空 clsConfig.WriteConfig("CurrentAccount", "Contact", Contact.Text.ToString()); //从父节点CurrentAccount中读取配置名为Telephone的值,作为联系电话,默认为空 clsConfig.WriteConfig("CurrentAccount", "Telephone", Telephone.Text.ToString()); //从父节点CurrentAccount中读取配置名为Department的值,作为部门,默认为空 clsConfig.WriteConfig("CurrentAccount", "Department", Department.Text.ToString()); //从父节点CurrentAccount中读取配置名为Leading的值,作为部门负责人,默认为空 clsConfig.WriteConfig("CurrentAccount", "Leading", Leading.Text.ToString()); //关闭窗体 this.Close(); }
private void BAJSettingForm_Load(object sender, EventArgs e) { //从我的文档读取配置 string strPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); ClsThisAddinConfig clsConfig = new ClsThisAddinConfig(strPath); //从父节点BalanceAndJournal中读取配置名SubjectCodeButton1为的值,该值为布尔值。默认为true SubjectCodeButton1.Checked = clsConfig.ReadConfig <bool>("BalanceAndJournal", "SubjectCodeButton1", true); //从父节点BalanceAndJournal中读取配置名SubjectCodeButton2为的值,该值为布尔值。默认为false SubjectCodeButton2.Checked = clsConfig.ReadConfig <bool>("BalanceAndJournal", "SubjectCodeButton2", false); //从父节点BalanceAndJournal中读取配置名SubjectCodeSign为的值,该值为字符串。默认为"." SubjectCodeSign.Text = clsConfig.ReadConfig <string>("BalanceAndJournal", "SubjectCodeSign", "."); //从父节点BalanceAndJournal中读取配置名SubjectCodeButton3为的值,该值为布尔值。默认为false SubjectCodeButton3.Checked = clsConfig.ReadConfig <bool>("BalanceAndJournal", "SubjectCodeButton3", false); //从父节点BalanceAndJournal中读取配置名SubjectCodeLength1为的值,该值为字符串。默认为"4" SubjectCodeLength1.Text = clsConfig.ReadConfig <string>("BalanceAndJournal", "SubjectCodeLength1", "4"); //从父节点BalanceAndJournal中读取配置名SubjectCodeLength2为的值,该值为字符串。默认为"2" SubjectCodeLength2.Text = clsConfig.ReadConfig <string>("BalanceAndJournal", "SubjectCodeLength2", "2"); //从父节点BalanceAndJournal中读取配置名SubjectCodeLength3为的值,该值为字符串。默认为"2" SubjectCodeLength3.Text = clsConfig.ReadConfig <string>("BalanceAndJournal", "SubjectCodeLength3", "2"); //从父节点BalanceAndJournal中读取配置名SubjectCodeLength4为的值,该值为字符串。默认为"2" SubjectCodeLength4.Text = clsConfig.ReadConfig <string>("BalanceAndJournal", "SubjectCodeLength4", "2"); //从父节点BalanceAndJournal中读取配置名SubjectCodeLength5为的值,该值为字符串。默认为"2" SubjectCodeLength5.Text = clsConfig.ReadConfig <string>("BalanceAndJournal", "SubjectCodeLength5", "2"); //从父节点BalanceAndJournal中读取配置名SubjectCodeLength6为的值,该值为字符串。默认为"2" SubjectCodeLength6.Text = clsConfig.ReadConfig <string>("BalanceAndJournal", "SubjectCodeLength6", "2"); //从父节点BalanceAndJournal中读取配置名为OrderCheckBox的值,该值为布尔值。默认为true OrderCheckBox.Checked = clsConfig.ReadConfig <bool>("BalanceAndJournal", "OrderCheckBox", false); }
private void CASetting_Load(object sender, EventArgs e) { //从我的文档读取配置 string strPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); ClsThisAddinConfig clsConfig = new ClsThisAddinConfig(strPath); //从父节点CurrentAccount中读取配置名为AccountingFirmName的值,作为事务所名称,默认为致同 AccountingFirmName.Text = clsConfig.ReadConfig <string>("CurrentAccount", "AccountingFirmName", "致同会计师事务所(特殊普通合伙)"); //从父节点CurrentAccount中读取配置名为Auditee的值,作为被审计单位名称,默认为空 Auditee.Text = clsConfig.ReadConfig <string>("CurrentAccount", "Auditee", "请修改"); //从父节点CurrentAccount中读取配置名为ReplyAddress的值,作为回函地址,默认为致同 ReplyAddress.Text = clsConfig.ReadConfig <string>("CurrentAccount", "ReplyAddress", "北京建外大街22号赛特大厦十五层"); //从父节点CurrentAccount中读取配置名为PostalCode的值,作为回函邮编,默认为致同 PostalCode.Text = clsConfig.ReadConfig <string>("CurrentAccount", "PostalCode", "100004"); //从父节点CurrentAccount中读取配置名为AuditDeadline的值,作为审计截止日,默认为2019年12月31日 AuditDeadline.Text = clsConfig.ReadConfig <string>("CurrentAccount", "AuditDeadline", "2019年12月31日"); //从父节点CurrentAccount中读取配置名为Contact的值,作为联系人名称,默认为空 Contact.Text = clsConfig.ReadConfig <string>("CurrentAccount", "Contact", "请修改"); //从父节点CurrentAccount中读取配置名为Telephone的值,作为联系电话,默认为空 Telephone.Text = clsConfig.ReadConfig <string>("CurrentAccount", "Telephone", "请修改"); //从父节点CurrentAccount中读取配置名为Department的值,作为部门,默认为空 Department.Text = clsConfig.ReadConfig <string>("CurrentAccount", "Department", "请修改"); //从父节点CurrentAccount中读取配置名为Leading的值,作为部门负责人,默认为空 Leading.Text = clsConfig.ReadConfig <string>("CurrentAccount", "Leading", "请修改"); }
private void RoundSetting_Load(object sender, EventArgs e) { //从我的文档读取配置 string strPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); ClsThisAddinConfig clsConfig = new ClsThisAddinConfig(strPath); //从父节点Round中读取配置名为Num的值,默认为2 numericUpDown1.Value = clsConfig.ReadConfig <int>("Round", "Num", 2); }
private void ConfirmBtn_Click(object sender, EventArgs e) { //向我的文档写入配置文件 string strPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); ClsThisAddinConfig clsConfig = new ClsThisAddinConfig(strPath); //写入父节点Round中配置名Num(自动识别编码)的配置项 clsConfig.WriteConfig("Round", "Num", numericUpDown1.Value.ToString()); //关闭窗体 this.Close(); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { //获取当前版本信息 string Nverinfo; string Overinfo; try { Nverinfo = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(); } catch { Nverinfo = "版本号获取异常"; } //获取保存的版本信息 //从我的文档读取配置 string strPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); ClsThisAddinConfig clsConfig = new ClsThisAddinConfig(strPath); //从父节点VerInfo中读取配置名为VerNum的值,该值为字符串。默认为"0.0.0.0" Overinfo = clsConfig.ReadConfig <string>("VerInfo", "VerNum", "0.0.0.0"); //判断版本是否相等 if (Nverinfo == Overinfo) { return; } //写入父节点VerInfo中配置名VerNum的配置项 clsConfig.WriteConfig("VerInfo", "VerNum", Nverinfo); string WebPath = @"https://www.yuque.com/hewish/hertz_excel/nup9wy"; try { string msg = "HertZ插件已更新,当前版本为" + Nverinfo + Environment.NewLine; MessageBox.Show(msg + "后续更新提示改为直接打开“更新说明”网页"); System.Diagnostics.Process.Start(WebPath); } catch { MessageBox.Show("打开更新说明网址失败!" + Environment.NewLine + WebPath); } }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { //获取当前版本信息 string Nverinfo; string Overinfo; try { Nverinfo = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(); } catch { Nverinfo = "版本号获取异常"; } //获取保存的版本信息 //从我的文档读取配置 string strPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); ClsThisAddinConfig clsConfig = new ClsThisAddinConfig(strPath); //从父节点VerInfo中读取配置名为VerNum的值,该值为字符串。默认为"0.0.0.0" Overinfo = clsConfig.ReadConfig <string>("VerInfo", "VerNum", "0.0.0.0"); //判断版本是否相等 if (Nverinfo == Overinfo) { return; } //写入父节点VerInfo中配置名VerNum的配置项 clsConfig.WriteConfig("VerInfo", "VerNum", Nverinfo); string msg = "HertZ已更新,当前版本为" + Nverinfo + Environment.NewLine; MessageBox.Show(msg + "更新内容:修复了几个bug;" + Environment.NewLine + "修改了使用说明文档链接"); }
private void ConfirmBtn_Click(object sender, EventArgs e) { bool IsValid = true; //检查输入字节的长度 if (SubjectCodeSign.Text.Length != 1 || SubjectCodeLength1.Text.Length != 1 || SubjectCodeLength2.Text.Length != 1 || SubjectCodeLength3.Text.Length != 1 || SubjectCodeLength4.Text.Length != 1 || SubjectCodeLength5.Text.Length != 1 || SubjectCodeLength6.Text.Length != 1) { MessageBox.Show("编码长度输入有误,目前仅支持1-9,请检查并重新输入"); IsValid = false; } //检查输入编码是否为数字 try { long n = long.Parse(SubjectCodeLength1.Text); n = long.Parse(SubjectCodeLength2.Text); n = long.Parse(SubjectCodeLength3.Text); n = long.Parse(SubjectCodeLength4.Text); n = long.Parse(SubjectCodeLength5.Text); n = long.Parse(SubjectCodeLength6.Text); } catch (Exception) { MessageBox.Show("科目编码长度应为数字,请检查并重新输入"); IsValid = false; } //如果输入信息无误,保存并关闭窗体 if (IsValid) { //向我的文档写入配置文件 string strPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments); ClsThisAddinConfig clsConfig = new ClsThisAddinConfig(strPath); //写入父节点BalanceAndJournal中配置名SubjectCodeButton1(自动识别编码)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeButton1", SubjectCodeButton1.Checked.ToString()); //写入父节点BalanceAndJournal中配置名SubjectCodeButton2(使用分隔符拆分)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeButton2", SubjectCodeButton2.Checked.ToString()); //写入父节点BalanceAndJournal中配置名SubjectCodeSign(分隔符号)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeSign", SubjectCodeSign.Text); //写入父节点BalanceAndJournal中配置名SubjectCodeButton3(按编码长度拆分)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeButton3", SubjectCodeButton3.Checked.ToString()); //写入父节点BalanceAndJournal中配置名SubjectCodeLength1(一级科目长度)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeLength1", SubjectCodeLength1.Text); //写入父节点BalanceAndJournal中配置名SubjectCodeLength2(二级科目长度)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeLength2", SubjectCodeLength2.Text); //写入父节点BalanceAndJournal中配置名SubjectCodeLength3(三级科目长度)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeLength3", SubjectCodeLength3.Text); //写入父节点BalanceAndJournal中配置名SubjectCodeLength4(四级科目长度)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeLength4", SubjectCodeLength4.Text); //写入父节点BalanceAndJournal中配置名SubjectCodeLength5(五级科目长度)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeLength5", SubjectCodeLength5.Text); //写入父节点BalanceAndJournal中配置名SubjectCodeLength6(六级科目长度)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "SubjectCodeLength6", SubjectCodeLength6.Text); //写入父节点BalanceAndJournal中配置名OrderCheckBox(按科目编码排序)的配置项 clsConfig.WriteConfig("BalanceAndJournal", "OrderCheckBox", OrderCheckBox.Checked.ToString()); //关闭窗体 this.Close(); } }