private void OnCreateClient() { if (CreateClient != null) { CreateClient.DynamicInvoke(new object[] { this, EventArgs.Empty }); } }
public void Any(CreateClient request) { using (var db = DbFactory.OpenDbConnection()) { db.Insert(request.Client); } }
public async Task <IActionResult> PostCreateClient(CreateClient ClientViewData) { if (ModelState.IsValid) { Address address = new Address { Street = ClientViewData.Address.Street, Apartment = ClientViewData.Address.Apartment, City = ClientViewData.Address.City, Country = ClientViewData.Address.Country, State = ClientViewData.Address.State, Zip = ClientViewData.Address.Zip }; _context.Add(address); Client client = new Client { Name = ClientViewData.Name, Email = ClientViewData.Email, Phone = ClientViewData.Phone, Address = address }; _context.Add(address); _context.Add(client); await _context.SaveChangesAsync(); } return(RedirectToAction("Index")); }
public ActionResult Create() { var formModel = new CreateClient(); formModel.IsActivated = true; return(View(formModel)); }
public Client() { Create = new CreateClient(); Search = new SearchClient(); Update = new UpdateClient(); Delete = new DeleteClient(); }
public Client(CreateClient create, SearchClient search, UpdateClient update, DeleteClient delete) { Create = create; Search = search; Update = update; Delete = delete; }
public async Task ClientFlowTests() { // prepare command var command = new CreateClient( Guid.NewGuid(), new ClientInfo("*****@*****.**", "test")); // send create command var commandResponse = await sut.Client.PostAsync(ApiUrl, command.ToJsonStringContent()); commandResponse.EnsureSuccessStatusCode(); commandResponse.StatusCode.Should().Be(HttpStatusCode.Created); // get created record id var commandResult = await commandResponse.Content.ReadAsStringAsync(); commandResult.Should().NotBeNull(); var createdId = commandResult.FromJson <Guid>(); // prepare query var query = new GetClient(createdId); //send query var queryResponse = await sut.Client.GetAsync(ApiUrl + $"/{createdId}/view"); var queryResult = await queryResponse.Content.ReadAsStringAsync(); queryResponse.Should().NotBeNull(); var clientView = queryResult.FromJson <ClientView>(); clientView.Id.Should().Be(createdId); clientView.Name.Should().Be(command.Data.Name); }
private void toolStripButton1_Click(object sender, EventArgs e) { if (treeView1.SelectedNode.Parent != null) { if (currentEntity == ClientName) { CreateClient createClient = new CreateClient(); createClient.ShowDialog(); } if (currentEntity == ContractName) { CreateContract createContract = new CreateContract(); createContract.ShowDialog(); } if (currentEntity == PaymentName) { CreatePayment createPayment = new CreatePayment(); createPayment.ShowDialog(); } if (currentEntity == RentName) { CreateRent createRent = new CreateRent(); createRent.ShowDialog(); } if (currentEntity == TradePointName) { CreateTradePoint createTradePoint = new CreateTradePoint(); createTradePoint.ShowDialog(); } grid.Refresh(); } }
protected override void OnStart(string[] args) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Thread.CurrentThread.Name = "TPM_TrakSmartDataService_Phantom"; if (!Directory.Exists(appPath + "\\Logs\\")) { Directory.CreateDirectory(appPath + "\\Logs\\"); } if (!Directory.Exists(appPath + "\\TPMFiles\\")) { Directory.CreateDirectory(appPath + "\\TPMFiles\\"); } List <MachineInfoDTO> machines = DatabaseAccess.GetTPMTrakMachine(); if (machines.Count == 0) { Logger.WriteDebugLog("No machine is enabled for TPM-Trak. modify the machine setting and restart the service."); return; } try { foreach (MachineInfoDTO machine in machines) { //MachineInfoDTO machine = machines[0]; //g: test CreateClient client = new CreateClient(machine); clients.Add(client); ThreadStart job = new ThreadStart(client.GetClient); Thread thread = new Thread(job); thread.Name = SafeFileName(machine.MachineId); thread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); thread.Start(); threads.Add(thread); Logger.WriteDebugLog(string.Format("Machine {0} started for DataCollection", machine.MachineId)); } } catch (Exception e) { Logger.WriteErrorLog(e.ToString()); } try { ThreadStart job = new ThreadStart(ProcessFinalInspection); Thread thread = new Thread(job); thread.Name = SafeFileName("FinalInspection"); thread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); thread.Start(); threads.Add(thread); Logger.WriteDebugLog(string.Format("Final Inspection started Successfully")); } catch (Exception e) { Logger.WriteErrorLog(e.ToString()); } }
public async Task <IActionResult> Post([FromBody] CreateClient command) { command.Id = command.Id ?? Guid.NewGuid(); await _commandBus.Send(command); return(Created("api/Clients", command.Id)); }
public ActionResult Create() { CreateClient client = new CreateClient(); client.IsActivated = true; return(View("Create", client)); }
private void RetailSaleProcessCreated(RetailSaleProcessCreated retailSaleProcessCreated) { string name = string.Empty; var createClient = new CreateClient(retailSaleProcessCreated.ProcessActor, name); clientProcessorActor.Tell(createClient); }
public IActionResult Create() { var model = new CreateClient { }; return(View("CreateClient", model)); }
public RegisteredClient Create(CreateClient newRegister) { using (DocumentContext db = new DocumentContext()) { Client clientEntity = newRegister.ToEntity(); db.Clients.Add(clientEntity); db.SaveChanges(); return(clientEntity.ToDTO()); } }
private void CreateClient(CreateClient createClient) { logger.Info("Create client (Name: {0})", createClient.Name); string id = clientProcessorService.Create(null); var clientCreated = new ClientCreated(createClient.ProcessActor, id); Sender.Tell(clientCreated); }
public GetString2(CreateClient createClient) { if (createClient == null) { throw new ArgumentNullException(nameof(createClient)); } Client = createClient("test", (o) => { o.BaseUrl = o.BaseUrl with { Host = "Hi" }; }); }
public ActionResult Create() { // Create a client form model and set it's // active flag to true because we want them // to be active by default. CreateClient client = new CreateClient(); client.IsActivated = true; return(View("Create", client)); }
internal static ButtplugFFIClientHandle SendCreateClient(string aClientName, ButtplugCallback aCallback) { var builder = new FlatBufferBuilder(1024); var client_name = builder.CreateString(aClientName); var create_client_msg = CreateClient.CreateCreateClient(builder, client_name); builder.Finish(create_client_msg.Value); var buf = builder.SizedByteArray(); return(ButtplugFFICalls.buttplug_create_client(aCallback, buf, buf.Length)); }
public static IClient CreateClient(this CreateClient clientFactory, string name, Uri baseUri) { if (clientFactory == null) { throw new ArgumentNullException(nameof(clientFactory)); } var client = clientFactory(name); client.BaseUri = baseUri; return(client); }
public ExternalUserService(IOptions <ExternalServicesOptionsConfig> externalServicesOptions, CreateClient createClient, IErrorService errorService) { _externalServicesOptionsConfig = externalServicesOptions.Value; _client = _client = createClient("Oath2Client", o => { o.BaseUrl = _externalServicesOptionsConfig.UserService.Url.ToAbsoluteUrl(); o.DefaultRequestHeaders = HeaderCollectionUtils.JsonHeadersDefault; }); _errorService = errorService; }
public async Task <ActionResult <OutbackClient> > Create([Required] CreateClient createClient) { var clientId = Guid.NewGuid().ToString(); await _clientService.CreateNewClient(clientId, createClient.ClientName, createClient.Description, createClient.FamilyId, createClient.ClientType); var client = await _clientService.GetClient(clientId); return(CreatedAtAction(nameof(GetById), new { id = clientId }, client)); }
public async Task <IActionResult> CreateAccount(CreateClient command) { if (ModelState.IsValid) { await _dispatcher.Dispatch(command); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
internal static Task <ServerMessage> SendClientMessage(ButtplugFFIMessageSorter aSorter, ButtplugFFIClientHandle aHandle, FlatBufferBuilder aBuilder, ClientMessageType aType, int aOffset) { ClientMessage.StartClientMessage(aBuilder); ClientMessage.AddMessageType(aBuilder, aType); ClientMessage.AddMessage(aBuilder, aOffset); var task = aSorter.PrepareClientMessage(aBuilder); var create_client_msg = CreateClient.EndCreateClient(aBuilder); aBuilder.Finish(create_client_msg.Value); var buf = aBuilder.SizedByteArray(); ButtplugFFICalls.buttplug_parse_client_message(aHandle, buf, buf.Length); return(task); }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void Execute(object sender, EventArgs e) { var dte = (EnvDTE.DTE) this.ServiceProvider.GetServiceAsync(typeof(EnvDTE.DTE)).Result; object activeSolutionProject = dte.SelectedItems.Item(1); var project = activeSolutionProject as EnvDTE.SelectedItem; if (project != null) { var dialog = new CreateClient(); dialog.ProjectFileName = project.Project.FileName; dialog.ShowDialog(); } }
public ActionResult Create(CreateClient formModel) { var repo = new ClientRepository(_context); try { Client newClient = new Client(formModel.Name, formModel.IsActivated); repo.Insert(newClient); return(RedirectToAction("Index")); } catch { ModelState.AddModelError("Name", "Unable to add client."); } return(View(formModel)); }
public ActionResult Create(CreateClient formModel) { var repository = new ClientRepo(context); try { var client = new Client(0, formModel.Name, formModel.IsActivated); repository.Insert(client); return(RedirectToAction("Index")); } catch (DbUpdateException ex) { HandleDbUpdateException(ex); } return(View("Create", formModel)); }
public ActionResult Create(CreateClient client) { ClientRepository repo = new ClientRepository(context); try { Client newClient = new Client(0, client.Name, client.IsActivated); repo.Insert(newClient); return(RedirectToAction("Index")); } catch (DbUpdateException ex) { HandleDbUpdateException(ex); } return(View("Create", client)); }
public OnvifServiceClient(BaseOnvifTest test_, string serviceName_, ServiceAddressRetrievalMethod serviceAddressRetrievalAction_, SetupSecurity setupSecurityAction_, SetupChannel setupChannelAction_, CreateClient <ServicePortClient> createClientAction_) { Test = test_; ServiceName = serviceName_; ServiceAddressRetrievalAction = serviceAddressRetrievalAction_; SetupSecurityAction = setupSecurityAction_; SetupChannelAction = setupChannelAction_; CreateClientAction = createClientAction_; Test.SecurityChangedEvent += e => this.Close(); Test.NetworkSettingsChangedEvent += address => this.Close(); }
static public Client ToEntity(this CreateClient createClient) { if (isNotValidType(createClient.Type)) { throw new Exception("Client type is not recoignizeW"); } return(new Client() { ClienType = createClient.Type.Equals("Natural") ? ClientType.Person : ClientType.Company, Address = createClient.Address, Name = createClient.Name, DocumentNumber = createClient.DocumentNumber, Email = createClient.Email, Phone = createClient.Phone }); }
protected override void OnStart(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); try { Logger.WriteDebugLog("Starting Service."); CreateClient C1 = new CreateClient(); ThreadStart job = new ThreadStart(C1.GetClient); tr = new Thread(job); tr.Name = "ScheduledReport"; tr.Start(); Logger.WriteDebugLog("Service thread has been started."); } catch (Exception e) { Logger.WriteErrorLog(e.ToString()); } }