VMWeighingScaleItem MapConfig(VMWeighingScaleItem weighingScale, XElement xlmEquipConfig)
 {
     if (xlmEquipConfig.Element("EquipmentType").Value == EquipmentType.WeighingScale.ToString())
     {
         LocalEquipmentConfig settings = new LocalEquipmentConfig
                                          {
                                              Id = Guid.Parse(xlmEquipConfig.Element("Id").Value),
                                              Code = xlmEquipConfig.Element("Code").Value,
                                              Name = xlmEquipConfig.Element("Name").Value,
                                              Port = xlmEquipConfig.Element("Port").Value,
                                              Parity = xlmEquipConfig.Element("Parity").Value,
                                              EquipmentType = xlmEquipConfig.Element("EquipmentType").Value,
                                              BaudRate = xlmEquipConfig.Element("BaudRate").Value,
                                              DataBits = xlmEquipConfig.Element("DataBits").Value,
                                              Model = xlmEquipConfig.Element("Model").Value,
                                          };
         weighingScale.ConfigSettings = settings;
         }
     return weighingScale;
 }
        private VMWeighingScaleItem Map(WeighScale weighingScale, int index, XElement xlmEquipConfig)
        {
            var mapped = new VMWeighingScaleItem { WeighingScale = weighingScale, RowNumber = index+1 };
            if (weighingScale._Status == EntityStatus.Active)
                mapped.HlkDeactivateContent = "Deactivate";
            if (weighingScale._Status == EntityStatus.Inactive)
                mapped.HlkDeactivateContent = "Activate";

            if (xlmEquipConfig != null) mapped = MapConfig(mapped, xlmEquipConfig);

            return mapped;
        }