public decimal GetIdcancelacion(int IdEmpresa) { try { decimal Id; EntitiesCuentasxPagar ECXP = new EntitiesCuentasxPagar(); ECXP.SetCommandTimeOut(3000); try { Id = (ECXP.cp_orden_pago_cancelaciones.Where(q => q.IdEmpresa == IdEmpresa).Max(q => q.Idcancelacion)) + 1; } catch (Exception) { return(1); } return(Id); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public List <cp_orden_pago_det_Info> Get_list_orden_pago_con_cta_acreedora(int IdEmpresa, List <decimal> list_op) { try { List <cp_orden_pago_det_Info> Lista = new List <cp_orden_pago_det_Info>(); using (EntitiesCuentasxPagar Context = new EntitiesCuentasxPagar()) { Context.SetCommandTimeOut(5000); foreach (var item_op in list_op) { var lst = from q in Context.vwcp_orden_pago_det_con_cta_acreedora where q.IdEmpresa == IdEmpresa && q.IdOrdenPago == item_op select q; foreach (var item in lst) { cp_orden_pago_det_Info info = new cp_orden_pago_det_Info(); info.IdEmpresa = item.IdEmpresa; info.IdOrdenPago = item.IdOrdenPago == null ? 0 : Convert.ToDecimal(item.IdOrdenPago); info.Secuencia = item.Secuencia == null ? 0 : Convert.ToInt32(item.Secuencia); info.IdEmpresa_cxp = item.IdEmpresa_cxp; info.IdCbteCble_cxp = item.IdCbteCble_cxp; info.IdTipoCbte_cxp = item.IdTipoCbte_cxp; info.Valor_a_pagar = item.Valor_a_pagar; info.Referencia = item.Referencia; info.IdFormaPago = item.IdFormaPago; info.Fecha_Pago = item.Fecha_Pago == null ? DateTime.Now.Date : Convert.ToDateTime(item.Fecha_Pago); info.pr_nombre = item.Nombre; info.IdCtaCble_Acreedora = item.IdCtaCble_Acreedora; info.Observacion = item.Observacion; info.IdTipo_op = item.IdTipo_op; info.IdTipo_Persona = item.IdTipo_Persona; info.IdPersona = item.IdPersona; info.IdEntidad = item.IdEntidad == null ? 0 : Convert.ToDecimal(item.IdEntidad); Lista.Add(info); } } } return(Lista); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public List <cp_orden_pago_det_Info> Get_list_orden_pago_con_cta_acreedora(int IdEmpresa, List <decimal> list_op) { try { List <cp_orden_pago_det_Info> Lista = new List <cp_orden_pago_det_Info>(); using (EntitiesCuentasxPagar Context = new EntitiesCuentasxPagar()) { Context.SetCommandTimeOut(5000); foreach (var item_op in list_op) { var lst = Context.vwcp_orden_pago_det_con_cta_acreedora.Where(q => q.IdEmpresa == IdEmpresa && q.IdOrdenPago == item_op).FirstOrDefault(); if (lst != null) { Lista.Add(new cp_orden_pago_det_Info { IdEmpresa = lst.IdEmpresa, IdOrdenPago = lst.IdOrdenPago, Secuencia = lst.Secuencia, IdEmpresa_cxp = lst.IdEmpresa_cxp, IdCbteCble_cxp = lst.IdCbteCble_cxp, IdTipoCbte_cxp = lst.IdTipoCbte_cxp, Valor_a_pagar = lst.Valor_a_pagar, Referencia = lst.Referencia, IdFormaPago = lst.IdFormaPago, Fecha_Pago = lst.Fecha_Pago == null ? DateTime.Now.Date : Convert.ToDateTime(lst.Fecha_Pago), pr_nombre = lst.Nombre, IdCtaCble_Acreedora = lst.IdCtaCble_Acreedora, Observacion = lst.Observacion, IdTipo_op = lst.IdTipo_op, IdTipo_Persona = lst.IdTipo_Persona, IdPersona = lst.IdPersona, IdEntidad = lst.IdEntidad ?? 0, }); } } } return(Lista); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean GrabarDB(List <cp_retencion_det_Info> lista) { try { int secuencia = 0; EntitiesCuentasxPagar Cp = new EntitiesCuentasxPagar(); foreach (var item in lista) { Cp.SetCommandTimeOut(3000); cp_retencion_det det = new cp_retencion_det(); det.IdEmpresa = item.IdEmpresa; // det.IdCbteCble_Ogiro = item.IdCbteCble_Ogiro; // det.IdTipoCbte_Ogiro = item.IdTipoCbte_Ogiro; det.IdRetencion = item.IdRetencion; det.Idsecuencia = ++secuencia; det.re_tipoRet = item.re_tipoRet; det.re_baseRetencion = item.re_baseRetencion; det.IdCodigo_SRI = item.IdCodigo_SRI; det.re_Codigo_impuesto = item.re_Codigo_impuesto; det.re_Porcen_retencion = item.re_Porcen_retencion; det.re_valor_retencion = Convert.ToDouble(item.re_valor_retencion); det.re_estado = "A"; det.IdUsuario = item.IdUsuario; det.Fecha_Transac = DateTime.Now; det.nom_pc = item.nom_pc; det.ip = item.ip; Cp.cp_retencion_det.Add(det); } Cp.SaveChanges(); return(true); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }