Exemplo n.º 1
0
        private static TestConfiguration15 ProcessAction(TestConfiguration15 obj, AtmlActionType actionType,
                                                         EventArgs args)
        {
            IAtmlController <TestConfiguration15> controller = TestConfigurationController.Instance;

            return(Process(obj, actionType, controller, args));
        }
Exemplo n.º 2
0
        private static T Process <T>(T obj, AtmlActionType actionType, IAtmlController <T> controller, EventArgs args)
        {
            T retVal = default(T);

            switch (actionType)
            {
            case AtmlActionType.Add:
                controller.Save(obj);
                break;

            case AtmlActionType.Edit:
                controller.Save(obj);
                break;

            case AtmlActionType.Delete:
                controller.Save(obj);
                break;

            case AtmlActionType.Find:
                AtmlActionEventArgs aeArgs = args as AtmlActionEventArgs;
                if (aeArgs != null)
                {
                    retVal = controller.Find(aeArgs.Guid);
                }
                break;
            }
            return(retVal);
        }
Exemplo n.º 3
0
        private static InstrumentDescription ProcessAction(InstrumentDescription obj, AtmlActionType actionType, EventArgs args)
        {
            IAtmlController <InstrumentDescription> controller = InstrumentController.Instance;

            obj.DataState = actionType.Equals(AtmlActionType.Add)
                                ? BASEBean.eDataState.DS_ADD
                                : actionType.Equals(AtmlActionType.Edit)
                                      ? BASEBean.eDataState.DS_EDIT
                                      : actionType.Equals(AtmlActionType.Delete)
                                            ? BASEBean.eDataState.DS_DELETE
                                            : BASEBean.eDataState.DS_NO_CHANGE;
            return(Process(obj, actionType, controller, args));
        }
Exemplo n.º 4
0
        /**
         * Lookup the Instrument by the part number and test station in the asset table.
         */

        public static String FindInstrumentReference(string partNumber, string stationId)
        {
            string referenceId = "";

            try
            {
                IAtmlController <TestStationDescription11> controller = AtmlControllerFactory <TestStationDescription11> .Controller;
                TestStationDescription11 testStation = controller.Find(Guid.Parse(stationId));
                if (testStation == null)
                {
                    throw new Exception(string.Format(ErrorLocatingTestStation, stationId));
                }
                string stationType        = testStation.Identification.ModelName;
                string basePartNumber     = partNumber.Split('#')[0];
                string fullPartNumber     = stationType + "." + basePartNumber;
                string combinedPartNumber = stationType + "." + partNumber; //--- has "#xxx"
                string instrumentName     = fullPartNumber + ATMLContext.ATML_INSTRUMENT_FILENAME_SUFFIX;

                //--------------------------------------------------------------------------------------------------------//
                //--- TODO: Need to adjust this process
                //---       Strip the #xxx off
                //---       Prefix it with the station name
                //---       Check if instrument is in database - if not create a placeholder
                //---       Get instrument uuid for reference
                //---       Using the original part number (ie with #xxx) make sure its associated with the test station
                //---       This will provide quantities of an instrument via #xxx
                //--------------------------------------------------------------------------------------------------------//

                //-----------------------------------------//
                //--- Look for an asset in the database ---//
                //-----------------------------------------//
                AssetIdentificationBean asset = DocumentManager.FindAsset(AssetTypePart, combinedPartNumber);
                if (asset != null)
                {
                    //-----------------------------//
                    //--- Grab the reference id ---//
                    //-----------------------------//
                    referenceId = asset.uuid.ToString();
                }
                else
                {
                    //--- Lookup Document by Instrument Id ---//
                    Document document = DocumentManager.GetDocumentByName(instrumentName);
                    if (document == null)
                    {
                        //--- We should only prompt if the base part number is missing ---//
                        referenceId = PromptUserToAddInstrument(basePartNumber, stationType, referenceId);
                    }
                    else
                    {
                        referenceId = document.uuid;
                        CreateAsset(referenceId, combinedPartNumber);
                    }
                }

                //-------------------------------------------------------------------------------------------------------//
                //--- Let see if the test station has a reference to the instrument instance, if no we need to add it ---//
                //-------------------------------------------------------------------------------------------------------//
                if (!AtmlControllerFactory <TestStationDescription11> .Controller.HasInstrumentReference(testStation, partNumber))
                {
                    //InstrumentDescription instrument = InstrumentController.FindInstrument(partNumber);
                    AtmlControllerFactory <TestStationDescription11> .Controller.AddInstrumentReference(testStation as TestStationDescription11, partNumber,
                                                                                                        referenceId);
                }
            }
            catch (Exception e)
            {
                LogManager.SourceError(ATMLReader.SOURCE, ErrorSavingInstrument, partNumber, e.Message);
            }
            return(referenceId);
        }
Exemplo n.º 5
0
        private static TestStationDescription11 ProcessAction(TestStationDescription11 obj, AtmlActionType actionType, EventArgs args)
        {
            IAtmlController <TestStationDescription11> controller = TestStationController.Instance;

            return(Process(obj, actionType, controller, args));
        }
Exemplo n.º 6
0
        private static UUTDescription ProcessAction(UUTDescription obj, AtmlActionType actionType, EventArgs args)
        {
            IAtmlController <UUTDescription> controller = UUTController.Instance;

            return(Process(obj, actionType, controller, args));
        }