Ejemplo n.º 1
0
        public static Workstation CreateWorkstation(string machineName)
        {
            //Create a workstation that has an ILabelPrinter printer and IScale scale
            Workstation station = null;

            try {
                if (machineName.Length > 0)
                {
                    DataSet ds = Mediator.FillDataset(USP_STATION_CONFIG, TBL_STATION_CONFIG, new object[] { machineName });
                    if (ds.Tables[TBL_STATION_CONFIG].Rows.Count == 0)
                    {
                        throw new ApplicationException("Station for  " + machineName + " not found.");
                    }
                    else
                    {
                        WorkstationDS stationDS = new WorkstationDS();
                        stationDS.Merge(ds);
                        station = new Workstation(stationDS.WorkstationDetailTable[0]);
                    }
                }
                else
                {
                    station = new Workstation(null);
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while creating workstation.", ex); }
            return(station);
        }