private void OnCreateClient()
 {
     if (CreateClient != null)
     {
         CreateClient.DynamicInvoke(new object[] { this, EventArgs.Empty });
     }
 }
예제 #2
0
 public void Any(CreateClient request)
 {
     using (var db = DbFactory.OpenDbConnection())
     {
         db.Insert(request.Client);
     }
 }
예제 #3
0
        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"));
        }
예제 #4
0
        public ActionResult Create()
        {
            var formModel = new CreateClient();

            formModel.IsActivated = true;
            return(View(formModel));
        }
예제 #5
0
 public Client()
 {
     Create = new CreateClient();
     Search = new SearchClient();
     Update = new UpdateClient();
     Delete = new DeleteClient();
 }
예제 #6
0
 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);
        }
예제 #8
0
 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();
     }
 }
예제 #9
0
        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));
        }
예제 #11
0
        public ActionResult Create()
        {
            CreateClient client = new CreateClient();

            client.IsActivated = true;

            return(View("Create", client));
        }
예제 #12
0
        private void RetailSaleProcessCreated(RetailSaleProcessCreated retailSaleProcessCreated)
        {
            string name = string.Empty;

            var createClient = new CreateClient(retailSaleProcessCreated.ProcessActor, name);

            clientProcessorActor.Tell(createClient);
        }
예제 #13
0
        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());
     }
 }
예제 #15
0
        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);
        }
예제 #16
0
 public GetString2(CreateClient createClient)
 {
     if (createClient == null)
     {
         throw new ArgumentNullException(nameof(createClient));
     }
     Client = createClient("test", (o) => { o.BaseUrl = o.BaseUrl with {
                                                Host = "Hi"
                                            }; });
 }
예제 #17
0
        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));
        }
예제 #18
0
        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);
        }
예제 #20
0
 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;
 }
예제 #21
0
        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));
        }
예제 #22
0
        public async Task <IActionResult> CreateAccount(CreateClient command)
        {
            if (ModelState.IsValid)
            {
                await _dispatcher.Dispatch(command);

                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Index"));
        }
예제 #23
0
        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);
        }
예제 #24
0
        /// <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();
            }
        }
예제 #25
0
        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));
        }
예제 #27
0
        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));
        }
예제 #28
0
        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
            });
        }
예제 #30
0
 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());
     }
 }