public CCustomLine this[string caption] { get { foreach (CCustomLine cl in m_customlines) { if (cl.Caption == caption) { return cl; } } //Did not find it - Raise an error? For now return blank row CCustomLine ncl = new CCustomLine(); return ncl; } }
/// <param name="CaptionSQL">SQL that gives the captions and format data. Caption, List, DataType, Default</param> /// <param name="ListSQL">SQL that gives the PickListData - {0} in string for CAPTION reference</param> protected void InitializeHelper(string CaptionSQL, string ListSQL) { CCustomLine cl; DbDataReader rdr = WWD.GetReader(CaptionSQL); string sPickSQL; while (rdr.Read()) { cl = new CCustomLine(); cl.Caption = rdr.GetString(0); cl.IsList = (rdr.GetInt16NoNull(1) != 0); // Check to see if we need to read the PickList data if (cl.IsList) { sPickSQL = string.Format(ListSQL,cl.Caption); DbDataReader rdrPick = WWD.GetReader(sPickSQL); while (rdrPick.Read()) { cl.PickList.Add(rdrPick.GetStringNoNull(0)); } } cl.DataTypeCode = rdr.GetStringNoNull(2); cl.DefaultData = rdr.GetStringNoNull(3); cl.CustomData = cl.DefaultData; // Set up initial default value. Will be overwritten on Load m_customlines.Add(cl); } }