Example #1
0
 public CustomCommand(MainWindowViewModel viewmodel, ServiceProvider serviceProvider)
 {
     this.serviceProvider = serviceProvider;
     this.viewmodel       = viewmodel;
     //Making sure the models will be able to fire their commands and recognise the API
     addModel    = new AddCustomerModel(serviceProvider);
     deleteModel = new DeleteCustomerModel(serviceProvider);
     manageModel = new ManageCustomerModel(serviceProvider);
     //Empowering more intuitive DataGrids
     deleteModel.Api.GetTable <UserReadDto>("users");
     manageModel.Api.GetTable <UserReadDto>("users");
 }
Example #2
0
        public void VerifyCustomerServiceDeleteResponse()
        {
            WaitForKafkaResponseAfterDelete();

            if (DeleteCustomerModel.CustomerUID != null)
            {
                Assert.AreEqual(DeleteCustomerModel.CustomerUID, customerServiceDeleteResponse.DeleteCustomerEvent.CustomerUID);
            }
            if (DeleteCustomerModel.ActionUTC != null)
            {
                Assert.AreEqual(DeleteCustomerModel.ActionUTC.ToString("yyyyMMddHHmmss"), customerServiceDeleteResponse.DeleteCustomerEvent.ActionUTC.ToString("yyyyMMddHHmmss"));
            }

            customerServiceDeleteResponse = null; // Reassigning the response back to null
        }
Example #3
0
        public void Handle(PayloadMessage message)
        {
            try
            {
                if (message.Value == null || message.Value == "null")
                {
                    LogResult.Report(Log, "log_ForInfo", "Kafka Message is Null");
                    return;
                }

                if (CreateCustomerModel != null && CreateCustomerModel.ActionUTC != null)
                {
                    if (CreateCustomerModel.ActionUTC.ToString() != null && message.Value.Contains(CreateCustomerModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) && message.Value.Contains(CreateCustomerModel.ReceivedUTC.ToString()) &&
                        CreateCustomerModel.CustomerUID.ToString() != null && message.Value.Contains(CreateCustomerModel.CustomerUID.ToString()))
                    {
                        customerServiceCreateResponse = JsonConvert.DeserializeObject <CreateCustomerModel>(message.Value);
                    }
                    LogResult.Report(Log, "log_ForInfo", string.Format("Response Received With Offset {0}: {1}", message.OffSet, message.Value));

                    if (UpdateCustomerModel != null && UpdateCustomerModel.ActionUTC != null && UpdateCustomerModel.CustomerUID != Guid.Empty)
                    {
                        if (UpdateCustomerModel.ActionUTC.ToString() != null && message.Value.Contains(UpdateCustomerModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) && message.Value.Contains(UpdateCustomerModel.ReceivedUTC.ToString()) &&
                            UpdateCustomerModel.CustomerUID.ToString() != null && message.Value.Contains(UpdateCustomerModel.CustomerUID.ToString()))
                        {
                            customerServiceUpdateResponse = JsonConvert.DeserializeObject <UpdateCustomerModel>(message.Value);
                        }
                        LogResult.Report(Log, "log_ForInfo", string.Format("Response Received With Offset {0}: {1}", message.OffSet, message.Value));
                    }

                    if (DeleteCustomerModel != null && DeleteCustomerModel.ActionUTC != null && DeleteCustomerModel.CustomerUID != Guid.Empty)
                    {
                        if (DeleteCustomerModel.ActionUTC.ToString() != null && message.Value.Contains(DeleteCustomerModel.ActionUTC.ToString("yyyy-MM-ddTHH:mm:ss")) && message.Value.Contains(DeleteCustomerModel.ReceivedUTC.ToString()) &&
                            DeleteCustomerModel.CustomerUID.ToString() != null && message.Value.Contains(DeleteCustomerModel.CustomerUID.ToString()))
                        {
                            customerServiceDeleteResponse = JsonConvert.DeserializeObject <DeleteCustomerModel>(message.Value);
                        }
                        LogResult.Report(Log, "log_ForInfo", string.Format("Response Received With Offset {0}: {1}", message.OffSet, message.Value));
                    }
                }
            }
            catch (Exception e)
            {
                LogResult.Report(Log, "log_ForError", "Got Error While Handling Response", e);
                throw new Exception(e + "Got Error While Handling Response");
            }
        }
Example #4
0
        public IHttpActionResult DeleteCustomer(DeleteCustomerModel customerModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }
                customerService.DeleteCustomer(customerModel.UserId);

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }