private void init药品初始() { try { // Create an instance of StreamReader to read from a file. // The using statement also closes the StreamReader. //using (StreamReader sr = new StreamReader(Application.StartupPath + @"\..\yzk_config" + @"\药品配置.txt", Encoding.GetEncoding(54936), true)) using (StreamReader sr = new StreamReader(Application.StartupPath + @"\..\..\yzk_config" + @"\药品配置.txt", Encoding.Default, true)) { String line; string[] col; // Read and display lines from the file until the end of // the file is reached. while ((line = sr.ReadLine()) != null) { if (line.StartsWith("#")) { continue; } //Console.WriteLine(line); char[] sep = new char[3]; sep[0] = ','; sep[1] = '\t'; sep[2] = '/'; col = line.Split(sep, 9, StringSplitOptions.RemoveEmptyEntries); if (col.Length < 2) { continue; } String tmp名称 = col[1]; Double tmp单价 = 0; if (!Double.TryParse(col[2], out tmp单价)) { MessageBox.Show("药品单价读取错误: " + line, "启动错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(0); } yzk_一种药 tmp一种药 = new yzk_一种药(tmp名称, tmp单价); this.m_ListOf药品名称.Add(tmp名称); this.m_DicOf药品.Add(tmp名称, tmp一种药); } } } catch (Exception e) { // Let the user know what went wrong. //Console.WriteLine("The file could not be read:"); //Console.WriteLine(e.Message); } }
internal string Get药品单价(string para药品名称) { yzk_一种药 tmpKK = this.m_DicOf药品[para药品名称]; return(tmpKK.Get药品单价()); }