public List <cxc_cobro_x_Anticipo_det_Info> Get_List_cobro_x_Anticipo_det(int IdEmpresa, int IdAnticipo, ref string mensaje) { try { List <cxc_cobro_x_Anticipo_det_Info> Lst = new List <cxc_cobro_x_Anticipo_det_Info>(); using (EntitiesCuentas_x_Cobrar cxc = new EntitiesCuentas_x_Cobrar()) { var consul = from q in cxc.cxc_cobro_x_Anticipo_det where q.IdEmpresa == IdEmpresa && q.IdAnticipo == IdAnticipo select q; foreach (var item in consul) { cxc_cobro_x_Anticipo_det_Info info = new cxc_cobro_x_Anticipo_det_Info(); info.IdEmpresa = item.IdEmpresa; info.IdAnticipo = item.IdAnticipo; info.IdCobro_cobro = item.IdCobro_cobro; info.IdCobro_tipo = item.IdCobro_tipo; info.Secuencia = item.Secuencia; info.IdEmpresa_Cobro = item.IdEmpresa_Cobro; info.IdSucursal_cobro = item.IdSucursal_cobro; info.Fecha_Transac = item.Fecha_Transac; info.IdUsuario = item.IdUsuario; info.IdUsuarioUltMod = item.IdUsuarioUltMod; info.Fecha_UltMod = item.Fecha_UltMod; info.IdUsuarioUltAnu = item.IdUsuarioUltAnu; info.Fecha_UltAnu = item.Fecha_UltAnu; info.nom_pc = item.nom_pc; info.ip = item.ip; info.Estado = item.Estado; info.MotiAnula = item.MotiAnula; Lst.Add(info); } } return(Lst); } 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()); } }
public Boolean GuardarDB(cxc_cobro_x_Anticipo_Info infoAnticipo, ref string mensaje, Boolean Generar_Cobro_x_det, Cl_Enumeradores.PantallaEjecucion Accion) { try { Boolean resGrabar = true; if (validar_objeto(infoAnticipo, ref mensaje)) { cxc_cobro_Bus cobroBus = new cxc_cobro_Bus(); //grabando cabecera de anticipo resGrabar = data.GrabarDB(infoAnticipo, ref mensaje); foreach (var item in infoAnticipo.listDetalle_Anticipo) { item.IdEmpresa = infoAnticipo.IdEmpresa; item.IdAnticipo = infoAnticipo.IdAnticipo; } //grabando detalle de anticipo data_det.GuardarDB(infoAnticipo.listDetalle_Anticipo, ref mensaje); if (Generar_Cobro_x_det) { int contCobro = 1; foreach (var item in infoAnticipo.listCobros) { cxc_cobro_x_Anticipo_det_Info AnticipoDetalle = new cxc_cobro_x_Anticipo_det_Info(); cxc_cobro_Info infoCobro = item; AnticipoDetalle = infoAnticipo.listDetalle_Anticipo.Find(v => v.IdFila == contCobro); infoCobro.Infocxc_cobro_x_Anticipo_det = AnticipoDetalle; decimal IdCobro = 0; if (cobroBus.GuardarDB(Accion, ref infoCobro, ref mensaje) == false) { return(false); } AnticipoDetalle.IdEmpresa_Cobro = infoCobro.IdEmpresa; AnticipoDetalle.IdCobro_cobro = infoCobro.IdCobro; AnticipoDetalle.IdSucursal_cobro = infoCobro.IdSucursal; contCobro++; } } } else { resGrabar = false; } return(resGrabar); } 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("", "Get_List_Cobro_Tipo", ex.Message), ex) { EntityType = typeof(cxc_cobro_x_Anticipo_Bus) }; } }
public Boolean Get_Info_Anticipo_Detalle() { try { int secuencia = 0; cobroAntiDetinfo = new List <cxc_cobro_x_Anticipo_det_Info>(); foreach (var item2 in cobroAntiBininfo) { secuencia++; cxc_cobro_x_Anticipo_det_Info item = new cxc_cobro_x_Anticipo_det_Info(); item.IdFila = secuencia; item.IdEmpresa = param.IdEmpresa; item.IdAnticipo = cobroAntiinfo.IdAnticipo; item.Secuencia = secuencia; item.IdCobro_tipo = item2.IdCobro_tipo; if (item2.IdEmpresa > 0) { item.IdEmpresa_Cobro = item2.IdEmpresa; } else { item.IdEmpresa_Cobro = null; } if (item2.IdSucursal > 0) { item.IdSucursal_cobro = item2.IdSucursal; } else { item.IdSucursal_cobro = null; } if (item2.IdCobro_cobro > 0) { item.IdCobro_cobro = item2.IdCobro_cobro; } else { item.IdCobro_cobro = null; } item.Fecha_Transac = param.Fecha_Transac; item.Fecha_UltAnu = null; item.Fecha_UltMod = null; item.nom_pc = param.nom_pc; item.ip = param.ip; item.IdUsuario = param.IdUsuario; item.Estado = "A"; cobroAntiDetinfo.Add(item); } return(true); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }