예제 #1
0
 internal static void SetServiceHistoryToServiceHistoryViewModel(ServiceHistoryViewModel viewModel, ServiceHistory model)
 {
     viewModel.Address                = model.Address;
     viewModel.Code                   = model.Code;
     viewModel.Cost                   = model.Cost;
     viewModel.Coordination           = model.Coordination;
     viewModel.CityName               = model.CityName;
     viewModel.Date                   = model.Date;
     viewModel.DoctorName             = model.DoctorName;
     viewModel.FileCode               = model.FileCode;
     viewModel.ServiceNumber          = model.ServiceNumber;
     viewModel.ServiceType            = model.ServiceType;
     viewModel.ServiceTypeDescription = model.ServiceTypeDescription;
     viewModel.SpecialityName         = model.SpecialityName;
     viewModel.Cancelable             = model.Cancelable;
     viewModel.DescriptionState       = model.DescriptionState;
     viewModel.Canceled               = model.Canceled;
     if (model.ServiceType == ServiceType.DoctorHome && string.IsNullOrEmpty(model.CodeState) == false)
     {
         viewModel.Canceled = (int.Parse(model.CodeState) == (int)StatusServices.InAtention || int.Parse(model.CodeState) == (int)StatusServices.Cancel) ? true : false;
     }
     viewModel.IdService           = model.IdService;
     viewModel.UserName            = model.UserName;
     viewModel.UserDocument        = model.UserDocument;
     viewModel.UserDocumentType    = model.UserDocumentType;
     viewModel.UserDocumentTypeStr = model.UserDocumentTypeStr;
 }
예제 #2
0
 private async void ValidateResponseSheduledServices(ResponseSheduledServices response)
 {
     ScheduledServices = new ObservableCollection <ServiceHistoryViewModel>();
     if (response.Success)
     {
         if (response.StatusCode == 0)
         {
             if (response.ServiceHistory.Count > 0)
             {
                 foreach (ServiceHistory service in response.ServiceHistory)
                 {
                     ServiceHistoryViewModel serviceHistoryViewModel = new ServiceHistoryViewModel();
                     ViewModelHelper.SetServiceHistoryToServiceHistoryViewModel(serviceHistoryViewModel, service);
                     ScheduledServices.Add(serviceHistoryViewModel);
                 }
             }
             else
             {
                 await dialogService.ShowMessage(AppResources.TitleSheduledServices, "No se encontraron servicios programados.");
             }
             await currentServiceViewViewModel.GetMedicalHomeService();
         }
         else
         {
             await dialogService.ShowMessage(response.Title, response.Message);
         }
     }
 }
예제 #3
0
        // end queries

        // Maintenance card control

        public ServiceHistoryViewModel GetServiceHistoryViewModel(int id)
        {
            var result = new ServiceHistoryViewModel();
            var auto   = context.Automobiles.FirstOrDefault(a => a.Id == id);

            result.DRN   = auto.DRN;
            result.Brand = new BrandViewModel()
            {
                Name = auto.Engine.CarModel.CarBrand.Name,
                Id   = auto.Engine.CarModel.Id
            };

            result.Model = new CarModelViewModel()
            {
                Name = auto.Engine.CarModel.Name,
                Id   = auto.Engine.CarModel.Id
            };

            result.Volume = auto.Engine.Volume;
            result.HP     = auto.Engine.Horsepower;

            return(result);
        }
 private async void ValidateResponseServicesHistory(ResponseServicesHistory response)
 {
     if (response.Success && response.StatusCode == 0)
     {
         if (response.ServicesHistory != null && response.ServicesHistory.Count > 0)
         {
             ServicesHistory = new ObservableCollection <ServiceHistoryViewModel>();
             foreach (ServiceHistory service in response.ServicesHistory)
             {
                 ServiceHistoryViewModel viewModel = new ServiceHistoryViewModel
                 {
                     UserName               = service.UserName,
                     UserDocumentTypeStr    = service.UserDocumentTypeStr,
                     UserDocument           = service.UserDocument,
                     ServiceTypeDescription = service.ServiceTypeDescription,
                     SpecialityName         = service.SpecialityName,
                     DoctorName             = service.DoctorName,
                     Date = service.Date,
                     //CityName = service.CityName,
                     FileCode      = service.FileCode,
                     ServiceNumber = service.ServiceNumber,
                     Address       = service.Address
                 };
                 ServicesHistory.Add(viewModel);
             }
             await navigationService.Navigate(Enumerations.AppPages.ServicesHistoryPage);
         }
         else
         {
             await dialogService.ShowMessage(AppResources.TitleServicesHistory, "No se han encontrado resultados para tu búsqueda.");
         }
     }
     else
     {
         await dialogService.ShowMessage(response.Title, response.Message);
     }
 }