Example #1
0
        /// <summary>
        /// Create machine object and map the values from xml file tag to machine object.
        /// </summary>
        /// <returns>Return list of machines as 'IMachineBase' format.</returns>
        public List <UCM> GetUCMMachineDetail()
        {
            MachineObjectCreation t = new MachineObjectCreation();

            List <UCM> machines = t.GetUCMMachineInstanceList();

            // Get map xml file.
            XElement document = XElement.Load(Properties.EmbeddedVariableValues.MachineMapDetailFileFullPath);

            //Get all tags related to specified type of machines from xml.
            var machineConfigValues = from mac in document.Elements(AliasVal.Machine)
                                      where (string)mac.Attribute(AliasVal.Type) == GlobalReference.GetMachineTypeInName <UCM>()
                                      select mac;

            UCM machine = null;

            //Iterage thru the tags and assign tag values to the properties of the machine class.
            foreach (XElement tagValue in machineConfigValues)
            {
                machine = t.GetUCMMachineInstance();

                machine.FloorNum           = Convert.ToInt16(tagValue.Element(AliasVal.FloorNum).Value.Trim());
                machine.MachineNum         = Convert.ToInt16(tagValue.Element(AliasVal.MachineNum).Value.Trim());
                machine.MachineName        = tagValue.Element(AliasVal.Name).Value.Trim();
                machine.Channel            = tagValue.Element(AliasVal.Channel).Value.Trim();
                machine.MachineDisplayName = tagValue.Element(AliasVal.DisplayName).Value.Trim();

                //Assign new records to the list.
                machines.Add(machine);
            }

            return(machines);
        }
Example #2
0
        // T machine;

        public UCM GetUCMMachineInstance()
        {
            UCM machine = new UCM();

            //if(GlobalReference.GetMachineTypeInName<T>() == AliasVal.UCM)
            //{
            //   machine =  new UCM();
            //}
            //else if(GlobalReference.GetMachineTypeInName<T>() == AliasVal.LCM)
            //{

            //}

            return(machine);
        }