protected override void AnulaLineaAction()
        {
            if (Lines_DGW.CurrentRow == null)
            {
                return;
            }

            CashLine item = Lines_DGW.CurrentRow.DataBoundItem as CashLine;

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.NULL_CONFIRM) != DialogResult.Yes)
            {
                return;
            }

            if (item.Locked)
            {
                return;
            }

            _entity.Lines.Remove(item);

            _entity.UpdateSaldo();
            Datos.ResetBindings(false);

            SetGridFormat(Lines_DGW);
        }
        public override void ChangeStateAction(EEstadoItem estado)
        {
            switch (estado)
            {
            case EEstadoItem.Unlock:
                _entity = Charge.ChangeEstado(ActiveOID, ActiveItem.ETipoCobro, EEstado.Abierto);
                break;

            case EEstadoItem.Contabilizado:
                _entity = Charge.ChangeEstado(ActiveOID, ActiveItem.ETipoCobro, EEstado.Contabilizado);
                break;

            case EEstadoItem.Anulado:
            {
                if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.NULL_CONFIRM) != DialogResult.Yes)
                {
                    return;
                }
                _entity = Charge.ChangeEstado(ActiveOID, ActiveItem.ETipoCobro, EEstado.Anulado);
            }
            break;
            }

            _action_result = DialogResult.OK;
        }
        protected override void DeleteAction()
        {
            if (CurrentDocumento == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Resources.Messages.DELETE_CONFIRM) == DialogResult.No)
            {
                return;
            }

            _back_job = BackJob.Delete;
            PgMng.Reset(9, 1, Resources.Messages.CONNECTING_SERVER, this);
            //PgMng.StartBackJob(this);
            DoJob();

            PgMng.Grow();
            if (PgMng.Result == BGResult.OK)
            {
                _entity.ApplyEdit();
                _entity.Save();
            }

            RefreshSecondaryData();
            PgMng.FillUp();
        }
        protected override void DeleteLineaAction()
        {
            if (Lineas_DGW.CurrentRow.DataBoundItem == null)
            {
                return;
            }
            LineaPedido item = (LineaPedido)Lineas_DGW.CurrentRow.DataBoundItem;

            if (item == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                PgMng.Reset(4, 1, Store.Resources.Messages.UPDATING_STOCK, this);

                BatchInfo partida = BatchInfo.Get(item.OidPartida, true);
                PgMng.Grow();

                if (partida.IsKit)
                {
                    DeleteKit(partida);
                }
                PgMng.Grow();

                _entity.Lineas.Remove(item, _entity);

                ControlsMng.UpdateBinding(Datos_Lineas);
                ControlsMng.UpdateBinding(Datos);
                PgMng.FillUp();
            }
        }
Exemple #5
0
        public static DialogResult ValidateDueDate(Payment payment, CreditCardInfo creditCard, DateTime dueDate)
        {
            if (payment.EMedioPago != EMedioPago.Tarjeta)
            {
                return(DialogResult.OK);
            }

            creditCard = creditCard ?? CreditCardInfo.Get(payment.OidCreditCard, false);

            if (creditCard.ETipoTarjeta != ETipoTarjeta.Credito)
            {
                return(DialogResult.OK);
            }

            DateTime statementDueDate = StatementDatesFromOperationDueDate.GetStatementDueDate(creditCard, dueDate);

            if (!statementDueDate.Equals(dueDate))
            {
                string message = String.Format(moleQule.Common.Resources.Messages.STATEMENT_DATE_NOT_MISMATCH, statementDueDate.ToShortDateString());
                if (ProgressInfoMng.ShowQuestion(message) == System.Windows.Forms.DialogResult.Yes)
                {
                    payment.Vencimiento = statementDueDate;
                    return(DialogResult.OK);
                }
                else
                {
                    return(DialogResult.Ignore);
                }
            }

            return(DialogResult.OK);
        }
Exemple #6
0
        protected void SetExpedient(ExpedientInfo source, bool setToLines = true)
        {
            _expedient = source;

            if (_expedient != null)
            {
                _entity.Expediente    = _expedient.Codigo;
                _entity.OidExpediente = _expedient.Oid;
                Expediente_TB.Text    = _expedient.Codigo;

                AddCacheItem(_expedient);

                //setToLines es para evitar que pregunte al cargar el albarán
                if (_entity.Conceptos.Count > 0 && setToLines)
                {
                    DialogResult result = ProgressInfoMng.ShowQuestion(string.Format("¿Asignar el expediente {0} a todos los conceptos del albarán?", _expedient.Codigo));

                    foreach (InputDeliveryLine item in _entity.Conceptos)
                    {
                        if (result == DialogResult.No && item.OidExpediente != 0)
                        {
                            continue;
                        }
                        item.OidExpediente = source.Oid;
                        item.Expediente    = source.Codigo;
                    }
                }
            }
        }
        protected override void EliminarConceptoAction()
        {
            if (Datos_Concepto.Current == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                PgMng.Reset(5, 1, Store.Resources.Messages.UPDATING_STOCK, this);

                BatchInfo pexp = BatchInfo.Get(Line.OidPartida, true);
                PgMng.Grow();

                if (pexp.IsKit)
                {
                    DeleteKit(pexp);
                }
                PgMng.Grow();

                _entity.Conceptos.Remove(Line);
                _entity.CalculaTotal();
                PgMng.Grow();

                RefreshConceptos();
                ControlsMng.UpdateBinding(Datos);
                PgMng.FillUp();
            }

            Serie_BT.Enabled = (_entity.Conceptos.Count > 0);
        }
        protected override void DeleteLineAction()
        {
            if (Lines_BS.Current == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                if (Concepto.OidPedido == 0)
                {
                    PgMng.Reset(4, 1, Store.Resources.Messages.UPDATING_STOCK, this);

                    if (Concepto.OidPartida != 0)
                    {
                        BatchInfo partida = BatchInfo.Get(Concepto.OidPartida, true);
                        PgMng.Grow();

                        if (partida.IsKit)
                        {
                            DeleteKit(partida);
                        }
                        PgMng.Grow();
                    }

                    _entity.Conceptos.Remove(Concepto, true);
                    _entity.CalculateTotal();
                    PgMng.Grow();
                }
                else
                {
                    long oidPedido = Concepto.OidPedido;

                    _entity.Conceptos.Remove(Concepto, true);
                    _entity.CalculateTotal();

                    bool free_pedido = true;

                    foreach (OutputDeliveryLine item in _entity.Conceptos)
                    {
                        if (item.OidPedido == Concepto.OidPedido)
                        {
                            free_pedido = false;
                        }
                    }

                    //Actualizamos la lista de pedidos disponibles
                    if (free_pedido)
                    {
                        _pedidos.AddItem(_pedidos_cliente.GetItem(oidPedido));
                    }
                }

                ControlsMng.UpdateBinding(Lines_BS);
                ControlsMng.UpdateBinding(Datos);
                PgMng.FillUp();
            }

            Serie_BT.Enabled = (_entity.Conceptos.Count > 0);
        }
Exemple #9
0
        protected void ChangeStateAction(EEstado estado)
        {
            if (_entity.EEstado == EEstado.Anulado)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.ITEM_ANULADO_NO_EDIT);
                return;
            }

            switch (estado)
            {
            case EEstado.Anulado:
            {
                if (_entity.EEstado == EEstado.Contabilizado)
                {
                    PgMng.ShowInfoException(Library.Common.Resources.Messages.NULL_CONTABILIZADO_NOT_ALLOWED);
                    return;
                }

                if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.NULL_CONFIRM) != DialogResult.Yes)
                {
                    return;
                }
            }
            break;
            }

            _entity.EEstado = estado;
        }
Exemple #10
0
        public override void RealizarCancelacionAction()
        {
            BankAccount item = (BankAccount)CuentasAsociadas_DGW.CurrentRow.DataBoundItem;

            if (item == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion("Para realizar una cancelación debe guardar la cuenta bancaria ahora. ¿Desea continuar?") == DialogResult.Yes)
            {
                if (SaveObject())
                {
                    Assembly assembly = Assembly.Load("moleQule.Face.Invoice");
                    Type     type     = assembly.GetType("moleQule.Face.Invoice.TraspasoAddForm");

                    ItemMngBaseForm form = (ItemMngBaseForm)type.InvokeMember("TraspasoAddForm", BindingFlags.CreateInstance, null, null, new object[1] {
                        item
                    });
                    form.ShowDialog();

                    Close();
                }
            }
        }
 public override void DeleteObject(long oid)
 {
     if (ProgressInfoMng.ShowQuestion(moleQule.Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
     {
         InventarioAlmacen.Delete(oid);
         _action_result = DialogResult.OK;
     }
 }
Exemple #12
0
        protected void ChangeStateAction(moleQule.Base.EEstado estado)
        {
            if (_entity.EEstado == moleQule.Base.EEstado.Anulado)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.ITEM_ANULADO_NO_EDIT);
                return;
            }

            switch (estado)
            {
            case moleQule.Base.EEstado.Anulado:
            {
                if (_entity.EEstado == moleQule.Base.EEstado.Contabilizado)
                {
                    PgMng.ShowInfoException(moleQule.Common.Resources.Messages.NULL_CONTABILIZADO_NOT_ALLOWED);
                    return;
                }

                if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.NULL_CONFIRM) != DialogResult.Yes)
                {
                    return;
                }
            }
            break;

            case moleQule.Base.EEstado.Baja:
            {
                if (_entity.OidPair == 0)
                {
                    LivestockBookLineInfo entry = SelectEntryPair();

                    if (entry != null)
                    {
                        _entity.CopyFromPair(entry);
                    }
                    else
                    {
                        return;
                    }
                }
            }
            break;

            case moleQule.Base.EEstado.Alta:
            {
                _entity.OidPair = 0;
            }
            break;
            }

            _entity.EEstado = estado;

            ShowPair();
        }
 private void ObraUIForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_action_result != DialogResult.OK)
     {
         if (DialogResult.No == ProgressInfoMng.ShowQuestion(moleQule.Face.Resources.Messages.CANCEL_CONFIRM))
         {
             e.Cancel = true;
             return;
         }
     }
 }
 protected override void BorrarProductoAction()
 {
     if (Datos_ProductoCliente.Current != null)
     {
         if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
         {
             ProductoCliente producto = (ProductoCliente)Datos_ProductoCliente.Current;
             _entity.Productos.Remove(producto);
         }
     }
 }
Exemple #15
0
        protected void ChangeState(moleQule.Base.EEstado estado)
        {
            if (Pago == null)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.NO_SELECTED);
                return;
            }

            if (Pago.EEstado == moleQule.Base.EEstado.Anulado)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.ITEM_ANULADO_NO_EDIT);
                return;
            }

            switch (estado)
            {
            case moleQule.Base.EEstado.Anulado:
            {
                if (Pago.EEstado == moleQule.Base.EEstado.Contabilizado)
                {
                    PgMng.ShowInfoException(moleQule.Common.Resources.Messages.NULL_CONTABILIZADO_NOT_ALLOWED);
                    return;
                }

                if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.NULL_CONFIRM) != DialogResult.Yes)
                {
                    return;
                }
            }
            break;
            }

            try
            {
                _entity.Pagos.ChangeState(estado, Pago, _entity);
                _entity.ApplyEdit();
                _entity.ISave(Pago);
                _entity.BeginEdit();

                Payment current = Pago;
                Datos_Pago.ResetBindings(false);
                _summary.Refresh(_entity);
                Datos_Resumen.ResetBindings(false);
                SetGridColors(Pagos_DGW.Name);
                _invoices = InputInvoiceList.GetListByAcreedor(_entity.Oid, _entity.ETipoAcreedor, false);
                Select(current);
            }
            catch (Exception ex)
            {
                PgMng.ShowInfoException(ex);
            }
        }
        protected override void DeletePeriodoAction()
        {
            if (Datos_Periodos.Current == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                AyudaPeriodo item = (AyudaPeriodo)Datos_Periodos.Current;
                _entity.Periodos.Remove(item);
            }
        }
        public override void DeleteObject(long oid)
        {
            if (ProgressInfoMng.ShowQuestion(moleQule.Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                if (ActiveItem.Shared)
                {
                    if (ProgressInfoMng.ShowQuestion(Resources.Messages.DOC_SHARED) != DialogResult.OK)
                    {
                        _action_result = DialogResult.Cancel;
                        return;
                    }
                }

                try
                {
                    PgMng.Reset(5, 1, Resources.Messages.CONNECTING_SERVER, this);

                    HipatiaCtl.InitHipatia(_ftp, Principal.GetHipatiaFTPRootPath(), Principal.GetHipatiaFTPHost());

                    PgMng.Grow(moleQule.Face.Resources.Messages.DELETING);

                    Documento item = Documento.Get(ActiveItem.OidDocumento);
                    item.AgenteDocumentos.Clear();
                    item.Save();
                    item.CloseSession();
                    PgMng.Grow();

                    Documento.Delete(ActiveItem.OidDocumento);
                    PgMng.Grow();

                    if (HipatiaCtl.ExistsFile(_ftp, ActiveItem.Ruta))
                    {
                        _ftp.DeleteFile(ActiveItem.Ruta);
                    }
                    PgMng.Grow();
                }
                catch (Exception ex)
                {
                    _action_result = DialogResult.Cancel;
                    throw ex;
                }
                finally
                {
                    PgMng.FillUp();
                }

                _action_result = DialogResult.OK;
            }
        }
        protected void ChangeState(EEstado estado)
        {
            if (Cobro == null)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.NO_SELECTED);
                return;
            }

            if (Cobro.EEstado == EEstado.Anulado)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.ITEM_ANULADO_NO_EDIT);
                return;
            }

            switch (estado)
            {
            case EEstado.Anulado:
            {
                if (Cobro.EEstado == EEstado.Contabilizado)
                {
                    PgMng.ShowInfoException(Library.Common.Resources.Messages.NULL_CONTABILIZADO_NOT_ALLOWED);
                    return;
                }

                if (Cobro.EMedioPago == EMedioPago.Efectivo)
                {
                    CashLineInfo linea = CashLineInfo.GetByCobro(Cobro.Oid);
                    if ((linea.Oid != 0) && (linea.OidCierre != 0) && (linea.EEstado != EEstado.Anulado))
                    {
                        PgMng.ShowInfoException(String.Format(Resources.Messages.CIERRE_CAJA_COBRO, linea.Codigo, linea.Fecha));
                        return;
                    }
                }

                if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.NULL_CONFIRM) != DialogResult.Yes)
                {
                    return;
                }
            }
            break;
            }

            _entity.Cobros.ChangeState(estado, Cobro, _entity);
            _entity.ApplyEdit();
            _entity.Save();
            _entity.BeginEdit();

            RefreshAction();
        }
Exemple #19
0
        protected override void DeletePeriodoTipoInteresAction()
        {
            if (InterestRates_BS.Current == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                InterestRate item = (InterestRate)InterestRates_BS.Current;
                _entity.InterestRates.Remove(item);
            }

            UpdateImportes();
        }
Exemple #20
0
        protected void ChangeState(EEstado estado)
        {
            if (!ControlsMng.IsCurrentItemValid(Pagos_DGW))
            {
                return;
            }

            Payment payment = ControlsMng.GetCurrentItem(Pagos_DGW) as Payment;

            if (payment == null)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.NO_SELECTED);
                return;
            }

            if (payment.EEstado == moleQule.Base.EEstado.Anulado)
            {
                PgMng.ShowInfoException(Face.Resources.Messages.ITEM_ANULADO_NO_EDIT);
                return;
            }

            switch (estado)
            {
            case moleQule.Base.EEstado.Anulado:

                if (payment.EEstado == moleQule.Base.EEstado.Contabilizado)
                {
                    PgMng.ShowInfoException(moleQule.Common.Resources.Messages.NULL_CONTABILIZADO_NOT_ALLOWED);
                    return;
                }

                if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.NULL_CONFIRM) != DialogResult.Yes)
                {
                    return;
                }
                break;
            }

            try
            {
                payment.ChangeEstado(estado);
                UpdatePayments();
            }
            catch (Exception ex)
            {
                PgMng.ShowInfoException(ex);
            }
        }
        protected override void SaveAction()
        {
            InputInvoiceList list = (InputInvoiceList)Cache.Instance.Get(typeof(InputInvoiceList));

            if (list != null)
            {
                InputInvoiceInfo item = list.GetItemByNFactura(_entity.NFactura, _entity.Fecha.Year, _entity.OidAcreedor, _entity.ETipoAcreedor);
                if (item != null && item.Oid != _entity.Oid)
                {
                    if (ProgressInfoMng.ShowQuestion(String.Format(Library.Store.Resources.Messages.FACTURA_RECIBIDA_DUPLICADA, _entity.Acreedor)) == DialogResult.No)
                    {
                        _action_result = DialogResult.Ignore;
                        return;
                    }
                }
            }

            Library.Store.QueryConditions conditions = new Library.Store.QueryConditions
            {
                FacturaRecibida = _entity.GetInfo(false),
                TipoAcreedor    = new ETipoAcreedor[1] {
                    _entity.ETipoAcreedor
                },
                Estado = moleQule.Base.EEstado.NoAnulado
            };

            conditions.FacturaRecibida.Oid = 0;

            InputInvoiceInfo prev_invoice = InputInvoiceInfo.Exists(conditions, false);

            if (prev_invoice.Oid != 0 && prev_invoice.Oid != _entity.Oid && prev_invoice.Total == _entity.Total)
            {
                if (DialogResult.No == ProgressInfoMng.ShowQuestion("Existe una factura de este proveedor con la misma fecha, número e importe. ¿Desea continuar?"))
                {
                    _action_result = DialogResult.Cancel;
                    return;
                }
            }

            if (_expediente != null)
            {
                _entity.SetExpediente(_expediente);
            }

            _action_result = SaveObject() ? DialogResult.OK : DialogResult.Ignore;
        }
        private void Submit_TI_Click(object sender, EventArgs e)
        {
            try
            {
                if (ProgressInfoMng.ShowQuestion("A continuación se generarán los apuntes bancarios asociados") == DialogResult.No)
                {
                    return;
                }

                RefreshAction();

                PgMng.Reset(5, 1, "Creando apuntes bancarios...", this);

                if (Apuntes_TV.TopNode.Nodes[PAGOS_PENDIENTES].Checked)
                {
                    PgMng.Grow("Creando apuntes bancarios de pagos");
                    Library.Invoice.ModuleController.CreateApuntesBancarios(CobrosVencidosList);
                }

                if (Apuntes_TV.TopNode.Nodes[COBROS_PENDIENTES].Checked)
                {
                    PgMng.Grow("Creando apuntes bancarios de pagos");
                    Library.Invoice.ModuleController.CreateApuntesBancarios(PagosVencidosList);
                }

                PgMng.Grow("Creando apuntes bancarios de pagos por tarjeta de crédito");
                foreach (PaymentList list in PagosTarjetasList)
                {
                    if (Apuntes_TV.TopNode.Nodes[PAGOS_TARJETA_PENDIENTES].Nodes[PagosTarjetasList.IndexOf(list)].Checked)
                    {
                        Library.Invoice.ModuleController.CreateApuntesBancarios(list);
                    }
                }

                PgMng.FillUp();

                RefreshAction();
            }
            catch (Exception ex)
            {
                PgMng.FillUp();
                throw ex;
            }
        }
Exemple #23
0
        protected bool RemoveStock(Expedient expediente, Stock stock)
        {
            if (((stock.OidAlbaran != 0) || (stock.Inicial)) &&
                stock.ETipoStock != ETipoStock.Consumo &&
                stock.ETipoStock != ETipoStock.MovimientoSalida &&
                stock.ETipoStock != ETipoStock.Merma)
            {
                PgMng.ShowInfoException(Resources.Messages.STOCK_FACTURADO);
                return(false);
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                expediente.RemoveStock(stock);
                return(true);
            }

            return(false);
        }
Exemple #24
0
        protected override void SaveAction()
        {
            Library.Store.QueryConditions conditions = new Library.Store.QueryConditions
            {
                InputDelivery = _entity.GetInfo(false),
                TipoAcreedor  = new ETipoAcreedor[1] {
                    _entity.ETipoAcreedor
                },
                Estado = moleQule.Base.EEstado.NoAnulado
            };

            conditions.InputDelivery.Oid = 0;

            if (InputDeliveryInfo.Exists(conditions, false).Oid != 0 &&
                InputDeliveryInfo.Exists(conditions, false).Oid != _entity.Oid)
            {
                if (DialogResult.No == ProgressInfoMng.ShowQuestion("Existe un albarán de este proveedor con la misma fecha e importe. ¿Desea continuar?"))
                {
                    _action_result = DialogResult.Cancel;
                    return;
                }
            }

            if (_entity.Rectificativo)
            {
                foreach (InputDeliveryLine item in _entity.Conceptos)
                {
                    if (item.FacturacionBulto && item.CantidadBultos > 0)
                    {
                        item.CantidadBultos = -item.CantidadBultos;
                    }
                    if (item.FacturacionPeso && item.CantidadKilos > 0)
                    {
                        item.CantidadKilos = -item.CantidadKilos;
                    }
                }

                _entity.CalculateTotal();
            }

            _action_result = SaveObject() ? DialogResult.OK : DialogResult.Ignore;
        }
        protected override void DeleteLineaAction()
        {
            if (Lineas_DGW.CurrentRow.DataBoundItem == null)
            {
                return;
            }
            LineaPedidoProveedor item = (LineaPedidoProveedor)Lineas_DGW.CurrentRow.DataBoundItem;

            if (item == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                _entity.Lineas.RemoveItem(_entity, item);

                RefreshLineas();
            }
        }
        private void DoDelete(BackgroundWorker bk)
        {
            PgMng.Grow(Resources.Messages.CONNECTING_SERVER);

            if (_ftp == null)
            {
                _ftp = new FtpClient(Principal.GetHipatiaFTPHost(), Principal.GetHipatiaFTPUser(), Principal.GetHipatiaFTPPwd(), Principal.GetHipatiaFTPRootPath());
                HipatiaCtl.InitHipatia(_ftp, Principal.GetHipatiaFTPRootPath(), Principal.GetHipatiaFTPHost());
            }
            PgMng.Grow();

            _entity.Documentos.RemoveAgent(CurrentDocumento);

            PgMng.Grow();

            if (CurrentDocumento.AgenteDocumentos.Count == 1)
            {
                if (ProgressInfoMng.ShowQuestion(Resources.Messages.DELETE_LAST_FILE) == DialogResult.No)
                {
                    try
                    {
                        Documento.Delete(CurrentDocumento.OidDocumento);
                        PgMng.Grow();

                        if (HipatiaCtl.ExistsFile(_ftp, CurrentDocumento.Ruta))
                        {
                            _ftp.DeleteFile(CurrentDocumento.Ruta);
                        }
                        PgMng.Grow();
                    }
                    catch (Exception ex)
                    {
                        PgMng.Result = BGResult.Error;
                        throw ex;
                    }
                }
            }

            PgMng.Result = BGResult.OK;
        }
        protected override void SaveAction()
        {
            ClienteInfo cliente = Client_BS.DataSource as ClienteInfo;

            if (cliente != null)
            {
                if (cliente.CreditoDispuesto > 0)
                {
                    if ((cliente.CreditoDispuesto + _entity.Total) > cliente.LimiteCredito)
                    {
                        string deuda = Convert.ToString(cliente.CreditoDispuesto + _entity.Total);
                        if (ProgressInfoMng.ShowQuestion(String.Format(Resources.Messages.CREDITO_DISPUESTO, deuda, cliente.LimiteCredito.ToString())) == DialogResult.No)
                        {
                            _action_result = DialogResult.Ignore;
                            return;
                        }
                    }
                }
            }

            _action_result = SaveObject() ? DialogResult.OK : DialogResult.Ignore;
        }
        private void Eliminar_Concepto_BT_Click(object sender, EventArgs e)
        {
            if (Datos_Componentes.Current == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                Batch batch = (Batch)Datos_Componentes.Current;
                _entity.Partida.Componentes.Remove(batch);
                _entity.CalculaPrecioKit();
                Datos_Componentes.ResetBindings(false);
                Datos.ResetBindings(false);
            }

            _entity.CalculaPrecioKit();

            if (_entity.Partida.Componentes.Count > 0)
            {
                Serie_BT.Enabled = true;
                Kilos_TB.Enabled = true;
            }
        }
Exemple #29
0
        protected virtual void SetExpenses()
        {
            if (_loan == null)
            {
                return;
            }

            BankAccountInfo bank_account = BankAccountInfo.Get(_loan.OidCuenta, false, true);

            int dias_pago             = (DateTime.Now - _loan.FechaIngreso).Days;
            int dias_pago_vencimiento = (_loan.FechaVencimiento - _loan.FechaIngreso).Days;

            decimal tipo = bank_account.ETipoCuenta == ETipoCuenta.ComercioExterior ? bank_account.TipoInteres : 0;

            decimal gastos             = _entity.Importe * tipo * dias_pago / 36000;
            decimal gastos_vencimiento = _entity.Importe * tipo * dias_pago_vencimiento / 36000;

            decimal gastos_prev = _entity.GastosBancarios;

            if (bank_account.PagoGastosInicio)
            {
                _entity.GastosBancarios += gastos - gastos_vencimiento;
            }
            else
            {
                _entity.GastosBancarios += gastos;
            }

            if (_entity.GastosBancarios != gastos_prev)
            {
                if (DialogResult.No == ProgressInfoMng.ShowQuestion("Los gastos se han actualizado automáticamente. ¿Confirmar?"))
                {
                    _entity.GastosBancarios = gastos_prev;
                }
            }
        }
        private void DoUpdate()
        {
            PgMng.Result = BGResult.OK;

            PgMng.Message = Resources.Messages.CONNECTING_SERVER;

            if (Nombre_TB.Text == string.Empty)
            {
                throw new iQException(Resources.Messages.NO_NAME);
            }
            PgMng.Grow();

            if (_doc != null)
            {
                //Los nombres de los ficheros deben coincidir
                if (_doc.Nombre != Nombre_TB.Text)
                {
                    throw new iQException(Resources.Messages.NOT_EQUAL_DOC_NAME);
                }
            }
            else if (HipatiaCtl.CheckDuplicate(_agente, _entity))
            {
                throw new iQException(Resources.Messages.DOC_REPEATED);
            }
            PgMng.Grow();

            FtpClient ftp = new FtpClient(Principal.GetHipatiaFTPHost(), Principal.GetHipatiaFTPUser(), Principal.GetHipatiaFTPPwd(), Principal.GetHipatiaFTPRootPath());

            HipatiaCtl.InitHipatia(ftp, Principal.GetHipatiaFTPRootPath(), Principal.GetHipatiaFTPHost());
            PgMng.Grow();

            PgMng.Message = Resources.Messages.UPLOADING_FILE;

            AgenteInfo _ag_info = _agente.GetInfo(false);

            if (!HipatiaCtl.ExistsAgentDirectory(ftp, _ag_info))
            {
                HipatiaCtl.CreateAgentDirectory(ftp, _ag_info);
            }
            PgMng.Grow();

            try
            {
                //Estamos añadiendo uno nuevo
                if (_doc == null)
                {
                    if (HipatiaCtl.ExistsFile(ftp, _ag_info, _entity.GetInfo(false)))
                    {
                        if (ProgressInfoMng.ShowQuestion(Resources.Messages.OVERWRITE_FILE) == DialogResult.Yes)
                        {
                            HipatiaCtl.Copy(ftp, _ag_info, _entity.Ruta);
                        }
                    }
                    else
                    {
                        HipatiaCtl.Copy(ftp, _ag_info, _entity.Ruta);
                    }
                }
                //Estamos reemplazando uno existente
                else
                {
                    HipatiaCtl.ExistsDirectory(ftp, _doc.Ruta);
                    HipatiaCtl.Copy(ftp, _ag_info, _entity.Ruta);
                }
            }
            catch (Exception ex)
            {
                PgMng.Result = BGResult.Error;
                throw new iQException(Resources.Messages.OPERATION_ERROR + Environment.NewLine + ex.Message);
            }

            _entity.Ruta = HipatiaCtl.GetAgenteDirectory(ftp, _ag_info) + "/" + _entity.Nombre;
            PgMng.Grow();

            PgMng.Message = Resources.Messages.CLOSING_SERVER;
            PgMng.Grow();

            _entity.ApplyEdit();
            _entity.Save();
            PgMng.Grow();
        }