コード例 #1
0
        public override void Execute(object parameter)
        {
            var treatments = QueryManager.GetAllTreatments(out var treatmentMessage);

            if (!treatmentMessage.IsSuccess())
            {
                MessageBoxer.Info(treatmentMessage.Data);
                return;
            }

            var mainWindowVm  = (MainWindowVm)parameter;
            var callVaccineVm = new CallTreatmentWindowVm
            {
                Treatments = treatments,
                Animal     = mainWindowVm.SelectedAnimal
            };

            var callTreatmentWindow = new CallTreatmentWindow {
                DataContext = callVaccineVm
            };

            if (callTreatmentWindow.ShowDialog() != true)
            {
                return;
            }

            var callDto           = CallMapper.MapCallTreatmentWindowVmToCallDto(callVaccineVm);
            var callCreateMessage = QueryManager.CreateTreatmentCall(callDto);

            if (!callCreateMessage.IsSuccess())
            {
                MessageBoxer.Info(callCreateMessage.Data);
            }
        }
コード例 #2
0
 public static void MapUpdate(Rate rate, RateDto dto)
 {
     rate.Name         = dto.Name;
     rate.Call         = CallMapper.Map(dto.Call);
     rate.Sms          = SmsMapper.Map(dto.Sms);
     rate.Internet     = InternetMapper.Map(dto.Internet);
     rate.Roaming      = RoamingMapper.Map(dto.Roaming);
     rate.HomeInternet = HomeInternetMapper.Map(dto.HomeInternet);
 }
コード例 #3
0
        public CfCallQueryResult QueryCalls(CfActionQuery cfQueryCalls)
        {
            var resourceList = BaseRequest <ResourceList>(HttpMethod.Get, new ActionQuery(cfQueryCalls),
                                                          new CallfireRestRoute <Call>());

            var call = resourceList.Resource == null ? null
               : resourceList.Resource.Select(r => CallMapper.FromCall((Call)r)).ToArray();

            return(new CfCallQueryResult(resourceList.TotalResults, call));
        }
コード例 #4
0
 public static Rate Map(RateDto dto)
 {
     return(new Rate
     {
         Id = dto.Id,
         Name = dto.Name,
         Call = CallMapper.Map(dto.Call),
         Sms = SmsMapper.Map(dto.Sms),
         Internet = InternetMapper.Map(dto.Internet),
         Roaming = RoamingMapper.Map(dto.Roaming),
         HomeInternet = HomeInternetMapper.Map(dto.HomeInternet),
     });
 }
コード例 #5
0
        public override void Execute(object parameter)
        {
            var mainWindowVm     = (MainWindowVm)parameter;
            var selectedAnimalVm = mainWindowVm.SelectedAnimal;

            var vaccines = QueryManager.GetVaccinesByBreedId(selectedAnimalVm.BreedId, out var vaccinesMessage)
                           .Select(GraphicMapper.MapGraphicDtoToVaccineVm)
                           .ToList();

            if (!vaccinesMessage.IsSuccess())
            {
                MessageBoxer.Info(vaccinesMessage.Data);
                return;
            }

            var callVaccineVm = new CallVaccineWindowVm
            {
                Vaccines  = vaccines,
                VaccineId = vaccines.FirstOrDefault()?.Id ?? 0,
                Animal    = selectedAnimalVm
            };

            var callVaccineWindow = new CallVaccineWindow {
                DataContext = callVaccineVm
            };

            if (callVaccineWindow.ShowDialog() != true)
            {
                return;
            }

            var callDto           = CallMapper.MapCallVaccineWindowVmToCallDto(callVaccineVm);
            var callCreateMessage = QueryManager.CreateVaccineCall(callDto);

            if (!callCreateMessage.IsSuccess())
            {
                MessageBoxer.Info(callCreateMessage.Data);
            }
        }
コード例 #6
0
 public CfCall GetCall(long id)
 {
     return(CallMapper.FromCall(CallService.GetCall(new IdRequest(id))));
 }
コード例 #7
0
        public CfCall GetCall(long id)
        {
            var resource = BaseRequest <Resource>(HttpMethod.Get, null, new CallfireRestRoute <Call>(id));

            return(CallMapper.FromCall(resource.Resources as Call));
        }