标签:node.app system node bool inner string using nbsp oid
public int num = 0; /// <summary> /// 关闭背光 /// </summary> public void CloseOtherBackLight() { string path = GFun.GetDataDir() + "CloseOtherBackLight.xml"; bool isok = true; if (File.Exists(path)) isok = true; else isok = false; if (num == 0) { isok = false; } if (isok == false) { FHost.CloseBackLight(0xFF, false); XmlDocument CloseBackLight = new XmlDocument(); XmlNode node = CloseBackLight.CreateElement("CloseOtherBackLight"); CloseBackLight.AppendChild(node); List<int> other = new List<int>(); string cmdStr = "Select EtnCode from Patient"; using (SqlCeCommand cmd = new SqlCeCommand(cmdStr, DbOprt.Conn)) { using (SqlCeDataReader dr = cmd.ExecuteReader()) { string txt = string.Empty; while (dr.Read()) { string BedNo = Convert.ToString(dr["EtnCode"]); try { other.Add(Convert.ToInt16(BedNo)); } catch (System.Exception ex) { Excp.WriteExcp(ex); } } } } for (int i = 0; i < other.Count; i++) { XmlNode bedno = CloseBackLight.CreateNode(XmlNodeType.Element, "BedNo", null); bedno.InnerText = other[i].ToString(); node.AppendChild(bedno); } CloseBackLight.Save(path); foreach (int item in other) { FHost.OpenBackLight((short)item); } } else { XmlDocument BedNo = new XmlDocument(); BedNo.Load(path); XmlNode root = BedNo.DocumentElement; List<int> XMLBedNo = new List<int>(); foreach (XmlNode xmlNode in root.ChildNodes) { XMLBedNo.Add(Convert.ToInt16(xmlNode.InnerText)); } List<int> SQLBedNo = new List<int>(); string cmdStr = "Select EtnCode from Patient"; using (SqlCeCommand cmd = new SqlCeCommand(cmdStr, DbOprt.Conn)) { using (SqlCeDataReader dr = cmd.ExecuteReader()) { string txt = string.Empty; while (dr.Read()) { string BedID = Convert.ToString(dr["EtnCode"]); try { SQLBedNo.Add(Convert.ToInt16(BedID)); } catch (System.Exception ex) { Excp.WriteExcp(ex); } } } } List<int> Open = new List<int>(); List<int> Close = new List<int>(); for (int i = 0; i < XMLBedNo.Count; i++) { if (!SQLBedNo.Contains(XMLBedNo[i])) { Close.Add(XMLBedNo[i]); } } for (int i = 0; i < SQLBedNo.Count; i++) { if (!XMLBedNo.Contains(SQLBedNo[i])) { Open.Add(SQLBedNo[i]); } } foreach (var item in Open) { FHost.OpenBackLight((short)item); } foreach (var item in Close) { FHost.CloseBackLight((short)item, false); } File.Delete(path); XmlDocument CloseBackLight = new XmlDocument(); XmlNode node = CloseBackLight.CreateElement("CloseOtherBackLight"); CloseBackLight.AppendChild(node); for (int i = 0; i < SQLBedNo.Count; i++) { XmlNode bedno = CloseBackLight.CreateNode(XmlNodeType.Element, "BedNo", null); bedno.InnerText = SQLBedNo[i].ToString(); node.AppendChild(bedno); } CloseBackLight.Save(path); } num++; }
标签:node.app system node bool inner string using nbsp oid
原文地址:http://www.cnblogs.com/hz1234/p/6762064.html