Example #1
0
        private void FillStation()
        {
            const string METHOD_NAME = "FillStation";

            try {
                string    cropYear = ((MasterReportTemplate)Master).CropYear;
                ArrayList listIDs  = new System.Collections.ArrayList(_stationList.Split(new char[] { ',' }));
                ListBox   lst      = lstTxStation;
                lst.Items.Clear();

                List <ListBeetStationIDItem> stateList = WSCReportsExec.StationGetByFactoryNo(Convert.ToInt32(cropYear), _factoryList);

                System.Text.StringBuilder sbList = new System.Text.StringBuilder("");
                foreach (ListBeetStationIDItem state in stateList)
                {
                    ListItem item = new ListItem(state.StationNumberName, state.StationNumber);
                    lst.Items.Add(item);
                    if (listIDs.Contains(item.Value))
                    {
                        lst.Items[lst.Items.Count - 1].Selected = true;

                        // Rebuild stationList because the listIDs is now qualified against
                        // stations assigned to the valid factory list.
                        sbList.Append(item.Value + ",");
                    }
                }
                if (sbList.Length > 0)
                {
                    sbList.Length = sbList.Length - 1;
                }
                _stationList = sbList.ToString();
            }
            catch (Exception ex) {
                Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
                throw (wex);
            }
        }