public void ActualizarGrupo(FinancieraGrupo nuevo, FinancieraGrupo original) { EmpeñosDC entidades = new EmpeñosDC(new clsConeccionDB().StringConn()); entidades.FinancieraGrupos.Attach(nuevo, original); entidades.SubmitChanges(); }
private void ActualizarCredito(decimal pago) { //_entidades=new EmpeñosDC(new clsConeccionDB().StringConn()); FinancieraCredito credito = _entidades.FinancieraCreditos.Single(c => c.Clave == Convert.ToInt32(txtCveCredito.EditValue)); credito.SaldoActual = credito.SaldoActual - pago; //_entidades.SubmitChanges(); if (credito.SaldoActual == 0) { credito.Estado = "Pagado"; //_entidades.SubmitChanges(); ImprimirRetiroBase(); FinancieraGrupo grupo = _entidades.FinancieraGrupos.Single(c => c.Clave == Convert.ToInt32(txtCveGrupo.EditValue)); grupo.Estado = "INACTIVO"; foreach (FinancieraGruposDetalle integrantes in grupo.FinancieraGruposDetalles) { integrantes.Aprobado = 0; integrantes.Base = 0; } //_entidades.SubmitChanges(); } _entidades.SubmitChanges(); }
private void XfrmGrupo_Shown(object sender, EventArgs e) { if (CveGrupo == 0) { Nuevo(); grvIntegrantes.Columns[3].Visible = false; grvIntegrantes.Columns[4].Visible = false; btnImprimirDeposito.Enabled = false; } else { FinancieraGrupo grupo = _entidades.FinancieraGrupos.First(g => g.Clave == CveGrupo); txtCveGrupo.EditValue = grupo.Clave; txtNombreGrupo.EditValue = grupo.Nombre; cboEstado.EditValue = grupo.Estado == "INACTIVO" ? "PROCESO" : grupo.Estado; foreach (FinancieraGruposDetalle detgpo in grupo.FinancieraGruposDetalles) { dtIntegrantesGrupo.Rows.Add(new object[] { detgpo.CveCliente, detgpo.FinancieraCliente.Nombre, detgpo.Solicitado, detgpo.Aprobado, detgpo.Base, detgpo.Tipo }); } //grvIntegrantes.Columns[2].OptionsColumn.AllowEdit = false; grvIntegrantes.Columns[4].OptionsColumn.AllowEdit = false; if (grupo.Estado == "ACTIVO" || grupo.Estado == "APROBADO") { botonGuardar.Enabled = false; btnImprimirDeposito.Enabled = false; } } }
private void ActualizarGrupo(int p) { FinancieraGrupo grupomod = _entidades.FinancieraGrupos.First(g => g.Clave == p); FinancieraGrupo grupo = new FinancieraGrupo() { Clave = grupomod.Clave, Nombre = txtNombreGrupo.Text, Estado = "ACTIVO", FechaModificacion = DateTime.Today, CveUsuario = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IdUsuarioApp")), }; new LogicaGrupos().ActualizarGrupo(grupo, grupomod); //new LogicaGrupos().EliminarDetalles(grupomod.Clave); //foreach (DataRow fila in dtIntegrantesGrupo.Rows) //{ // FinancieraGruposDetalle detGrupo = new FinancieraGruposDetalle() // { // CveGrupo = Convert.ToInt32(txtCveGrupo.EditValue), // CveCliente = Convert.ToInt32(fila[0]), // Solicitado = Convert.ToDecimal(fila[2]), // Aprobado = Convert.ToDecimal(fila[3]), // Base = Convert.ToDecimal(fila[4]), // Tipo = fila[5].ToString(), // FechaModificacion = DateTime.Today.Date, // }; // new LogicaGrupos().AgregarIntegranteGrupo(detGrupo); //} }
private void btnImprimirSocioEconomico_Click(object sender, EventArgs e) { FinancieraGrupo grupo = _entidades.FinancieraGrupos.First(g => g.Clave == Convert.ToInt32(txtCveGrupo.EditValue)); XrptSocioEconomico rptEconomico = new XrptSocioEconomico { DatosInforme = { DataSource = grupo } }; rptEconomico.ShowPreviewDialog(); }
public int AgregarGrupo(FinancieraGrupo grupo) { if (grupo.Nombre == string.Empty) { throw new ValidationException("Indique el nombre del Grupo"); } _entidades.FinancieraGrupos.InsertOnSubmit(grupo); _entidades.SubmitChanges(); return(grupo.Clave); }
private void CancelarCredito() { FinancieraCredito credito = _entidades.FinancieraCreditos.First( cre => cre.Clave == Convert.ToInt32(grvDatos.GetFocusedRowCellDisplayText("Clave"))); credito.Estado = "Cancelado"; FinancieraGrupo grupo = _entidades.FinancieraGrupos.Single(c => c.Clave == credito.CveGrupo); grupo.Estado = "INACTIVO"; _entidades.SubmitChanges(); Insertarcancelacion("Crédito", grvDatos.GetFocusedRowCellDisplayText("Clave")); }
private void ClienteDevuelto(string clave) { dtIntegrantesGrupo.Rows.Clear(); FinancieraGrupo grupo = _entidades.FinancieraGrupos.First(cl => cl.Clave == Convert.ToInt32(clave)); txtCveGrupo.EditValue = grupo.Clave; txtNombreGrupo.EditValue = grupo.Nombre; txtEstado.EditValue = grupo.Estado; IQueryable <FinancieraGruposDetalle> detgrupo = _entidades.FinancieraGruposDetalles.Where( dg => dg.CveGrupo == Convert.ToInt32(txtCveGrupo.EditValue)); foreach (var detGrupo in detgrupo) { decimal pagoPuntual = decimal.Round(obtenerPagoXletra(detGrupo.Aprobado), 1); decimal pagoAtrasado = decimal.Round((pagoPuntual + (pagoPuntual * Convert.ToDecimal(txtRecargoG.EditValue))), 1); dtIntegrantesGrupo.Rows.Add(new object[] { detGrupo.CveCliente, detGrupo.FinancieraCliente.Nombre, detGrupo.Solicitado, detGrupo.Aprobado, detGrupo.Base, null, null, null, pagoPuntual, pagoAtrasado }); } }
private void CancelarPagosCredito() { FinancieraPago pcredito = _entidades.FinancieraPagos.First( cre => cre.Clave == Convert.ToInt32(grvDatos.GetFocusedRowCellDisplayText("Clave"))); pcredito.Estado = false; //_entidades.SubmitChanges(); FinancieraCredito credito = _entidades.FinancieraCreditos.First( cre => cre.Clave == pcredito.CveCredito); credito.SaldoActual = credito.SaldoActual + pcredito.Pago; credito.Estado = "Activo"; FinancieraGrupo grupo = _entidades.FinancieraGrupos.Single(fg => fg.Clave == credito.CveGrupo); grupo.Estado = "ACTIVO"; _entidades.SubmitChanges(); Insertarcancelacion("Pagos Credito", grvDatos.GetFocusedRowCellDisplayText("Clave")); }
public void Guardar() { //if (!ChecarCantidad()) // return; if ((int)txtCveGrupo.EditValue == 0) { FinancieraGrupo grupo = new FinancieraGrupo() { Nombre = txtNombreGrupo.Text, Estado = "PROCESO", FechaModificacion = DateTime.Today, CveUsuario = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IdUsuarioApp")), }; txtCveGrupo.EditValue = new LogicaGrupos().AgregarGrupo(grupo); foreach (DataRow fila in dtIntegrantesGrupo.Rows) { FinancieraGruposDetalle detGrupo = new FinancieraGruposDetalle() { CveGrupo = Convert.ToInt32(txtCveGrupo.EditValue), CveCliente = Convert.ToInt32(fila[0]), Solicitado = Convert.ToDecimal(fila[2]), Aprobado = 0M, Base = 0M, Tipo = fila[5].ToString(), FechaModificacion = DateTime.Today.Date, }; new LogicaGrupos().AgregarIntegranteGrupo(detGrupo); } cboEstado.Text = "PROCESO"; } else { FinancieraGrupo grupomod = _entidades.FinancieraGrupos.First(g => g.Clave == Convert.ToInt32(txtCveGrupo.EditValue)); //FinancieraGrupo grupo = new FinancieraGrupo() //{ // Clave = grupomod.Clave, // Nombre = txtNombreGrupo.Text, // Estado = cboEstado.Text, // FechaModificacion = DateTime.Today, // CveUsuario = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IdUsuarioApp")), //}; //new LogicaGrupos().ActualizarGrupo(grupo, grupomod); grupomod.Nombre = txtNombreGrupo.Text; grupomod.Estado = cboEstado.Text; grupomod.CveUsuario = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IdUsuarioApp")); _entidades.SubmitChanges(); new LogicaGrupos().EliminarDetalles(grupomod.Clave); foreach (DataRow fila in dtIntegrantesGrupo.Rows) { FinancieraGruposDetalle detGrupo = new FinancieraGruposDetalle() { CveGrupo = Convert.ToInt32(txtCveGrupo.EditValue), CveCliente = Convert.ToInt32(fila[0]), Solicitado = Convert.ToDecimal(fila[2]), Aprobado = Convert.ToDecimal(fila[3]), Base = Convert.ToDecimal(fila[4]), Tipo = fila[5].ToString(), FechaModificacion = DateTime.Today.Date, }; new LogicaGrupos().AgregarIntegranteGrupo(detGrupo); } if (grvIntegrantes.Columns["Base"].Visible) { btnImprimirDeposito.Enabled = true; } } btnImprimirSocioEconomico.Enabled = true; }