public Boolean GrabarDB(fa_Cliente_Info info, ref decimal IdPersona, ref decimal id, ref string msg) { try { Boolean Result = true; if (!bus_persona.VericarCedulaExiste(info.Persona_Info.pe_cedulaRuc, ref msg)) { Result = bus_persona.GrabarDB(info.Persona_Info, ref IdPersona, ref msg); info.IdPersona = IdPersona; } else { Result = bus_persona.ModificarDB(info.Persona_Info, ref msg); info.IdPersona = info.Persona_Info.IdPersona; } if (Result) { Result = data.GrabarDB(info, ref id, ref msg); // si se grabo el cliente if (Result == true) { if (info.Persona_Info.list_direcciones_x_persona.Count() > 0) { tb_persona_direccion_Bus bus_direccion_x_persona = new tb_persona_direccion_Bus(); bus_direccion_x_persona.GuardarDB(info.Persona_Info.list_direcciones_x_persona, info.IdPersona, ref msg); } if (info.list_contactos_x_cliente.Count() > 0) { fa_cliente_contactos_Bus BusClie_conta = new fa_cliente_contactos_Bus(); BusClie_conta.GuardarDB(info.list_contactos_x_cliente, ref msg); } if (info.list_punto_emision_x_cliente.Count > 0) { fa_cliente_pto_emision_cliente_Bus bus_Punto_emision = new fa_cliente_pto_emision_cliente_Bus(); bus_Punto_emision.MergeDB(info); } } } return(Result); } 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("", "GrabarDB", ex.Message), ex) { EntityType = typeof(fa_catalogo_tipo_Bus) }; } }
public Boolean ModificarDB(fa_Cliente_Info info, ref string msg) { try { Boolean respuesta = false; respuesta = bus_persona.ModificarDB(info.Persona_Info, ref msg); if (respuesta) { //modificacion datos cliente respuesta = data.ModificarDB(info, ref msg); if (respuesta == true) { if (info.Persona_Info.list_direcciones_x_persona.Count() > 0) { tb_persona_direccion_Bus bus_direccion_x_persona = new tb_persona_direccion_Bus(); bus_direccion_x_persona.EliminarDB(info.IdPersona, ref msg); bus_direccion_x_persona.GuardarDB(info.Persona_Info.list_direcciones_x_persona, info.IdPersona, ref msg); } if (info.list_contactos_x_cliente.Count() > 0) { fa_cliente_contactos_Bus BusClie_conta = new fa_cliente_contactos_Bus(); BusClie_conta.EliminarDB(info.IdEmpresa, info.IdCliente, ref msg); BusClie_conta.GuardarDB(info.list_contactos_x_cliente, ref msg); } if (info.list_punto_emision_x_cliente.Count > 0) { fa_cliente_pto_emision_cliente_Bus bus_Punto_emision = new fa_cliente_pto_emision_cliente_Bus(); bus_Punto_emision.MergeDB(info); } } } return(respuesta); } 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(fa_catalogo_tipo_Bus) }; } }