public static Collection<CalfInfo> GetCalvesInShop() { try { XmlDocument objXmlDoc = GetMasterDataFile(Constants.FILE_CALFSLISTMASTERDATA); if (objXmlDoc == null) return null; DataView dv = GetData(objXmlDoc, Constants.RANCH_CALF_ROOT + Constants.CHAR_SLASH + Constants.RANCH_CALF_ANIMALS); Collection<CalfInfo> calfs = new Collection<CalfInfo>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { CalfInfo calf = new CalfInfo(); calf.Name = dv.Table.Rows[ix][0].ToString(); calf.AId = DataConvert.GetInt32(dv.Table.Rows[ix][1]); calf.Price = DataConvert.GetInt32(dv.Table.Rows[ix][2]); calfs.Add(calf); } return calfs; } catch (Exception ex) { LogHelper.Write("ConfigCtrl.GetCalvesInShop", ex); return null; } }
public static Collection<CalfInfo> GetOriginalCalves(string content) { try { if (String.IsNullOrEmpty(content)) return new Collection<CalfInfo>(); XmlDocument objXmlDoc = new XmlDocument(); objXmlDoc.LoadXml(content); DataView dv = GetData(objXmlDoc, Constants.RANCH_CALF_ROOT + Constants.CHAR_SLASH + Constants.RANCH_CALF_ANIMALS); Collection<CalfInfo> calves = new Collection<CalfInfo>(); for (int ix = 0; ix < dv.Table.Rows.Count; ix++) { CalfInfo calf = new CalfInfo(); calf.Name = dv.Table.Rows[ix][0].ToString(); calf.AId = DataConvert.GetInt32(dv.Table.Rows[ix][2]); calf.SKey = DataConvert.GetString(dv.Table.Rows[ix][3]); calf.Price = DataConvert.GetInt32(dv.Table.Rows[ix][4]); calves.Add(calf); } return calves; } catch (Exception ex) { LogHelper.Write("ConfigCtrl.GetOriginalCalves", content, ex, LogSeverity.Error); return null; } }