public static bool save_xgyc_zrj(List <XGYC_ZRJ_BLL> list) { CheckRLS(); List <string> lines = new List <string>(File.ReadAllLines(string.Format(datPath, App.Project[0].PROJECT_LOCATION) + @"\RLS4.DAT")); using (StreamWriter sw = new StreamWriter(string.Format(datPath, App.Project[0].PROJECT_LOCATION) + @"\RLS4.DAT", false, Encoding.UTF8)) { List <string> newLines = new List <string>(); int startIndex = lines.IndexOf("*ZRYC //井号 调剖层 日注液量 注入液粘度 措施前注水压力 措施前视吸水指数 措施前注入分数 措施后注水压力 措施后视吸水指数 措施后注入分数"); int endIndex = lines.IndexOf("/ZRYC"); lines.RemoveRange(startIndex + 1, endIndex - startIndex - 1); lines.ForEach(item => newLines.Add(string.Format("{0}{1}", item, "\r\n"))); StringBuilder data_str = new StringBuilder(); for (int i = 0; i < list.Count; i++) { XGYC_ZRJ_BLL item = list[i]; data_str.AppendFormat("{0}\t", item.JH); data_str.AppendFormat("{0}\t", item.TPCNAME); data_str.AppendFormat("{0}\t", item.RZYL); data_str.AppendFormat("{0}\t", item.ZRYND); data_str.AppendFormat("{0}\t", item.CSQ_DXYL); data_str.AppendFormat("{0}\t", item.CSQ_SXSZS); data_str.AppendFormat("{0}\t", item.CSQ_TPCZRFS); data_str.AppendFormat("{0}\t", item.CSH_YL); data_str.AppendFormat("{0}\t", item.CSH_SXSZS); data_str.AppendFormat("{0}\r\n", item.CSH_TPCZRFS); } newLines.Insert(startIndex + 1, data_str.ToString()); sw.Write(string.Join("", newLines.ToArray())); return(true); } }
public static XGYC_ZRJ_BLL read_XGYC_ZRJ(string jh) { List <XGYC_ZRJ_BLL> list = read_XGYC_ZRJ(); XGYC_ZRJ_BLL item = list.FirstOrDefault(n => n.JH == jh); return(item); }