public clsStorage Add(int StorNum = 0, string Description = "") { if (StorNum == 0) { int Result = 0; // new record, increment highest value foreach (clsStorage Stor in Storages) { if (Stor.Number > Result) { Result = Stor.Number; } } StorNum = Result + 1; } else { // check if exists foreach (clsStorage Stor in Storages) { if (Stor.Number == StorNum) { return(Stor); } } } // new record Storages.Add(new clsStorage(mf)); clsStorage StorNew = Storages[Storages.Count - 1]; StorNew.Number = StorNum; StorNew.Description = Description; return(StorNew); }
public void Load() { Storages.Clear(); DAO.Recordset RS; string SQL = "select * from tblStorage order by storRecNum"; RS = mf.Dbase.DB.OpenRecordset(SQL); while (!RS.EOF) { clsStorage Stor = new clsStorage(mf); Stor.Load((short)RS.Fields["storID"].Value); Storages.Add(Stor); RS.MoveNext(); } RS.Close(); }
public string BinDescription(bool ShortDescription = false) { string result = ""; if (ShortDescription) { result = BinNum.ToString(); } else { clsStorage Bin = new clsStorage(mf); if (BinNum > 0) { Bin.Load(StorNum: BinNum); result = Bin.Number.ToString() + " " + Bin.Description; } } return(result); }