Пример #1
0
         public TargetListItem(CampaignTargetInfoEx target) {
            _target = target;

            Text = _target.DeviceId.LocalId.ToString();

            SubItems.Add((_target.Operator == null) ? "" : _target.Operator.Id.ToString(false));
            SubItems.Add((_target.VehicleId == null) ? "" : _target.VehicleId.LocalId.ToString());
            SubItems.Add((_target.VehicleSN == null) ? "" : _target.VehicleSN);
            SubItems.Add((_target.LicensePlate == null) ? "" :_target.LicensePlate);

            if (_target.ClientVersionNo != 0) {
               SubItems.Add(SwlVersion.FromInt32(_target.ClientVersionNo).Format());
            } else {
               switch (_target.CampaignType) {
                  case SoftwareUpdateType.Config:
                     SubItems.Add(SwlVersion.FromInt32(_target.ConfigVersionNumber).Format());
                     break;

                  case SoftwareUpdateType.Image:
                     SubItems.Add(SwlVersion.FromInt32(_target.ImageVersionNumber).Format());
                     break;

                  default:
                     SubItems.Add("");
                     break;
               }
            }

            SubItems.Add(((Mpcr.Services.Oscar.Logistics.CampaignTargetStatus)_target.Status).ToString());
            SubItems.Add(_target.DateStatus.ToLocalTime().Format());

            SubItems.Add(_target.ClientUpdateState.ToString());
            SubItems.Add((_target.ClientUpdateStatus == null) ? "" : _target.ClientUpdateStatus);
            SubItems.Add(_target.ClientUpdateDate.LocalDateTime.Format());
         }
Пример #2
0
      private void _insertTargets(List<DeviceLogisticInfo> targets) {
         if (targets != null) {
            foreach (var dev in targets) {
               CampaignTargetInfoEx target = null;

               SwlVersion dstVersion = SwlVersion.FromInt32(_campaignInfo.DstInstallVersionNumber);
               SwlVersion srcVersion = SwlVersion.FromUInt32(0);

               switch (_campaignInfo.Type) {
                  case SoftwareUpdateType.Config:
                     srcVersion = SwlVersion.FromInt32(dev.ConfigVersionNumber);
                     break;

                  case SoftwareUpdateType.Image:
                     srcVersion = SwlVersion.FromInt32(dev.ImageVersionNumber);
                     break;

                  default:
                     continue;
               }

               if (SwlVersion.Compare(srcVersion, dstVersion) >= 0) {
                  continue;
               }

               foreach (var tt in _campaignTargetsInfo) {
                  if (tt.DeviceId == dev.DeviceId) {
                     target = tt;
                  }
               }

               if (target != null) {
                  continue;
               }

               target = new CampaignTargetInfoEx();

               target.TargetId = BplIdentity.Get(Guid.NewGuid().ToString());
               target.CampaignId = _campaignInfo.CampaignId;
               target.CampaignType = _campaignInfo.Type;
               target.DeviceId = dev.DeviceId;
               target.Operator = dev.Operator;
               target.VehicleId = dev.VehicleId;
               target.VehicleVIN = dev.VehicleVIN;
               target.VehicleSN = dev.VehicleSN;
               target.LicensePlate = dev.LicensePlate;
               target.ImageVersionNumber = dev.ImageVersionNumber;
               target.ConfigVersionNumber = dev.ConfigVersionNumber;
               target.Status = Mpcr.Services.Oscar.Logistics.CampaignTargetStatus.Pending;

               _campaignTargetsInfo.Add(target);
            }
         }

         _refreshList();
      }