public async Task <IActionResult> CreateDatabase(int customerSettingsid, string element)
        {
            try
            {
                var _customerSettings = _repository.Get()
                                        .Include(c => c.Customer)
                                        .Include(p => p.Product)
                                        .Where(x => x.CustomersProductsId == customerSettingsid).First();

                string message = null;
                string dirPath = @"C:\Celta Business Solutions\" + _customerSettings.Customer.RootDirectory + @"\temp\cip\database\";
                string command = "CeltaWare.CBS.CAT.ExecuteSqlScripts.exe ";
                string arg1    = "\"" + _customerSettings.IpAddress + "," + _customerSettings.Port + "\""
                                 + " " + _customerSettings.SynchronizerServiceName
                                 + " " + _customerSettings.LoginUser
                                 + " " + _customerSettings.LoginPassword
                                 + " " + element + " 0";

                message = await UpdateDatabase.Execute(dirPath, command, arg1);

                if (message.Contains("Error in file") || message.Contains("Error: Unknown"))
                {
                    return(NotFound(message));
                }
                return(Ok(message));
            }
            catch (Exception err)
            {
                return(NotFound(err.Message));
            }
        }
Ejemplo n.º 2
0
        public LogHandler()
        {
            var logBookEntityModel = new LogBookEntityModel();

            UpdateDatabase.Execute();

            _writeService = new WriteService(logBookEntityModel);
            _readService  = new ReadService(logBookEntityModel);
        }