public int Add(string NOMBRE, string NOMBRE_REPORTE_DETALLE_FACTURA = "") { Init(); try { using (LQCEEntities context = new LQCEEntities()) { TIPO_PRESTACION _TIPO_PRESTACION = new TIPO_PRESTACION(); //properties _TIPO_PRESTACION.NOMBRE = NOMBRE; _TIPO_PRESTACION.NOMBRE_REPORTE_DETALLE_FACTURA = NOMBRE_REPORTE_DETALLE_FACTURA; _TIPO_PRESTACION.ACTIVO = true; //parents context.AddObject("TIPO_PRESTACION", _TIPO_PRESTACION); context.SaveChanges(); return(_TIPO_PRESTACION.ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Delete(int Id) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioTIPO_PRESTACION repositorio = new RepositorioTIPO_PRESTACION(context); TIPO_PRESTACION _TIPO_PRESTACION = repositorio.GetById(Id); if (Equals(_TIPO_PRESTACION, null)) { throw new Exception(String.Concat("No se ha encontrado TIPO_PRESTACION con Id =", Id.ToString())); } _TIPO_PRESTACION.ACTIVO = false; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int CARGA_PRESTACIONES_ESTADOId, int TIPO_PRESTACIONId, System.DateTime FECHA_CARGA, string ARCHIVO) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCARGA_PRESTACIONES_ENCABEZADO repositorio = new RepositorioCARGA_PRESTACIONES_ENCABEZADO(context); CARGA_PRESTACIONES_ENCABEZADO _CARGA_PRESTACIONES_ENCABEZADO = repositorio.GetById(Id); if (Equals(_CARGA_PRESTACIONES_ENCABEZADO, null)) { throw new Exception(String.Concat("No se ha encontrado CARGA_PRESTACIONES_ENCABEZADO con Id =", Id.ToString())); } RepositorioCARGA_PRESTACIONES_ESTADO _repositorioCARGA_PRESTACIONES_ESTADO = new RepositorioCARGA_PRESTACIONES_ESTADO(context); CARGA_PRESTACIONES_ESTADO _objCARGA_PRESTACIONES_ESTADO = _repositorioCARGA_PRESTACIONES_ESTADO.GetById(CARGA_PRESTACIONES_ESTADOId); if (Equals(_objCARGA_PRESTACIONES_ESTADO, null)) { throw new Exception(String.Concat("No se ha encontrado CARGA_PRESTACIONES_ESTADO con Id =", CARGA_PRESTACIONES_ESTADOId.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 _CARGA_PRESTACIONES_ENCABEZADO.FECHA_CARGA = FECHA_CARGA; if (!string.IsNullOrEmpty(ARCHIVO)) { _CARGA_PRESTACIONES_ENCABEZADO.ARCHIVO = ARCHIVO; } //parents _CARGA_PRESTACIONES_ENCABEZADO.CARGA_PRESTACIONES_ESTADO = _objCARGA_PRESTACIONES_ESTADO; _CARGA_PRESTACIONES_ENCABEZADO.TIPO_PRESTACION = _objTIPO_PRESTACION; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public int Add(int CARGA_PRESTACIONES_ESTADOId, int TIPO_PRESTACIONId, System.DateTime FECHA_CARGA, string ARCHIVO) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCARGA_PRESTACIONES_ESTADO _repositorioCARGA_PRESTACIONES_ESTADO = new RepositorioCARGA_PRESTACIONES_ESTADO(context); CARGA_PRESTACIONES_ESTADO _objCARGA_PRESTACIONES_ESTADO = _repositorioCARGA_PRESTACIONES_ESTADO.GetById(CARGA_PRESTACIONES_ESTADOId); if (Equals(_objCARGA_PRESTACIONES_ESTADO, null)) { throw new Exception(String.Concat("No se ha encontrado CARGA_PRESTACIONES_ESTADO con Id =", CARGA_PRESTACIONES_ESTADOId.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())); } CARGA_PRESTACIONES_ENCABEZADO _CARGA_PRESTACIONES_ENCABEZADO = new CARGA_PRESTACIONES_ENCABEZADO(); //properties _CARGA_PRESTACIONES_ENCABEZADO.FECHA_CARGA = FECHA_CARGA; _CARGA_PRESTACIONES_ENCABEZADO.ARCHIVO = ARCHIVO; _CARGA_PRESTACIONES_ENCABEZADO.ACTIVO = true; //parents _CARGA_PRESTACIONES_ENCABEZADO.CARGA_PRESTACIONES_ESTADO = _objCARGA_PRESTACIONES_ESTADO; _CARGA_PRESTACIONES_ENCABEZADO.TIPO_PRESTACION = _objTIPO_PRESTACION; context.AddObject("CARGA_PRESTACIONES_ENCABEZADO", _CARGA_PRESTACIONES_ENCABEZADO); context.SaveChanges(); return(_CARGA_PRESTACIONES_ENCABEZADO.ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int TIPO_PRESTACIONId, string CODIGO, string NOMBRE) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioEXAMEN repositorio = new RepositorioEXAMEN(context); EXAMEN _EXAMEN = repositorio.GetById(Id); if (Equals(_EXAMEN, null)) { throw new Exception(String.Concat("No se ha encontrado EXAMEN 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(CODIGO)) { _EXAMEN.CODIGO = CODIGO; } if (!string.IsNullOrEmpty(NOMBRE)) { _EXAMEN.NOMBRE = NOMBRE; } //parents _EXAMEN.TIPO_PRESTACION = _objTIPO_PRESTACION; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public int Add(int TIPO_PRESTACIONId, string CODIGO, string NOMBRE) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { 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())); } EXAMEN _EXAMEN = new EXAMEN(); //properties _EXAMEN.CODIGO = CODIGO; _EXAMEN.NOMBRE = NOMBRE; _EXAMEN.ACTIVO = true; //parents _EXAMEN.TIPO_PRESTACION = _objTIPO_PRESTACION; context.AddObject("EXAMEN", _EXAMEN); context.SaveChanges(); return(_EXAMEN.ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, string NOMBRE, string NOMBRE_REPORTE_DETALLE_FACTURA = "") { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioTIPO_PRESTACION repositorio = new RepositorioTIPO_PRESTACION(context); TIPO_PRESTACION _TIPO_PRESTACION = repositorio.GetById(Id); if (Equals(_TIPO_PRESTACION, null)) { throw new Exception(String.Concat("No se ha encontrado TIPO_PRESTACION con Id =", Id.ToString())); } //properties if (!string.IsNullOrEmpty(NOMBRE)) { _TIPO_PRESTACION.NOMBRE = NOMBRE; } if (!string.IsNullOrEmpty(NOMBRE_REPORTE_DETALLE_FACTURA)) { _TIPO_PRESTACION.NOMBRE_REPORTE_DETALLE_FACTURA = NOMBRE_REPORTE_DETALLE_FACTURA; } //parents context.SaveChanges(); } } 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; } }
public void AddToTIPO_PRESTACION(TIPO_PRESTACION tIPO_PRESTACION) { base.AddObject("TIPO_PRESTACION", tIPO_PRESTACION); }
public static TIPO_PRESTACION CreateTIPO_PRESTACION(int id, string nOMBRE, bool aCTIVO) { TIPO_PRESTACION tIPO_PRESTACION = new TIPO_PRESTACION(); tIPO_PRESTACION.ID = id; tIPO_PRESTACION.NOMBRE = nOMBRE; tIPO_PRESTACION.ACTIVO = aCTIVO; return tIPO_PRESTACION; }
public void Update(int Id, int CLIENTEId, int GARANTIAId, int PREVISIONId, int TIPO_PRESTACIONId, System.DateTime FECHA_RECEPCION, string MEDICO = "", string RECEPCION = "", string PENDIENTE = "") { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION repositorio = new RepositorioPRESTACION(context); PRESTACION _PRESTACION = repositorio.GetById(Id); if (Equals(_PRESTACION, null)) { throw new Exception(String.Concat("No se ha encontrado PRESTACION con Id =", Id.ToString())); } RepositorioCLIENTE _repositorioCLIENTE = new RepositorioCLIENTE(context); CLIENTE _objCLIENTE = _repositorioCLIENTE.GetById(CLIENTEId); if (Equals(_objCLIENTE, null)) { throw new Exception(String.Concat("No se ha encontrado CLIENTE con Id =", CLIENTEId.ToString())); } RepositorioGARANTIA _repositorioGARANTIA = new RepositorioGARANTIA(context); GARANTIA _objGARANTIA = _repositorioGARANTIA.GetById(GARANTIAId); if (Equals(_objGARANTIA, null)) { throw new Exception(String.Concat("No se ha encontrado GARANTIA con Id =", GARANTIAId.ToString())); } RepositorioPREVISION _repositorioPREVISION = new RepositorioPREVISION(context); PREVISION _objPREVISION = _repositorioPREVISION.GetById(PREVISIONId); if (Equals(_objPREVISION, null)) { throw new Exception(String.Concat("No se ha encontrado PREVISION con Id =", PREVISIONId.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(MEDICO)) { _PRESTACION.MEDICO = MEDICO; } _PRESTACION.FECHA_RECEPCION = FECHA_RECEPCION; if (!string.IsNullOrEmpty(RECEPCION)) { _PRESTACION.RECEPCION = RECEPCION; } if (!string.IsNullOrEmpty(PENDIENTE)) { _PRESTACION.PENDIENTE = PENDIENTE; } //parents _PRESTACION.CLIENTE = _objCLIENTE; _PRESTACION.GARANTIA = _objGARANTIA; _PRESTACION.PREVISION = _objPREVISION; _PRESTACION.TIPO_PRESTACION = _objTIPO_PRESTACION; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public int Add(int CLIENTEId, int GARANTIAId, int PREVISIONId, int TIPO_PRESTACIONId, System.DateTime FECHA_RECEPCION, string MEDICO = "", string RECEPCION = "", string PENDIENTE = "") { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioCLIENTE _repositorioCLIENTE = new RepositorioCLIENTE(context); CLIENTE _objCLIENTE = _repositorioCLIENTE.GetById(CLIENTEId); if (Equals(_objCLIENTE, null)) { throw new Exception(String.Concat("No se ha encontrado CLIENTE con Id =", CLIENTEId.ToString())); } RepositorioGARANTIA _repositorioGARANTIA = new RepositorioGARANTIA(context); GARANTIA _objGARANTIA = _repositorioGARANTIA.GetById(GARANTIAId); if (Equals(_objGARANTIA, null)) { throw new Exception(String.Concat("No se ha encontrado GARANTIA con Id =", GARANTIAId.ToString())); } RepositorioPREVISION _repositorioPREVISION = new RepositorioPREVISION(context); PREVISION _objPREVISION = _repositorioPREVISION.GetById(PREVISIONId); if (Equals(_objPREVISION, null)) { throw new Exception(String.Concat("No se ha encontrado PREVISION con Id =", PREVISIONId.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())); } PRESTACION _PRESTACION = new PRESTACION(); //properties _PRESTACION.MEDICO = MEDICO; _PRESTACION.FECHA_RECEPCION = FECHA_RECEPCION; _PRESTACION.RECEPCION = RECEPCION; _PRESTACION.PENDIENTE = PENDIENTE; _PRESTACION.ACTIVO = true; //parents _PRESTACION.CLIENTE = _objCLIENTE; _PRESTACION.GARANTIA = _objGARANTIA; _PRESTACION.PREVISION = _objPREVISION; _PRESTACION.TIPO_PRESTACION = _objTIPO_PRESTACION; context.AddObject("PRESTACION", _PRESTACION); context.SaveChanges(); return(_PRESTACION.ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }