public Boolean ModificarDB(ct_Cbtecble_Info _CbteCbleInfo, ref string MensajeError)
        {
            try
            {
                bool res = false;

                if (!ValidarObjeto(_CbteCbleInfo, ref MensajeError))
                {
                    return(false);
                }
                //Valido si la cabecera esta conciliada
                if (!bus_Conci_bancaria.Cbte_existe_en_conciliacion(_CbteCbleInfo.IdEmpresa, _CbteCbleInfo.IdTipoCbte, _CbteCbleInfo.IdCbteCble))
                {
                    res = data.ModificarDB(_CbteCbleInfo, ref MensajeError);
                }
                else
                {
                    //Si modifica cabecera, modifico uno a uno los detalles
                    if (data.Modificar_cabecera(_CbteCbleInfo))
                    {
                        foreach (var item in _CbteCbleInfo._cbteCble_det_lista_info)
                        {
                            // Elimino todas las lineas que no sean de la conciliacion
                            if (!bus_Conci_bancaria.Cbte_existe_en_conciliacion(item.IdEmpresa, item.IdTipoCbte, item.IdCbteCble, item.secuencia))
                            {
                                if (!data_det.ModificarDB(item, ref MensajeError))
                                {
                                    return(false);
                                }
                            }
                            else
                            {
                                if (!data_det.ModificarDB_conciliado(item, ref MensajeError))
                                {
                                    return(false);
                                }
                            }
                        }

                        res = true;
                    }
                }
                return(res);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ModificarDB", ex.Message), ex)
                      {
                          EntityType = typeof(ct_Cbtecble_Bus)
                      };
            }
        }
Beispiel #2
0
 public Boolean ModificarDB(ct_Cbtecble_det_Info _CbteCble_det_Info, ref string MensajeError)
 {
     try
     {
         ct_Cbtecble_det_Data _CbteCbleData = new ct_Cbtecble_det_Data();
         return(_CbteCbleData.ModificarDB(_CbteCble_det_Info, ref MensajeError));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ModificarDB", ex.Message), ex)
               {
                   EntityType = typeof(ct_Cbtecble_det_Bus)
               };
     }
 }