Пример #1
0
        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"]);
            }
        }
Пример #2
0
        private void CargarDatos()
        {
            try
            {
                _Cabecera_egreso             = bllCab.GetById(id);
                _Cabecera_egreso.listDetalle = bllDet.ListDetallesByCabecera(id);

                lblFacturaValue.Text = _Cabecera_egreso.factura;
                lblClienteValue.Text = _Cabecera_egreso.nombre_cliente;
                lblTipoDocValue.Text = _Cabecera_egreso.tipo_documento;

                metroGrid1.DataSource = _Cabecera_egreso.listDetalle;
            }
            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);
            }
        }
Пример #3
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            CargarEntity();

            var  validation = new Helps.DataValidations(_Cabecera_egreso).Validate();
            bool valid      = validation.Item1;

            if (valid == true)
            {
                try
                {
                    _Cabecera_egreso = bllCab.Insert(_Cabecera_egreso);

                    InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.Insert, 1, this.GetType().FullName, MethodInfo.GetCurrentMethod().Name, "Egreso: " + _Cabecera_egreso.letra + _Cabecera_egreso.sucursal.ToString() + _Cabecera_egreso.numero.ToString(), "", ""));

                    Notifications.FrmSuccess.SuccessForm(Helps.Language.SearchValue("guardadoOK"));

                    this.Close();
                }
                catch (SinStockException ex)
                {
                    Notifications.FrmInformation.InformationForm(Helps.Language.SearchValue("prodSinStock") + "\n" + ex.PrepararParaMostrar(ex.productos));
                }
                catch (Exception ex)
                {
                    if (ex.Message == EValidaciones.existe)
                    {
                        Notifications.FrmInformation.InformationForm(Helps.Language.SearchValue("errorExiste"));
                    }
                    else
                    {
                        InvokeCommand.InsertLog().Execute(CreateLog.Clog(ETipoLog.InsertError, 1, ex.TargetSite.DeclaringType.FullName, ex.TargetSite.Name, "Egreso: " + _Cabecera_egreso.letra + _Cabecera_egreso.sucursal.ToString() + _Cabecera_egreso.numero.ToString(), ex.StackTrace, ex.Message));
                        Notifications.FrmError.ErrorForm(Helps.Language.SearchValue("guardadoError") + "\n" + ex.Message);
                    }
                }
            }
            else
            {
                string messageValid = validation.Item2;
                Notifications.FrmInformation.InformationForm(messageValid);
            }
        }