private void btnQuitar_Click(object sender, EventArgs e) { if (metroGrid1.SelectedRows.Count > 0) { try { string idARemover = GetId(); usuario.Permisos.RemoveAll(x => x.IdFamiliaElement == idARemover); IReadOnlyList <Entities.UFP.FamiliaElement> ToRemove = bind.Where(x => (x.IdFamiliaElement == idARemover)).ToList(); foreach (var d in ToRemove) { bind.Remove(d); } MostrarPermisosEstructura(); } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } } else { Notifications.FrmInformation.InformationForm(Helps.Language.SearchValue("infoSelecEditar")); } }
public async Task <IActionResult> Post([FromBody] CreateLog command) { command.Id = Guid.NewGuid().ToString(); await _busClient.PublishAsync(command); return(Accepted($"logging /{command.Id}")); }
public async Task <DataTable> Create(CreateLog logMessage, User creator) { using (var command = _context.Database.GetDbConnection().CreateCommand()) { var requestId = new SqlParameter("@RequestId ", logMessage.RequestId); var updatedField = new SqlParameter("@UpdatedField", logMessage.UpdatedField); var updatedState = new SqlParameter("@UpdatedState", logMessage.UpdatedState); var previousState = new SqlParameter("@PreviousState", logMessage.PreviousState); var message = new SqlParameter("@Message", (creator.FirstName + ' ' + creator.LastName)); var createBy = new SqlParameter("@CreatedBy", logMessage.CreatedBy); // var commandText = "exec getListServerFilter @filterKey"; command.CommandText = "CreateHistoryLog"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(requestId); command.Parameters.Add(updatedField); command.Parameters.Add(updatedState); command.Parameters.Add(previousState); command.Parameters.Add(message); command.Parameters.Add(createBy); DataTable dt = new DataTable(); _context.Database.OpenConnection(); dt.Load(command.ExecuteReader()); return(dt); } }
public async Task HandleAsync(ProcessPayment command) { try { var acquirerCommand = await _paymentService.ProcessAsync(command); await _busClient.PublishAsync(acquirerCommand); var logCreated = new CreateLog(command.UserId, command.PaymentId, LogLevel.Info, "Process_Payment_2", "Sent Process Payment Request to " + acquirerCommand.AquirerName + " Service"); await _busClient.PublishAsync(logCreated); return; } catch (Exception ex) { var failed = new PaymentFailed("error", ex.Message); command.CopyPayment(failed); await _busClient.PublishAsync(failed); var logCreated = new CreateLog(command.UserId, command.PaymentId, LogLevel.Error, "Process_Payment_Failed", "Process Payment Failed "); await _busClient.PublishAsync(logCreated); } }
private void BtnGuardar_Click(object sender, EventArgs e) { try { BLL.UFP.Usuario.Update(usuario); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Update, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Usuario: " + usuario.Nombre, "", "")); Notifications.FrmSuccess.SuccessForm(Helps.Language.SearchValue("editadoOK")); MostrarPermisosEstructura(); } catch (Exception ex) { if (ex.Message == EValidaciones.existe) { Notifications.FrmError.ErrorForm(Helps.Language.SearchValue("errorExiste")); } else { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.UpdateError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Usuario: " + usuario.Nombre, ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Helps.Language.SearchValue("editadoError") + "\n" + ex.Message); } } }
/// <summary> /// elimina un registro seleccionado /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnEliminar_Click(object sender, EventArgs e) { if (metroGrid1.SelectedRows.Count > 0) { int idCat = GetId(); Entities.Categoria categoria = bll.GetById(idCat); try { DialogResult confirmation = new Notifications.FrmQuestion(Language.SearchValue("preguntaEliminar")).ShowDialog(); if (confirmation == DialogResult.OK) { bll.Delete(idCat); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Delete, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Categoria: " + categoria.categoria, "", "")); RefrescarTabla(); Notifications.FrmSuccess.SuccessForm(Language.SearchValue("eliminadoOK")); } } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.DeleteError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Categoria: " + categoria.categoria, ex.StackTrace, ex.Message)); RefrescarTabla(); Notifications.FrmError.ErrorForm(Language.SearchValue("eliminadoError") + "\n" + ex.Message); } } else { Notifications.FrmInformation.InformationForm(Language.SearchValue("XinfoSelecEliminar")); } }
private void BtnAnular_Click(object sender, EventArgs e) { if (metroGrid1.SelectedRows.Count > 0) { int?idEntity = GetId(); Entities.Doc_cabecera_egreso entity = bllCabecera.GetById(Convert.ToInt32(idEntity)); entity.listDetalle = bllDetalle.ListDetallesByCabecera(entity.id); try { DialogResult confirmation = new Notifications.FrmQuestion(Helps.Language.SearchValue("preguntaEliminar")).ShowDialog(); if (confirmation == DialogResult.OK) { bllCabecera.Anular(entity); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Delete, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Ingreso anulado: " + entity.factura, "", "")); RefrescarTabla(); Notifications.FrmSuccess.SuccessForm(Helps.Language.SearchValue("eliminadoOK")); } } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.DeleteError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Ingreso anulado: " + entity.factura, ex.StackTrace, ex.Message)); RefrescarTabla(); Notifications.FrmError.ErrorForm(Helps.Language.SearchValue("eliminadoError") + "\n" + ex.Message); } RefrescarTabla(); } else { Notifications.FrmInformation.InformationForm(Helps.Language.info["infoSelecEliminar"]); } }
private void btnQuitar_Click(object sender, EventArgs e) { if (metroGrid1.SelectedRows.Count > 0) { try { Patente patente = BLL.UFP.Patente.GetAdapted(GetId()); familia.Remove(patente); IReadOnlyList <FamiliaElement> ToRemove = bind.Where(x => (x.IdFamiliaElement == patente.IdFamiliaElement)).ToList(); foreach (var d in ToRemove) { bind.Remove(d); } } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } } else { Notifications.FrmInformation.InformationForm(Helps.Language.SearchValue("infoSelecEditar")); } }
public async Task AddLogAsync(CreateLog log) { await Task.Factory.StartNew(() => { AddLog(log); }); }
public async Task HandleAsync(PaymentProcessed @event) { try { await _historyService.SaveAsync(@event); var logCreated = new CreateLog(@event.UserId, @event.PaymentId, LogLevel.Info, "Process_Payment_5", "Saved Processed Payment"); await _busClient.PublishAsync(logCreated); var historyCreatedEvent = new PaymentHistoryCreated(); @event.CopyPayment(historyCreatedEvent); historyCreatedEvent.AcquirerPaymentId = @event.AcquirerPaymentId; historyCreatedEvent.Processed = true; historyCreatedEvent.ProcessedAt = @event.ProcessedAt; historyCreatedEvent.Status = @event.Status; await _busClient.PublishAsync(historyCreatedEvent); } catch (Exception ex) { var logCreated = new CreateLog(@event.UserId, @event.PaymentId, LogLevel.Error, "Save_Payment_Failed", "Cannot save Failed payment because :" + ex.Message); await _busClient.PublishAsync(logCreated); } }
private bool DeleteYoutubeVideo(string youtubeVideoCode) { String clientsecretkeypath = HttpContext.Current.Server.MapPath("~/client_secrets.json"); var cred = GetUserCredential(clientsecretkeypath); var youtubeService = new YouTubeService(new BaseClientService.Initializer() { HttpClientInitializer = cred, ApplicationName = Assembly.GetExecutingAssembly().GetName().Name }); try { var parameters = new Dictionary <string, object>(); parameters.Add("id", youtubeVideoCode); var videosDeleteRequest = youtubeService.Videos.Delete(parameters["id"].ToString()); videosDeleteRequest.Execute(); } catch (Exception ex) { CreateLog err = new CreateLog(); CreateLog.CreateLogFiles(); err.ErrorLog(Server.MapPath("/Logs/ErrorLog.txt"), ex.Message); } return(true); }
protected void btnupload_Click(object sender, EventArgs e) { try { Upldmtrl.Visible = false; string fileext = System.IO.Path.GetExtension(Upldmtrl.FileName).ToLower(); // stores extension of the uploaded file. string filename = Upldmtrl.FileName; // store name of the uploade file in filename. filename = filename.Remove(filename.Length - 4); Session["title"] = filename; Upldmtrl.SaveAs(Server.MapPath("/Upload/Videos/") + Upldmtrl.FileName); string filepath = Server.MapPath("/Upload/Videos/") + Upldmtrl.FileName; Session["file"] = filepath; UploadVideos(Upldmtrl.FileContent, Upldmtrl.PostedFile.ContentType, Upldmtrl.FileName, filepath); int lessonid = (int)Session["lessonid"]; int subjectid = (int)Session["subjectid"]; int classid = (int)Session["classid"]; string title = Convert.ToString(Session["title"]); int filesize = Upldmtrl.PostedFile.ContentLength; if (Session["uploadcompleted"] != null) { string videoid = Session["videoid"].ToString(); if (UserBL.VideoMaterial(2, classid, subjectid, lessonid, videoid, title)) { string FileToDelete = Convert.ToString(Session["file"]); //Delete temporary video after uploading to youtube. System.IO.File.Delete(FileToDelete); Label lbl = new Label(); lbl.Text = Convert.ToString(Session["uploadcompleted"]); fillVidgrid(); show = "upload"; Response.Redirect(Request.RawUrl, false); } else { show = "failure"; Response.Redirect(Request.RawUrl); } } } catch (Exception ex) { CreateLog err = new CreateLog(); CreateLog.CreateLogFiles(); err.ErrorLog(Server.MapPath("/Logs/ErrorLog.txt"), ex.Message); } finally { lblclassname.Visible = false; ddlClass.Visible = false; lblSubject.Visible = false; ddlsubject.Visible = false; lblchapter.Visible = false; ddllesson.Visible = false; lblbrowseFile.Visible = false; Upldmtrl.Visible = false; btnupload.Visible = false; lblVidDescription.Visible = false; txtVidDescription.Visible = false; } }
private void QuitarTablaDetalle() { if (metroGrid1.SelectedRows.Count > 0) { try { int id_prod = GetIdProdEnGridDetalle(); IReadOnlyList <Entities.Producto> detalleToRemove = bingindList.Where(x => (x.id == id_prod)).ToList(); foreach (var d in detalleToRemove) { total -= d.precio * d.cantidad; bingindList.Remove(d); listProd.Remove(d); } } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } } else { Notifications.FrmInformation.InformationForm(Helps.Language.SearchValue("infoSelecEliminar")); } }
public async Task HandleAsync(ProcessPiggyPayment command) { try { var logCreated = new CreateLog(command.UserId, command.PaymentId, LogLevel.Info, "Process_Payment_3", "Sent Process Payment Request to Piggy Bank API"); await _busClient.PublishAsync(logCreated); var paymentProcessed = await _piggyService.ProcessAsync(command); await _busClient.PublishAsync(paymentProcessed); var logCreated2 = new CreateLog(command.UserId, command.PaymentId, LogLevel.Info, "Process_Payment_4", "Payment " + paymentProcessed.Status + " by PiggyBank"); await _busClient.PublishAsync(logCreated2); return; } catch (Exception ex) { var failed = new PaymentFailed("error", ex.Message); command.CopyPayment(failed); await _busClient.PublishAsync(failed); var logCreated = new CreateLog(command.UserId, command.PaymentId, LogLevel.Error, "Process_Payment_Failed", "Process Payment Failed "); await _busClient.PublishAsync(logCreated); } }
public async Task <JsonWebToken> LoginAsync(string login, string password) { var merchant = await _userRepository.GetByLoginAsync(login); if (merchant == null) { var message = "Cannot find login " + login; var logCreated = new CreateLog(Guid.Empty, Guid.Empty, LogLevel.Warning, "Invalid_Credentials", message); await _busClient.PublishAsync(logCreated); throw new Exception(message); } else if (!_encrypter.ValidatePassword(merchant.PasswordHash, merchant.Salt, password)) { var message = "Invalid password " + password + " for login " + login; var logCreated = new CreateLog(Guid.Empty, Guid.Empty, LogLevel.Warning, "Invalid_Credentials", message); await _busClient.PublishAsync(logCreated); throw new Exception(message); } else { var logCreated = new CreateLog(Guid.Empty, Guid.Empty, LogLevel.Warning, "Login", "User " + login + " authenticated"); await _busClient.PublishAsync(logCreated); } return(_jwtHandler.Create(merchant.Id)); }
/// <summary> /// guarda los cambios /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnGuardar_Click(object sender, EventArgs e) { Entities.Categoria categoria = new Entities.Categoria(); categoria.categoria = TxtNombre.Text; var validation = new Helps.DataValidations(categoria).Validate(); bool valid = validation.Item1; if (valid == true) { if (editarse == false) { try { categoria = bll.Insert(categoria); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Insert, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Categoria: " + categoria.categoria, "", "")); Notifications.FrmSuccess.SuccessForm(Language.SearchValue("guardadoOK")); RefrescarTabla(); LimpiarTxt(); } catch (Exception ex) { System.Data.SqlClient.SqlException sqlException = ex as System.Data.SqlClient.SqlException; erro = sqlException.Number; InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.InsertError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Categoria: " + categoria.categoria, ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("guardadoError") + "\n" + ex.Message); } } if (editarse == true) { try { categoria.id = id; bll.Update(categoria); InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Update, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Categoria: " + categoria.categoria, "", "")); Notifications.FrmSuccess.SuccessForm(Language.SearchValue("editadoOK")); RefrescarTabla(); LimpiarTxt(); editarse = false; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.UpdateError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Categoria: " + categoria.categoria, ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("editadoError") + "\n" + ex.Message); } } } else { string messageValid = validation.Item2; Notifications.FrmInformation.InformationForm(messageValid); } }
public Task CreateLogAsync(CreateLog createLog) { _dbContext.FlashcardLogs.Add(new FlashcardLog { CreationDateTime = createLog.CreationDateTime, FlashcardId = createLog.FlashcardId, Difficulty = createLog.Difficulty }); return(_dbContext.SaveChangesAsync()); }
public async Task <IActionResult> BrowseAsync() { var merchantId = Guid.Parse(User.Identity.Name); var results = await _paymentResultService.BrowseAsync(merchantId); var logCreated = new CreateLog(merchantId, Guid.Empty, LogLevel.Info, "Get_Details", "Browse all payments"); await _busClient.PublishAsync(logCreated); return(Json(results));; }
private void loadUserData() { try { lblNombreUser.Text = LoginCache.nombreUser; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } }
private void TxtBuscar_TextChanged(object sender, EventArgs e) { try { metroGrid1.DataSource = bll.FindBy(TxtBuscar.Text); } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } }
public async Task <IActionResult> Post([FromBody] ProcessPayment command) { command.PaymentId = Guid.NewGuid(); command.UserId = Guid.Parse(User.Identity.Name); command.CreatedAt = DateTime.UtcNow; await _busClient.PublishAsync(command); var logCreated = new CreateLog(command.UserId, command.PaymentId, LogLevel.Info, "Process_Payment_1", "Received Process Payment Request"); await _busClient.PublishAsync(logCreated); return(Accepted($"processes/{command.PaymentId}")); }
/// <summary> /// carga el nombre de la categoría en el form /// </summary> private void CargarDatosEnForm() { try { categoria = bllCat.GetById(id); lblNombreValue.Text = categoria.categoria; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } }
private void CargaDatosEnForm() { try { entity = BLL.UFP.Usuario.GetAdapted(id); TxtNombre.Text = entity.Nombre; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } }
private void CheckPermisos() { try { btnPermisos.Enabled = BLL.UFP.Usuario.ValidarPermiso(LoginCache.permisos, Entities.UFP.TipoPermiso.Permisos); btnFamilias.Enabled = BLL.UFP.Usuario.ValidarPermiso(LoginCache.permisos, Entities.UFP.TipoPermiso.Perfiles); } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error validación de permisos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorPermisos") + "\n" + ex.Message); } }
private void MostrarPermisosEstructura() { try { string estructura = BLL.UFP.Usuario.MostrarEstructura(usuario.Permisos); richTextBox1.Text = estructura; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } }
private void frmIngresoFormulario_Load(object sender, EventArgs e) { try { metroGrid1.DataSource = bingindList; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } HelpUser(); }
private void CheckPermisos() { try { BtnGuardar.Enabled = BLL.UFP.Usuario.ValidarPermiso(LoginCache.permisos, Entities.UFP.TipoPermiso.CategoriaInsertar); BtnEliminar.Enabled = BLL.UFP.Usuario.ValidarPermiso(LoginCache.permisos, Entities.UFP.TipoPermiso.CategoriaEliminar); btnAjustaPrecioCat.Enabled = BLL.UFP.Usuario.ValidarPermiso(LoginCache.permisos, Entities.UFP.TipoPermiso.CategoriaAjustarPrecio); } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error validación de permisos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorPermisos") + "\n" + ex.Message); } }
private void ListTipoDoc() { try { ddlTipoDoc.DataSource = new TipoDoc_identidadBLL().List(); ddlTipoDoc.ValueMember = "id"; ddlTipoDoc.DisplayMember = "doc_identidad"; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } }
private void ListFamilias() { try { ddlFamilias.DataSource = BLL.UFP.Familia.GetAllAdapted(); ddlFamilias.ValueMember = "IdFamiliaElement"; ddlFamilias.DisplayMember = "Nombre"; } catch (Exception ex) { InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Error, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Error carga de datos", ex.StackTrace, ex.Message)); Notifications.FrmError.ErrorForm(Language.SearchValue("errorBuscarDatos") + "\n" + ex.Message); } }
public async Task SaveAsync(CreateLog logEvent) { var log = new Log(); log.Id = Guid.NewGuid(); log.MerchantId = logEvent.MerchantId; log.PaymentId = logEvent.PaymentId; log.CreatedAt = logEvent.CreatedAt; log.LogLevel = logEvent.LogLevel; log.LogCode = logEvent.LogCode; log.LogMessage = logEvent.LogMessage; await _logRepository.AddAsync(log); }