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")); } }
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 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); } } }
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")); } }
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")); } }
/// <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")); } }
/// <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); } }
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); } }
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); } }
/// <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 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 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 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 Tabla() { try { metroGrid1.DataSource = bind; metroGrid1.Columns[0].Visible = false; metroGrid1.Columns[2].Visible = false; } 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); } }
private void CargarTotal() { try { double tot = 0; listDetalle.ForEach(x => tot += x.precio * x.cantidad); lblTotalValue.Text = tot.ToString(); } 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 metroGrid1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { Entities.Cliente cli = bll.GetById(GetId()); contrato.Ejecutar(cli); } 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); } this.Close(); }
private void btnAgregar_Click(object sender, EventArgs e) { try { Patente patente = BLL.UFP.Patente.GetAdapted(ddlPatentes.SelectedValue.ToString()); familia.Add(patente); bind.Add(patente); } 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 { 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 btnAgregarFamilia_Click(object sender, EventArgs e) { try { Entities.UFP.Familia familia = BLL.UFP.Familia.GetAdapted(ddlFamilias.SelectedValue.ToString()); usuario.Permisos.Add(familia); bind.Add(familia); 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); } }
private void CargaDatosEnForm(int id) { try { producto = bllProd.GetById(Convert.ToInt32(id)); lblCodValue.Text = producto.codigo; lblNombreValue.Text = producto.nombre; txtStock.Text = producto.cantidad.ToString(); } 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 void CargarNumeroFactura() { try { int _iddoc = (int)ddlTipoDoc.SelectedValue; tipo_documento = Tipo_DocumentoBLL.GetById(_iddoc); lblLetraValue.Text = tipo_documento.letra; lblSucValue.Text = tipo_documento.sucursal.ToString(); lblNumeroValue.Text = (tipo_documento.numero + 1).ToString(); } 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 (bool, string) CargarEntityVerificarUsuario(Entities.UFP.Usuario entity) { try { entity.Nombre = TxtNombre.Text; entity.Pass = TxtPassAnterior.Text; return(BLL.UFP.Usuario.Login(entity)); } 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); } return(false, ""); }
private void RefrescarTabla() { try { metroGrid1.DataSource = BLL.UFP.Usuario.GetAllAdapted(); CaracteristicasGrid(); } 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); } metroGrid1.ClearSelection(); TxtBuscar.Focus(); }
private void CargarDatos() { try { usuario = BLL.UFP.Usuario.GetAdapted(id); foreach (var p in usuario.Permisos) { bind.Add(p); } lblUsuarioValue.Text = usuario.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 CargarEntity() { try { _Cabecera_egreso.fk_id_usuario = 0; _Cabecera_egreso.fk_id_cliente = cliente.id; _Cabecera_egreso.fk_id_tipo_doc = (int)ddlTipoDoc.SelectedValue; _Cabecera_egreso.listDetalle = listDetalle; _Cabecera_egreso.letra = lblLetraValue.Text; _Cabecera_egreso.sucursal = Convert.ToInt32(lblSucValue.Text); _Cabecera_egreso.numero = Convert.ToInt32(lblNumeroValue.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); } }
private void CaracteristicasGrid() { try { metroGrid1.Columns["id"].Visible = false; metroGrid1.Columns["fk_id_tipo_doc"].Visible = false; metroGrid1.Columns["fk_id_cliente"].Visible = false; metroGrid1.Columns["letra"].Visible = false; metroGrid1.Columns["sucursal"].Visible = false; metroGrid1.Columns["numero"].Visible = false; metroGrid1.Columns["fk_id_usuario"].Visible = false; //metroGrid1.Columns["nombre_usuario"].Visible = false; metroGrid1.Columns["tipo_documento"].DisplayIndex = 1; metroGrid1.Columns["factura"].DisplayIndex = 2; metroGrid1.Columns["nombre_cliente"].DisplayIndex = 3; metroGrid1.Columns["fecha"].DisplayIndex = 4; metroGrid1.Columns["cancelada"].DisplayIndex = 5; metroGrid1.Columns["tipo_documento"].Width = 150; metroGrid1.Columns["factura"].Width = 150; metroGrid1.Columns["nombre_cliente"].Width = 220; metroGrid1.Columns["fecha"].Width = 150; metroGrid1.Columns["cancelada"].Width = 150; foreach (DataGridViewRow row in metroGrid1.Rows) { if (Convert.ToBoolean(row.Cells["cancelada"].Value) == true) { row.DefaultCellStyle.BackColor = Color.DarkOrange; row.DefaultCellStyle.ForeColor = Color.White; } } } 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 CargarDatos() { try { Log log = InvokeCommand.GetLogById().Execute(id); lblTipoLogValue.Text = log.tipo_log_nombre; lblFechaValue.Text = log.fecha.ToString(); lblInfoLogValue.Text = log.info_operacion; lblClaseValue.Text = log.clase; lblMetodoValue.Text = log.metodo; lblMensajeValue.Text = log.metodo; lblStackTraceValue.Text = log.stack_trace; } 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); } }