public Boolean ModificarDB(cp_retencion_Info info, ct_Cbtecble_Info cbtecble, ref string mensaje) { Boolean res = true; try { cp_retencion_Info ret = new cp_retencion_Info(); if (!ValidaRetencion(info, ref mensaje)) { return(false); } ret = Get_Info_retencion(info.IdEmpresa, Convert.ToDecimal(info.IdCbteCble_Ogiro), Convert.ToInt32(info.IdTipoCbte_Ogiro)); if (ret == null || ret.ListDetalle == null || ret.ListDetalle.Count <= 0) { return(Graba_CbteCble_Ret_FactProveedor(info, cbtecble, ref mensaje)); } info.IdRetencion = ret.IdRetencion; foreach (var item in info.ListDetalle) { item.IdRetencion = info.IdRetencion; } if (cbtecble.IdCbteCble == 0) { Graba_CbteCble_Ret_FactProveedor(info, cbtecble, ref mensaje); } foreach (var item in cbtecble._cbteCble_det_lista_info) { item.IdCbteCble = cbtecble.IdCbteCble; item.IdTipoCbte = cbtecble.IdTipoCbte; } if (data_retencion.Modificar_Num_Retencion(info, ref mensaje)) // solo modifica la cab de retencion { cp_retencion_det_Data odataDet = new cp_retencion_det_Data(); if (odataDet.ActualizarDB(info.ListDetalle, ret.ListDetalle)) // elimina el detalle y lo vuelve a crear { if (!CbteCble_B.ModificarDB(cbtecble, ref mensaje)) { mensaje = "Ha ocurrido un error al actualizar el CbteCble de Retención..." + mensaje; } } } } 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(cp_retencion_Bus) }; } return(res); }
public Boolean ActualizarDB(List <cp_retencion_det_Info> listaNueva, List <cp_retencion_det_Info> listaAntigua) { try { return(data.ActualizarDB(listaNueva, listaAntigua)); } 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("", "ActualizarDB", ex.Message), ex) { EntityType = typeof(cp_retencion_det_Bus) }; } }