Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ADX365.Forms.Core.ViewModels.InventoryMasterViewModel"/> class.
 /// </summary>
 public InventoryMasterViewModel(IVehicleService pVehicleService) : base("InventoryMasterViewModel")
 {
     base.ExecuteMethod($"InventoryMasterViewModel({pVehicleService})", delegate()
     {
         // Init services.
         _vehicleService = pVehicleService;
         // Init fields.
         _categoriesList = new List <ListItem>
         {
             new ListItem
             {
                 Value       = ((int)CommonConstants.InventoryListCategories.OnDemandAuctions).ToString(),
                 Description = ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ListCategoryOnDemandAuctions, "ON DEMAND AUCTIONS")
             },
             new ListItem
             {
                 Value       = ((int)CommonConstants.InventoryListCategories.OfferBuyNow).ToString(),
                 Description = ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ListCategoryOfferBuyNow, "OFFER / BUY NOW")
             },
             new ListItem
             {
                 Value       = ((int)CommonConstants.InventoryListCategories.Sold).ToString(),
                 Description = ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ListCategorySold, "SOLD")
             },
             new ListItem
             {
                 Value       = ((int)CommonConstants.InventoryListCategories.InspectionInProgress).ToString(),
                 Description = ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ListCategoryInspectionInProgress, "INSPECTION IN PROGRESS")
             },
             new ListItem
             {
                 Value       = ((int)CommonConstants.InventoryListCategories.WaitingForInspection).ToString(),
                 Description = ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ListCategoryWaitingForInspection, "WAITING FOR INSPECTION")
             },
             new ListItem
             {
                 Value       = ((int)CommonConstants.InventoryListCategories.Purchased).ToString(),
                 Description = ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ListCategoryPurchased, "PURCHASED")
             },
             new ListItem
             {
                 Value       = ((int)CommonConstants.InventoryListCategories.Deactivated).ToString(),
                 Description = ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ListCategoryDeactivated, "DEACTIVATED")
             },
         };
         _selectedCategory = _categoriesList[0];
     });
 }
Esempio n. 2
0
 /// <summary>
 /// Deactivates a vehicle from the auction.
 /// </summary>
 async Task DeactivateFromAuction(object pVehicle)
 {
     await base.ExecuteMethodAsync($"DeactivateFromAuction({pVehicle})", async delegate()
     {
         if (pVehicle is Vehicle)
         {
             Vehicle curVehicle = (Vehicle)pVehicle;
             // Confirm
             string vConfirmationMessage = ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ConfirmRemoveFromAuctionNoBids, "Are you sure you want to remove the vehicle from the auction?");
             if (curVehicle.removefromauctioncost != null && curVehicle.removefromauctioncost > 0)
             {
                 vConfirmationMessage = string.Format(
                     ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ConfirmRemoveFromAuction, "If you deactivate this vehicle, which is in a live auction having a minimum of 1 bid and/or 1 offer, your account will be charged ${0} Are you sure you wish to continue?"),
                     curVehicle.removefromauctioncost
                     );
             }
             bool vUserConfirmed = await DialogService.ShowConfirmationAsync(vConfirmationMessage, Text_ADX365);
             if (vUserConfirmed)
             {
                 IsBusy = true;
                 CommonResponse serviceResp = await _vehicleService.RemoveFromAuction(curVehicle.Id);
                 IsBusy = false;
                 // Feedback.
                 if (serviceResp == null || !serviceResp.status)
                 {
                     // Feedback.
                     await DialogService.ShowAlertAsync(string.Format(Text_ServiceErrorDescriptionWithCode, (serviceResp == null) ? -1 : serviceResp.messageCode), Text_ServiceError, Text_Ok);
                 }
                 else
                 {
                     // Success
                     await DialogService.ShowAlertAsync(
                         ADX365App.GetLocalizedText(LanguageToken.INVENTORY_RemoveFromAuctionSuccess, "The vehicle was successfully deactivated from the auction."),
                         Text_Title,
                         Text_Ok
                         );
                     // Refresh.
                     await LoadData();
                 }
             }
         }
     });
 }
Esempio n. 3
0
 /// <summary>
 /// Reactivates the vehicle.
 /// </summary>
 async Task ReactivateVehicle(object pVehicle)
 {
     await base.ExecuteMethodAsync($"ReactivateVehicle({pVehicle})", async delegate()
     {
         if (pVehicle is Vehicle)
         {
             Vehicle curVehicle = (Vehicle)pVehicle;
             // Confirm
             bool vUserConfirmed = await DialogService.ShowConfirmationAsync(
                 string.Format(
                     ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ConfirmReactivate, "Do you wish to reactive the {0}?"),
                     curVehicle.FullVehicleName
                     ),
                 Text_ADX365
                 );
             if (vUserConfirmed)
             {
                 await UpdateVehicle(curVehicle);
             }
         }
     });
 }
Esempio n. 4
0
 /// <summary>
 /// Deactivates the vehicle.
 /// </summary>
 async Task DeactivateFromInventory(object pVehicle)
 {
     await base.ExecuteMethodAsync($"DeactivateFromInventory({pVehicle})", async delegate()
     {
         if (pVehicle is Vehicle)
         {
             Vehicle curVehicle = (Vehicle)pVehicle;
             // Confirm
             bool vUserConfirmed = await DialogService.ShowConfirmationAsync(
                 ADX365App.GetLocalizedText(LanguageToken.INVENTORY_ConfirmRemoveFromInventory, "Are you sure you want to deactivate this vehicle from your inventory?"),
                 Text_ADX365
                 );
             if (vUserConfirmed)
             {
                 IsBusy = true;
                 CommonResponse serviceResp = await _vehicleService.RemoveFromInventory(curVehicle.Id);
                 IsBusy = false;
                 // Feedback.
                 if (serviceResp == null || !serviceResp.status)
                 {
                     // Feedback.
                     await DialogService.ShowAlertAsync(string.Format(Text_ServiceErrorDescriptionWithCode, (serviceResp == null) ? -1 : serviceResp.messageCode), Text_ServiceError, Text_Ok);
                 }
                 else
                 {
                     // Success
                     await DialogService.ShowAlertAsync(
                         ADX365App.GetLocalizedText(LanguageToken.INVENTORY_RemoveFromInventorySuccess, "The vehicle was successfully deactivated from the inventory."),
                         Text_Title,
                         Text_Ok
                         );
                     // Refresh.
                     await LoadData();
                 }
             }
         }
     });
 }