Exemplo n.º 1
0
        public void setLogFile(string filePath)
        {
            try
            {
                string     logText = File.ReadAllText(filePath);
                List <Log> logs    = JsonConvert.DeserializeObject <List <Log> >(logText);
                model.addLog(logs);
            }

            catch (Exception ex)
            {
                loggerManager.AddLog("failed to deserialise file to logs", ex);
            }
        }
 public void ImportProducts(ICollection <ProductRequest> productsToImport, UserDTO userDTO)
 {
     NotifyObservers("Comienza la importación");
     loggerManager.AddLog(ESportLoggerUtils.IMPORT_PRODUCT_ACTION, userDTO.UserId, userDTO.UserName);
     foreach (var prodRequest in productsToImport)
     {
         NotifyObservers("Importación de producto: cod " + prodRequest.ProductId);
         ImportProducts(prodRequest);
         if (prodRequest.CategoryId != null)
         {
             ImportProductCategory(prodRequest);
         }
     }
     NotifyObservers("Finaliza Importación");
 }
Exemplo n.º 3
0
        private void Browse_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog();

            dialog.Filter = "JSON File|*.json";

            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                logController.setLogFile(dialog.FileName);
            }

            catch (Exception ex)
            {
                logger.AddLog("Failed to open Json File", ex);
            }
        }
Exemplo n.º 4
0
        public void AddLog_UnitTest()
        {
            loggerManager.AddLog("fooMessage");

            Assert.Equal("fooMessage", loggerManager.GetLogList()[0].Message);
        }