clsSimuResultByOneGoods GetOneGoodsSimulationXML العام (سلسلة PathAndFileName)
{
clsSimuResultByOneGoods OneGoods = جديد clsSimuResultByOneGoods();
Hashtable AllLocationResult = new Hashtable();
System.Xml.XmlTextReader r = new XmlTextReader(PathAndFileName);
سلسلة موقع معرف = ""؛
DataTable LocationTable = null;
بينما (ص.قراءة ())
{
إذا (r.NodeType == XmlNodeType.Element)
{
التبديل (r.LocalName)
{
حالة "النتيجة":
OneGoods.GoodsCode = r.GetAttribute("GoodsCode");
OneGoods.From = Convert.ToDateTime(r.GetAttribute("FromDate"));
OneGoods.To = Convert.ToDateTime(r.GetAttribute("ToDate"));
استراحة؛
حالة "الموقع":
LocationID = r.GetAttribute("ID");
LocationTable = new DataTable();
LocationTable.Columns.Add("Date",typeof(DateTime));
LocationTable.Columns.Add("SafetyStock",typeof(decimal));
LocationTable.Columns.Add("ForecastDemand",typeof(decimal));
LocationTable.Columns.Add("FinalOutput",typeof(decimal));
LocationTable.Columns.Add("FinalInput",typeof(decimal));
LocationTable.Columns.Add("SimuStock",typeof(decimal));
LocationTable.Columns.Add("SimuStockTime",typeof(decimal));
LocationTable.Columns.Add("ImportWorkDay",typeof(bool));
LocationTable.Columns.Add("ImportWorkDay",typeof(bool));
استراحة؛
حالة "سجل":
إذا (LocationTable! = فارغ)
{
DataRow dr = LocationTable.NewRow();
dr["Date"] = Convert.ToDateTime(r.GetAttribute("Date"));
if(r.GetAttribute("SafetyStock") != null && r.GetAttribute("SafetyStock") != "")
dr["SafetyStock"] = Convert.ToDecimal(r.GetAttribute("SafetyStock"));
if(r.GetAttribute("ForecastDemand") != null && r.GetAttribute("ForecastDemand") != "")
dr["ForecastDemand"] = Convert.ToDecimal(r.GetAttribute("ForecastDemand"));
if(r.GetAttribute("FinalInput") != null && r.GetAttribute("FinalInput") != "")
dr["FinalInput"] = Convert.ToDecimal(r.GetAttribute("FinalInput"));
if(r.GetAttribute("FinalOutput") != null && r.GetAttribute("FinalOutput") != "")
dr["FinalOutput"] = Convert.ToDecimal(r.GetAttribute("FinalOutput"));
if(r.GetAttribute("SimuStock") != null && r.GetAttribute("SimuStock") != "")
dr["SimuStock"] = Convert.ToDecimal(r.GetAttribute("SimuStock"));
if(r.GetAttribute("SimuStockTime") != null && r.GetAttribute("SimuStockTime") != "")
dr["SimuStockTime"] = Convert.ToDecimal(r.GetAttribute("SimuStockTime"));
if(r.GetAttribute("ImportWorkDay") != null && r.GetAttribute("ImportWorkDay") != "")
dr["ImportWorkDay"] = Convert.ToBoolean(r.GetAttribute("ImportWorkDay"));
if(r.GetAttribute("ExportWorkDay") != null && r.GetAttribute("ExportWorkDay") != "")
dr["ExportWorkDay"] = Convert.ToBoolean(r.GetAttribute("ExportWorkDay"));
LocationTable.Rows.Add(dr);
}
استراحة؛
تقصير:
استراحة؛
}
}
وإلا إذا (r.NodeType == XmlNodeType.EndElement)
{
التبديل (r.LocalName)
{
حالة "الموقع":
إذا (LocationTable! = فارغ)
{
LocationTable.AcceptChanges();
AllLocationResult.Add(LocationID,LocationTable);
معرف الموقع = "";
LocationTable = null;
}
استراحة؛
تقصير:
استراحة؛
}
}
}
OneGoods.AllLocationResult = AllLocationResult;
إرجاع سلع واحدة؛
}