public void Delete(int Id) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCONVENIO repositorio = new RepositorioCONVENIO(context); CONVENIO _CONVENIO = repositorio.GetById(Id); if (Equals(_CONVENIO, null)) { throw new Exception(String.Concat("No se ha encontrado CONVENIO con Id =", Id.ToString())); } _CONVENIO.ACTIVO = false; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public CONVENIO GetByIdWithReferences(int ID) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCONVENIO repositorio = new RepositorioCONVENIO(context); return(repositorio.GetByIdWithReferences(ID)); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List <CONVENIO> GetAllWithReferences() { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCONVENIO repositorio = new RepositorioCONVENIO(context); return(repositorio.GetAllWithReferences().OrderBy(i => i.NOMBRE).ToList()); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List <CONVENIO> GetByFilterWithReferences(int?TIPO_PRESTACIONId = null, string NOMBRE = "") { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCONVENIO repositorio = new RepositorioCONVENIO(context); return(repositorio.GetByFilterWithReferences(TIPO_PRESTACIONId, NOMBRE).OrderBy(i => i.ID).ToList()); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int TIPO_PRESTACIONId, string NOMBRE) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCONVENIO repositorio = new RepositorioCONVENIO(context); CONVENIO _CONVENIO = repositorio.GetById(Id); if (Equals(_CONVENIO, null)) { throw new Exception(String.Concat("No se ha encontrado CONVENIO con Id =", Id.ToString())); } RepositorioTIPO_PRESTACION _repositorioTIPO_PRESTACION = new RepositorioTIPO_PRESTACION(context); TIPO_PRESTACION _objTIPO_PRESTACION = _repositorioTIPO_PRESTACION.GetById(TIPO_PRESTACIONId); if (Equals(_objTIPO_PRESTACION, null)) { throw new Exception(String.Concat("No se ha encontrado TIPO_PRESTACION con Id =", TIPO_PRESTACIONId.ToString())); } //properties if (!string.IsNullOrEmpty(NOMBRE)) { _CONVENIO.NOMBRE = NOMBRE; } //parents _CONVENIO.TIPO_PRESTACION = _objTIPO_PRESTACION; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int CONVENIOId, System.DateTime FECHA_VIGENCIA) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCONVENIO_TARIFARIO repositorio = new RepositorioCONVENIO_TARIFARIO(context); CONVENIO_TARIFARIO _CONVENIO_TARIFARIO = repositorio.GetById(Id); if (Equals(_CONVENIO_TARIFARIO, null)) { throw new Exception(String.Concat("No se ha encontrado CONVENIO_TARIFARIO con Id =", Id.ToString())); } RepositorioCONVENIO _repositorioCONVENIO = new RepositorioCONVENIO(context); CONVENIO _objCONVENIO = _repositorioCONVENIO.GetById(CONVENIOId); if (Equals(_objCONVENIO, null)) { throw new Exception(String.Concat("No se ha encontrado CONVENIO con Id =", CONVENIOId.ToString())); } //properties _CONVENIO_TARIFARIO.FECHA_VIGENCIA = FECHA_VIGENCIA; //parents _CONVENIO_TARIFARIO.CONVENIO = _objCONVENIO; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public int Add(int CONVENIOId, System.DateTime FECHA_VIGENCIA) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCONVENIO _repositorioCONVENIO = new RepositorioCONVENIO(context); CONVENIO _objCONVENIO = _repositorioCONVENIO.GetById(CONVENIOId); if (Equals(_objCONVENIO, null)) { throw new Exception(String.Concat("No se ha encontrado CONVENIO con Id =", CONVENIOId.ToString())); } CONVENIO_TARIFARIO _CONVENIO_TARIFARIO = new CONVENIO_TARIFARIO(); //properties _CONVENIO_TARIFARIO.FECHA_VIGENCIA = FECHA_VIGENCIA; _CONVENIO_TARIFARIO.ACTIVO = true; //parents _CONVENIO_TARIFARIO.CONVENIO = _objCONVENIO; context.AddObject("CONVENIO_TARIFARIO", _CONVENIO_TARIFARIO); context.SaveChanges(); return(_CONVENIO_TARIFARIO.ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int COMUNAId, int CONVENIOId, int TIPO_PRESTACIONId, int TIPO_FACTURAId, string RUT, string NOMBRE, int?DESCUENTO = null, string DIRECCION = "", string FONO = "", string GIRO = "") { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCLIENTE repositorio = new RepositorioCLIENTE(context); CLIENTE _CLIENTE = repositorio.GetById(Id); if (Equals(_CLIENTE, null)) { throw new Exception(String.Concat("No se ha encontrado CLIENTE con Id =", Id.ToString())); } RepositorioCOMUNA _repositorioCOMUNA = new RepositorioCOMUNA(context); COMUNA _objCOMUNA = _repositorioCOMUNA.GetById(COMUNAId); if (Equals(_objCOMUNA, null)) { throw new Exception(String.Concat("No se ha encontrado COMUNA con Id =", COMUNAId.ToString())); } RepositorioCONVENIO _repositorioCONVENIO = new RepositorioCONVENIO(context); CONVENIO _objCONVENIO = _repositorioCONVENIO.GetById(CONVENIOId); if (Equals(_objCONVENIO, null)) { throw new Exception(String.Concat("No se ha encontrado CONVENIO con Id =", CONVENIOId.ToString())); } RepositorioTIPO_PRESTACION _repositorioTIPO_PRESTACION = new RepositorioTIPO_PRESTACION(context); TIPO_PRESTACION _objTIPO_PRESTACION = _repositorioTIPO_PRESTACION.GetById(TIPO_PRESTACIONId); if (Equals(_objTIPO_PRESTACION, null)) { throw new Exception(String.Concat("No se ha encontrado TIPO_PRESTACION con Id =", TIPO_PRESTACIONId.ToString())); } RepositorioTIPO_FACTURA _repositorioTIPO_FACTURA = new RepositorioTIPO_FACTURA(context); TIPO_FACTURA _objTIPO_FACTURA = _repositorioTIPO_FACTURA.GetById(TIPO_FACTURAId); if (Equals(_objTIPO_FACTURA, null)) { throw new Exception(String.Concat("No se ha encontrado TIPO_FACTURA con Id =", TIPO_FACTURAId.ToString())); } //properties if (!string.IsNullOrEmpty(RUT)) { _CLIENTE.RUT = RUT; } if (!string.IsNullOrEmpty(NOMBRE)) { _CLIENTE.NOMBRE = NOMBRE; } if (DESCUENTO.HasValue) { _CLIENTE.DESCUENTO = DESCUENTO.Value; } if (!string.IsNullOrEmpty(DIRECCION)) { _CLIENTE.DIRECCION = DIRECCION; } if (!string.IsNullOrEmpty(FONO)) { _CLIENTE.FONO = FONO; } if (!string.IsNullOrEmpty(GIRO)) { _CLIENTE.GIRO = GIRO; } //parents _CLIENTE.COMUNA = _objCOMUNA; _CLIENTE.CONVENIO = _objCONVENIO; _CLIENTE.TIPO_PRESTACION = _objTIPO_PRESTACION; _CLIENTE.TIPO_FACTURA = _objTIPO_FACTURA; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public int Add(int COMUNAId, int CONVENIOId, int TIPO_PRESTACIONId, int TIPO_FACTURAId, string RUT, string NOMBRE, int?DESCUENTO = null, string DIRECCION = "", string FONO = "", string GIRO = "") { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCOMUNA _repositorioCOMUNA = new RepositorioCOMUNA(context); COMUNA _objCOMUNA = _repositorioCOMUNA.GetById(COMUNAId); if (Equals(_objCOMUNA, null)) { throw new Exception(String.Concat("No se ha encontrado COMUNA con Id =", COMUNAId.ToString())); } RepositorioCONVENIO _repositorioCONVENIO = new RepositorioCONVENIO(context); CONVENIO _objCONVENIO = _repositorioCONVENIO.GetById(CONVENIOId); if (Equals(_objCONVENIO, null)) { throw new Exception(String.Concat("No se ha encontrado CONVENIO con Id =", CONVENIOId.ToString())); } RepositorioTIPO_PRESTACION _repositorioTIPO_PRESTACION = new RepositorioTIPO_PRESTACION(context); TIPO_PRESTACION _objTIPO_PRESTACION = _repositorioTIPO_PRESTACION.GetById(TIPO_PRESTACIONId); if (Equals(_objTIPO_PRESTACION, null)) { throw new Exception(String.Concat("No se ha encontrado TIPO_PRESTACION con Id =", TIPO_PRESTACIONId.ToString())); } RepositorioTIPO_FACTURA _repositorioTIPO_FACTURA = new RepositorioTIPO_FACTURA(context); TIPO_FACTURA _objTIPO_FACTURA = _repositorioTIPO_FACTURA.GetById(TIPO_FACTURAId); if (Equals(_objTIPO_FACTURA, null)) { throw new Exception(String.Concat("No se ha encontrado TIPO_FACTURA con Id =", TIPO_FACTURAId.ToString())); } CLIENTE _CLIENTE = new CLIENTE(); //properties _CLIENTE.RUT = RUT; _CLIENTE.NOMBRE = NOMBRE; _CLIENTE.DESCUENTO = DESCUENTO; _CLIENTE.DIRECCION = DIRECCION; _CLIENTE.FONO = FONO; _CLIENTE.GIRO = GIRO; _CLIENTE.ACTIVO = true; //parents _CLIENTE.COMUNA = _objCOMUNA; _CLIENTE.CONVENIO = _objCONVENIO; _CLIENTE.TIPO_PRESTACION = _objTIPO_PRESTACION; _CLIENTE.TIPO_FACTURA = _objTIPO_FACTURA; context.AddObject("CLIENTE", _CLIENTE); context.SaveChanges(); return(_CLIENTE.ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }