コード例 #1
0
        public static void Run([HttpTrigger(AuthorizationLevel.Anonymous, "delete", Route = "Company/{id}")] HttpRequest req, string id, TraceWriter log)
        {
            log.Info("C# HTTP trigger function processed DeleteCompany.");
            if (_dataAccessRead.GetCompany(new Guid(id)) == null)
            {
                return;
            }
            var companyId = new Guid(id);
            var cars      = _dataAccessRead.GetCars().Where(c => c.CompanyId == companyId);

            foreach (var car in cars)
            {
                var deleteCar = new DeleteCar()
                {
                    CarId              = car.CarId,
                    CompanyId          = car.CompanyId,
                    DeleteCarTimeStamp = DateTime.Now.Ticks
                };
                _endpointInstance.Send(Helpers.ServerEndpoint, deleteCar).ConfigureAwait(false);
            }
            var message = new Shared.Messages.Commands.DeleteCompany
            {
                DataId    = new Guid(),
                CompanyId = companyId,
                DeleteCompanyTimeStamp = DateTime.Now.Ticks
            };

            _endpointInstance.Send(Helpers.ServerEndpoint, message).ConfigureAwait(false);
        }
コード例 #2
0
        public async Task DeleteCompany(string id)
        {
            if (GetCompany(id) == null)
            {
                return;
            }
            var companyId = new Guid(id);
            var cars      = _dataAccessRead.GetCars().Where(c => c.CompanyId == companyId);

            foreach (var car in cars)
            {
                var deleteCar = new DeleteCar()
                {
                    CarId              = car.CarId,
                    CompanyId          = car.CompanyId,
                    DeleteCarTimeStamp = DateTime.Now.Ticks
                };
                await _endpointInstance.Send(Helpers.ServerEndpoint, deleteCar).ConfigureAwait(false);
            }
            var message = new DeleteCompany
            {
                DataId    = new Guid(),
                CompanyId = companyId,
                DeleteCompanyTimeStamp = DateTime.Now.Ticks
            };

            await _endpointInstance.Send(Helpers.ServerEndpoint, message).ConfigureAwait(false);
        }
コード例 #3
0
        internal EditingContractorForm()
        {
            InitializeComponent();

            TSB_Censel.Click += (s, e) => Close();

            TSB_Save.Click += async(s, e) => await Save?.Invoke();

            TSB_AddV.Click += async(s, e) => await AddCar?.Invoke();

            TSB_EditV.Click += async(s, e) => await EditCar?.Invoke();

            TSB_RemoveV.Click += async(s, e) => await DeleteCar?.Invoke();

            TSB_AddCN.Click += async(s, e) => await AddContactPerson?.Invoke();

            TSB_EditCN.Click += async(s, e) => await EditContactPerson?.Invoke();

            TSB_RemoveCN.Click += async(s, e) => await DeleteContactPerson?.Invoke();

            DGV_Cars.MouseDoubleClick += async(s, e) => { if (e.Button == MouseButtons.Left)
                                                          {
                                                              await EditCar?.Invoke();
                                                          }
            };
            DGV_ContactPersones.MouseDoubleClick += async(s, e) => { if (e.Button == MouseButtons.Left)
                                                                     {
                                                                         await EditContactPerson?.Invoke();
                                                                     }
            };

            Load += EditingContractorForm_Load;
        }
コード例 #4
0
        public void Delete(DeleteCar request)
        {
            var car = _carService.Get(request.Id);

            if (car == null)
            {
                throw HttpError.NotFound($"Invalid CarId");
            }
            _carService.Remove(request.Id);
        }
コード例 #5
0
        public async Task DeleteCar(string id)
        {
            var oldCar = GetCar(id);

            if (oldCar == null)
            {
                return;
            }
            var deleteCar = new DeleteCar()
            {
                CarId              = new Guid(id),
                CompanyId          = oldCar.CompanyId,
                DeleteCarTimeStamp = DateTime.Now.Ticks
            };
            await _endpointInstance.Send(Helpers.ServerEndpoint, deleteCar).ConfigureAwait(false);
        }
コード例 #6
0
        public void GivenTheseExistingCars(Table table)
        {
            table.Rows.ForEach(values =>
            {
                _actor.AttemptsTo(DeleteCar.ByRegistration(values["Registration"]));

                int customerId = _actor.AsksFor(
                    values.ContainsKey("Customer") ? StoredCustomerId.ForName(values["Customer"]) : StoredCustomerId.First());

                _actor.AttemptsTo(
                    InsertCar.WithRegistration(values["Registration"])
                    .ForCustomer(customerId)
                    .WithMake(values["Make"])
                    .WithModel(values["Model"]));
            });
        }
コード例 #7
0
        public void GivenTheFollowingExistingCar(Table table)
        {
            var values = table.Rows.Single();

            _actor.AttemptsTo(DeleteCar.WithRegistration(values["Registration"]));

            int customerId = _actor.AsksFor(StoredCustomerId.ForName(values["Customer"]));

            _actor.AttemptsTo(
                InsertCar.WithRegistration(values["Registration"])
                .ForCustomer(customerId)
                .WithMake(values.GetStringOrDefault("Make"))
                .WithModel(values.GetStringOrDefault("Model"))
                .MotExpiringOn(values.GetDateOrDefault("MOT Expiry"))
                .SuppressingMotReminder(values.GetBoolOrDefault("Suppress MOT Reminder")));

            _storedCar = _actor.AsksFor(StoredCar.WithRegistration(values["Registration"]));
        }
コード例 #8
0
 public void GivenThereIsNoCarWithRegistration(string registration)
 {
     _actor.AttemptsTo(DeleteCar.WithRegistration(registration));
 }
コード例 #9
0
 public Task <CommandResult> Do(DeleteCar command)
 {
     throw new System.NotImplementedException();
 }