frmReportSysConfig.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. using OTSCommon.Model;
  2. using OTSIncAReportApp;
  3. using OTSIncAReportApp.OTSDataMgrFunction;
  4. using OTSIncAReportApp.OTSMgrInfo;
  5. using OTSIncAReportApp.SysMgrTools;
  6. using System;
  7. using System.Data;
  8. using System.Windows.Forms;
  9. namespace OTSIncAReprotCharts
  10. {
  11. public partial class frmReportSysConfig : Form
  12. {
  13. #region 变量
  14. public ResultDataMgr m_DataMgrFun = null;
  15. //粒级文件夹路径
  16. public static string m_PathName = "";
  17. //粒级文件夹获取
  18. public static string m_strPath = "";
  19. /// <summary>
  20. /// 保存的全局主窗体对象
  21. /// </summary>
  22. frmReportApp m_ReportApp;
  23. #endregion
  24. #region 构造函数及窗体加载
  25. public frmReportSysConfig(frmReportApp ReportApp)
  26. {
  27. InitializeComponent();
  28. //粒级部分
  29. this.m_DataMgrFun = ReportApp.m_rstDataMgr;
  30. m_ReportApp = ReportApp;
  31. //参数设置
  32. tb_sjtmbwj.Text = "";
  33. #region 国际化语言
  34. Language lan = new Language(this);
  35. #endregion
  36. }
  37. private void ReportMgrInfoForm_Load(object sender, EventArgs e)
  38. {
  39. //初始化数据
  40. InitMyComponent();
  41. }
  42. #endregion
  43. #region 自定义方法
  44. public void InitMyComponent()
  45. {
  46. string imagepath;
  47. //显示程序管理对话框参数设置
  48. string strbpath = ".\\Config\\ProData\\";
  49. tb_PartiSizeFileFolder.Text = strbpath;
  50. imagepath = strbpath;
  51. tb_sjtmb.Text = strbpath;
  52. tb_sjtmbwj.Text = "DefaultTriTemplateFile.tpf";
  53. //一般参数内的所有textbox不可修改
  54. tb_sjtmb.ReadOnly = true;
  55. tb_sjtmbwj.ReadOnly = true;
  56. tb_PartiSizeFileFolder.ReadOnly = true;
  57. DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData");
  58. DataTable dt = ds.Tables["Member"];
  59. string str_scale="";
  60. foreach (DataRow element in dt.Rows)
  61. {
  62. string RegName = element["RegName"].ToString();
  63. if (RegName == "Scale")
  64. {
  65. str_scale = element["strValue"].ToString();
  66. }
  67. }
  68. //比例因子
  69. tb_blyz.Text = str_scale;
  70. }
  71. private void tb_blyz_KeyPress(object sender, KeyPressEventArgs e)
  72. {
  73. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 46)
  74. e.Handled = true;
  75. //小数点的处理。
  76. if ((int)e.KeyChar == 46) //小数点
  77. {
  78. if (tb_blyz.Text.Length <= 0)
  79. e.Handled = true; //小数点不能在第一位
  80. else
  81. {
  82. float f;
  83. float oldf;
  84. bool b1 = false, b2 = false;
  85. b1 = float.TryParse(tb_blyz.Text, out oldf);
  86. b2 = float.TryParse(tb_blyz.Text + e.KeyChar.ToString(), out f);
  87. if (b2 == false)
  88. {
  89. if (b1 == true)
  90. e.Handled = true;
  91. else
  92. e.Handled = false;
  93. }
  94. }
  95. }
  96. }
  97. #endregion
  98. #region 三元相图相关
  99. //三元相图模板文件夹
  100. private void btn_klljwjj_Click(object sender, EventArgs e)
  101. {
  102. if (tb_PartiSizeFileFolder.Text == ".\\Config\\ProData\\")
  103. {
  104. string strb = ".\\Config\\ProData\\";
  105. folderBrowserDialog1.SelectedPath = strb;
  106. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  107. {
  108. tb_PartiSizeFileFolder.Text = folderBrowserDialog1.SelectedPath;
  109. }
  110. }
  111. else
  112. {
  113. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  114. {
  115. tb_PartiSizeFileFolder.Text = folderBrowserDialog1.SelectedPath;
  116. }
  117. else
  118. {
  119. tb_PartiSizeFileFolder.Text = folderBrowserDialog1.SelectedPath;
  120. }
  121. }
  122. }
  123. private void btn_sjtwj_Click(object sender, EventArgs e)
  124. {
  125. Triangulation_List tl = new Triangulation_List(m_ReportApp);
  126. tl.ShowDialog();
  127. }
  128. #endregion
  129. #region 粒级相关
  130. //颗粒粒级文件夹
  131. private void btn_sjtmbwjj_Click(object sender, EventArgs e)
  132. {
  133. //点击颗粒粒级文件夹按钮
  134. folderBrowserDialog1.ShowDialog();
  135. tb_sjtmb.Text = folderBrowserDialog1.SelectedPath;
  136. }
  137. private void btn_PartSize_Click(object sender, EventArgs e)
  138. {
  139. frmPartSizeEditorNew fPSEN = new frmPartSizeEditorNew(m_ReportApp, tb_PartiSizeFileFolder.Text);
  140. if (fPSEN.ShowDialog() == DialogResult.OK)
  141. {
  142. }
  143. }
  144. #endregion
  145. #region 报告模板相关
  146. //报表模板
  147. private void btn_bbmbwjj_Click(object sender, EventArgs e)
  148. {
  149. FolderBrowserDialog ofd = new FolderBrowserDialog();
  150. if (ofd.ShowDialog() == DialogResult.OK)
  151. {
  152. //tb_bgmb.Text = ofd.SelectedPath + @"\";
  153. }
  154. }
  155. //参数设置,报告模板文件
  156. private void button2_Click(object sender, EventArgs e)
  157. {
  158. //if (tb_bgmb.Text != "")
  159. //{
  160. // OpenFileDialog op = new OpenFileDialog();
  161. // string strpath = "";
  162. // op.InitialDirectory = tb_bgmb.Text;
  163. // if (op.ShowDialog() == DialogResult.OK)
  164. // {
  165. // strpath = op.FileName;
  166. // tb_bgmbwj.Text = strpath;
  167. // }
  168. //}
  169. }
  170. #endregion
  171. #region 报告参数设置相关
  172. //取消
  173. private void btn_ybcsqx_Click(object sender, EventArgs e)
  174. {
  175. this.Close();
  176. }
  177. public string strParSizeFile = "";
  178. //保存报告文件
  179. private void btn_ybcsbc_Click(object sender, EventArgs e)
  180. {
  181. double blyz = 0;
  182. if (!double.TryParse(tb_blyz.Text.ToString(),out blyz))
  183. {
  184. MessageBox.Show("please check params!");
  185. }
  186. //参数设置保存功能粒级文件
  187. strParSizeFile = tb_PartiSizeFileFolder.Text;
  188. String strTritempFile = tb_sjtmb.Text;
  189. string strTritemp = tb_sjtmbwj.Text;
  190. //比例因子
  191. OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "Scale", "strValue", tb_blyz.Text.ToString());
  192. this.Close();
  193. }
  194. #endregion
  195. }
  196. }