private bool LoadSamples(out string message) { message = string.Empty; if (!System.IO.File.Exists(ItemPath)) { message = "未找到配置文件."; return(false); } System.Xml.XmlDocument xmlConfig = new System.Xml.XmlDocument(); try { xmlConfig.Load(ItemPath); XmlNodeList sampleNodes = xmlConfig["Configs"]["Samples"].SelectNodes("Sample"); if (sampleNodes == null || sampleNodes.Count == 0) { message = "配置文件中没有试剂厂商信息!"; return(false); } foreach (XmlNode node in sampleNodes) { clsSTCheckSample sample = new clsSTCheckSample(); foreach (XmlNode xn in node.ChildNodes) { switch (xn.Name) { case "BatchNo": sample.BatchNo = xn.InnerText; break; case "DeadLine": sample.DeadLine = xn.InnerText; break; case "Company": sample.Company = xn.InnerText; break; default: break; } } if (!string.IsNullOrEmpty(sample.BatchNo)) { this.m_lstSamples.Add(sample); } } } catch (Exception ex) { message = ex.Message; return(false); } return(true); }
private void LoadData() { clsSTCheckSample checkSample = new clsSTCheckSample(); checkSample.BatchNo = string.Empty; this.Items.Add(checkSample); List <clsSTCheckSample> lstSamples = clsST360Config.CurrentConfig.Samples; foreach (clsSTCheckSample Sample in lstSamples) { this.Items.Add(Sample); } }
private void m_cboBatchNo_SelectedIndexChanged(object sender, EventArgs e) { clsSTCheckSample sample = m_cboBatchNo.SelectSample; if (sample != null) { this.m_selectSample = sample; DateTime deadLine = DateTime.MinValue; try { deadLine = DateTime.Parse(sample.DeadLine); } catch { deadLine = DateTime.Now; } this.m_dtpSampleDeadLine.Value = deadLine; this.m_txtSampleProvider.Text = sample.Company; } }