public ShineKJ.Model.KJ128.Gstruct ReadXmlWithGraphicsConfig() { Gstruct gs = new Gstruct(); DataSet ds = new DataSet(); ds.ReadXml(System.Web.HttpContext.Current.Server.MapPath("./Xml/GConfig.xml")); gs.stcolor = ds.Tables[0].Rows[0][0].ToString(); gs.ptcolor = ds.Tables[0].Rows[0][1].ToString(); gs.pgcolor = ds.Tables[0].Rows[0][2].ToString(); gs.pcolor = ds.Tables[0].Rows[0][3].ToString(); gs.lcolor = ds.Tables[0].Rows[0][4].ToString(); gs.stoptimevalue = ds.Tables[0].Rows[0][5].ToString(); gs.stoptime = ds.Tables[0].Rows[0][6].ToString(); gs.intervaltime = ds.Tables[0].Rows[0][7].ToString(); return gs; }
public void WriteXmlWithGraphicsConfig(Gstruct gs) { XmlDocument xmldoc = new XmlDocument(); XmlDeclaration xmldec = xmldoc.CreateXmlDeclaration("1.0", "gb2312", null); xmldoc.AppendChild(xmldec); XmlElement xmlroot = xmldoc.CreateElement("Config"); XmlElement xmlStColor = xmldoc.CreateElement("stcolor"); xmlStColor.InnerText = gs.stcolor; xmlroot.AppendChild(xmlStColor); XmlElement xmlPtColor = xmldoc.CreateElement("ptcolor"); xmlPtColor.InnerText = gs.ptcolor; xmlroot.AppendChild(xmlPtColor); XmlElement xmlPgColor = xmldoc.CreateElement("pgcolor"); xmlPgColor.InnerText = gs.pgcolor; xmlroot.AppendChild(xmlPgColor); XmlElement xmlPColor = xmldoc.CreateElement("pcolor"); xmlPColor.InnerText = gs.pcolor; xmlroot.AppendChild(xmlPColor); XmlElement xmlLColor = xmldoc.CreateElement("lcolor"); xmlLColor.InnerText = gs.lcolor; xmlroot.AppendChild(xmlLColor); XmlElement xmlLStopTimeValue = xmldoc.CreateElement("stoptimevalue"); xmlLStopTimeValue.InnerText = gs.stoptimevalue; xmlroot.AppendChild(xmlLStopTimeValue); XmlElement xmlStopTime = xmldoc.CreateElement("stoptime"); xmlStopTime.InnerText = gs.stoptime; xmlroot.AppendChild(xmlStopTime); XmlElement xmlIntervalTime = xmldoc.CreateElement("intervaltime"); xmlIntervalTime.InnerText = gs.intervaltime; xmlroot.AppendChild(xmlIntervalTime); xmldoc.AppendChild(xmlroot); xmldoc.Save(System.Web.HttpContext.Current.Server.MapPath("./Xml/GConfig.xml")); }
private void LoadSelectColor() { gs = cxml.ReadXmlWithGraphicsConfig(); ddlSTColor.SelectedValue = gs.stcolor; ddlPTColor.SelectedValue = gs.ptcolor; ddlPGColor.SelectedValue = gs.pgcolor; ddlTPColor.SelectedValue = gs.pcolor; ddlTLColor.SelectedValue = gs.lcolor; ddlStopTimeValue.SelectedValue = gs.stoptimevalue; ddlStopTime.SelectedValue = gs.stoptime; ddlIntervalTime.SelectedValue = gs.intervaltime; }