public void Delete(int Id) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioNOTA_CREDITO repositorio = new RepositorioNOTA_CREDITO(context); NOTA_CREDITO _NOTA_CREDITO = repositorio.GetById(Id); if (Equals(_NOTA_CREDITO, null)) { throw new Exception(String.Concat("No se ha encontrado NOTA_CREDITO con Id =", Id.ToString())); } _NOTA_CREDITO.ACTIVO = false; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int FACTURAId, System.DateTime FECHA_EMISION, int NUMERO_NOTA_CREDITO, bool CORRECCION_TOTAL_PARCIAL) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioNOTA_CREDITO repositorio = new RepositorioNOTA_CREDITO(context); NOTA_CREDITO _NOTA_CREDITO = repositorio.GetById(Id); if (Equals(_NOTA_CREDITO, null)) { throw new Exception(String.Concat("No se ha encontrado NOTA_CREDITO con Id =", Id.ToString())); } RepositorioFACTURA _repositorioFACTURA = new RepositorioFACTURA(context); FACTURA _objFACTURA = _repositorioFACTURA.GetById(FACTURAId); if (Equals(_objFACTURA, null)) { throw new Exception(String.Concat("No se ha encontrado FACTURA con Id =", FACTURAId.ToString())); } //properties _NOTA_CREDITO.FECHA_EMISION = FECHA_EMISION; _NOTA_CREDITO.NUMERO_NOTA_CREDITO = NUMERO_NOTA_CREDITO; _NOTA_CREDITO.CORRECCION_TOTAL_PARCIAL = CORRECCION_TOTAL_PARCIAL; //parents _NOTA_CREDITO.FACTURA = _objFACTURA; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public static NOTA_CREDITO CreateNOTA_CREDITO(int id, global::System.DateTime fECHA_EMISION, int nUMERO_NOTA_CREDITO, bool cORRECCION_TOTAL_PARCIAL, bool aCTIVO) { NOTA_CREDITO nOTA_CREDITO = new NOTA_CREDITO(); nOTA_CREDITO.ID = id; nOTA_CREDITO.FECHA_EMISION = fECHA_EMISION; nOTA_CREDITO.NUMERO_NOTA_CREDITO = nUMERO_NOTA_CREDITO; nOTA_CREDITO.CORRECCION_TOTAL_PARCIAL = cORRECCION_TOTAL_PARCIAL; nOTA_CREDITO.ACTIVO = aCTIVO; return nOTA_CREDITO; }
public void AddToNOTA_CREDITO(NOTA_CREDITO nOTA_CREDITO) { base.AddObject("NOTA_CREDITO", nOTA_CREDITO); }