/// <summary>Selecciona los ahorradores registrados cuya informacíón coicida con los /// campos de la clausula where. </summary> /// <param name="tobjSocio"> El objeto ahorrador con los datos para filtrar </param> /// <returns> Un lista con los ahorradores seleccionados. </returns> public IList <Ahorrador> gmtdFiltrar(tblAhorradore tobjAhorrador) { using (dbExequial2010DataContext ahorradores = new dbExequial2010DataContext()) { var query = from aho in ahorradores.tblAhorradores where aho.bitAnulado == false && aho.strCedulaAho.StartsWith(tobjAhorrador.strCedulaAho) && aho.strNombreAho.StartsWith(tobjAhorrador.strNombreAho) && aho.strApellido1Aho.StartsWith(tobjAhorrador.strApellido1Aho) && aho.strApellido2Aho.StartsWith(tobjAhorrador.strApellido2Aho) select new { soc = aho }; List <Ahorrador> lstAhorradores = new List <Ahorrador>(); foreach (var dato in query.ToList()) { Ahorrador aho = new Ahorrador(); aho.intCodigoSoc = dato.soc.intCodigoSoc; aho.strApellidoAho = dato.soc.strApellido1Aho + " " + dato.soc.strApellido2Aho; aho.strCedulaAho = dato.soc.strCedulaAho; aho.strDireccion = dato.soc.strDireccion; aho.strNombreAho = dato.soc.strNombreAho; aho.strTelefono = dato.soc.strTelefono; lstAhorradores.Add(aho); } return(lstAhorradores); } }
/// <summary>Selecciona los ahorradores registrados cuya informacíón coicida con los campos de la clausula where. </summary> /// <param name="tobjAhorrador"> El objeto ahorrador con los datos para filtrar </param> /// <returns> Un lista con los ahorradores seleccionados. </returns> public IList <Ahorrador> gmtdFiltrar(tblAhorradore tobjAhorrador) { if (tobjAhorrador.strCedulaAho == "0") { tobjAhorrador.strCedulaAho = ""; } return(new daoAhorrador().gmtdFiltrar(tobjAhorrador)); }
private void dgv_DoubleClick(object sender, EventArgs e) { this.pmtdLimpiarText(); tblAhorradore ahorrador = new tblAhorradore(); DataGridViewSelectedRowCollection rows = ((DataGridView)sender).SelectedRows; foreach (DataGridViewRow dato in rows) { ahorrador = new blAhorrador().gmtdConsultarDetalle(dato.Cells[1].Value.ToString()); } if (ahorrador.strNombreAho != null) { this.txtCedula.Enabled = false; if (ahorrador.bitSexo == true) { this.cboSexo.SelectedIndex = 0; } else { this.cboSexo.SelectedIndex = 1; } this.txtCodigo.Text = ahorrador.intCodigoSoc.ToString(); this.txtApellido1.Text = ahorrador.strApellido1Aho; this.txtApellido2.Text = ahorrador.strApellido2Aho; this.txtApellidoBeneficiario.Text = ahorrador.strApellidoBen; this.txtCedula.Text = ahorrador.strCedulaAho; this.txtCedulaBeneficiario.Text = ahorrador.strCedulaBen; this.txtDireccion.Text = ahorrador.strDireccion; this.txtMail.Text = ahorrador.strCorreo; this.txtNombre.Text = ahorrador.strNombreAho; this.txtNombreBeneficiario.Text = ahorrador.strNombreBen; this.txtTelefono.Text = ahorrador.strTelefono; this.cboBarrios.SelectedValue = ahorrador.strCodBarrio; this.cboEscolaridad.SelectedValue = ahorrador.strEscolaridad; this.cboOficios.SelectedValue = ahorrador.strCodOficio; this.cboOrigen.SelectedText = ahorrador.strOrigen; this.cboTipo.SelectedText = ahorrador.strTipoCed; this.dtpIngreso.Value = ahorrador.dtmFechaIng; this.dtpNacimiento.Value = ahorrador.dtmFechaNac; this.chkAhorroEstudiantil.Checked = ahorrador.bitAhorroEstudiantil; this.chkExcenta4xMil.Checked = Convert.ToBoolean(ahorrador.bitCobraCuatroxMil); this.txtCedulaAut.Text = ahorrador.strCedulaAut; this.txtNombreAut.Text = ahorrador.strNombreAut; this.txtApellidoAut.Text = ahorrador.strApellidoAut; this.txtLugardeExpedicion.Text = ahorrador.strLugarExpedicion; this.dtmFechaExpedicion.Value = Convert.ToDateTime(ahorrador.dtmFechaExpedicion); } }
/// <summary> Modifica un Ahorrador. </summary> /// <param name="tobjSocio"> Un objeto del tipo Ahorrador.</param> /// <returns> Un string que indica si se ejecuto o no la operación. </returns> public string gmtdEditar(tblAhorradore tobjAhorrador) { String strResultado; try { using (dbExequial2010DataContext ahorrador = new dbExequial2010DataContext()) { tblAhorradore aho_old = ahorrador.tblAhorradores.SingleOrDefault(p => p.strCedulaAho == tobjAhorrador.strCedulaAho); aho_old.bitAhorroEstudiantil = tobjAhorrador.bitAhorroEstudiantil; aho_old.bitSexo = tobjAhorrador.bitSexo; aho_old.bitCobraCuatroxMil = tobjAhorrador.bitCobraCuatroxMil; aho_old.dtmFechaIng = tobjAhorrador.dtmFechaIng; aho_old.dtmFechaNac = tobjAhorrador.dtmFechaNac; aho_old.strCedulaAho = tobjAhorrador.strCedulaAho; aho_old.strNombreAho = tobjAhorrador.strNombreAho; aho_old.strApellido1Aho = tobjAhorrador.strApellido1Aho; aho_old.strApellido2Aho = tobjAhorrador.strApellido2Aho; aho_old.strCodBarrio = tobjAhorrador.strCodBarrio; aho_old.strCodOficio = tobjAhorrador.strCodOficio; aho_old.strCorreo = tobjAhorrador.strCorreo; aho_old.strDireccion = tobjAhorrador.strDireccion; aho_old.strEscolaridad = tobjAhorrador.strEscolaridad; aho_old.strTelefono = tobjAhorrador.strTelefono; aho_old.strTipoCed = tobjAhorrador.strTipoCed; aho_old.strOrigen = tobjAhorrador.strOrigen; aho_old.strCedulaBen = tobjAhorrador.strCedulaBen; aho_old.strNombreBen = tobjAhorrador.strNombreBen; aho_old.strApellidoBen = tobjAhorrador.strApellidoBen; aho_old.strCedulaAut = tobjAhorrador.strCedulaAut; aho_old.strNombreAut = tobjAhorrador.strNombreAut; aho_old.strApellidoAut = tobjAhorrador.strApellidoAut; aho_old.dtmFechaExpedicion = tobjAhorrador.dtmFechaExpedicion; aho_old.strLugarExpedicion = tobjAhorrador.strLugarExpedicion; ahorrador.tblLogdeActividades.InsertOnSubmit(tobjAhorrador.log); ahorrador.SubmitChanges(); strResultado = "Registro Actualizado"; } } catch (Exception ex) { new dao().gmtdInsertarError(ex); strResultado = "- Ocurrió un error al Actualizar el registro"; } return(strResultado); }
/// <summary> Consulta los datos de un determinado ahorrador. </summary> /// <param name="tstrCedulaAho"> La cédula del ahorrador a consultar. </param> /// <returns> Los datos de ahorrador consultado. </returns> public tblAhorradore gmtdConsultarDetalle(string tstrCedulaAho) { using (dbExequial2010DataContext ahorradores = new dbExequial2010DataContext()) { var query = from aho in ahorradores.tblAhorradores join ofi in ahorradores.tblOficios on aho.strCodOficio equals ofi.strCodOficio join bar in ahorradores.tblBarrios on aho.strCodBarrio equals bar.strCodBarrio where aho.bitAnulado == false && aho.strCedulaAho == tstrCedulaAho select new { ahorrador = aho }; tblAhorradore ahorrador = new tblAhorradore(); foreach (var dato in query.ToList()) { ahorrador.bitAhorroEstudiantil = dato.ahorrador.bitAhorroEstudiantil; ahorrador.bitCobraCuatroxMil = Convert.ToBoolean(dato.ahorrador.bitCobraCuatroxMil); ahorrador.bitSexo = dato.ahorrador.bitSexo; ahorrador.dtmFechaIng = dato.ahorrador.dtmFechaIng; ahorrador.dtmFechaNac = dato.ahorrador.dtmFechaNac; ahorrador.intCodigoSoc = dato.ahorrador.intCodigoSoc; ahorrador.strCedulaAho = dato.ahorrador.strCedulaAho; ahorrador.strNombreAho = dato.ahorrador.strNombreAho; ahorrador.strApellido1Aho = dato.ahorrador.strApellido1Aho; ahorrador.strApellido2Aho = dato.ahorrador.strApellido2Aho; ahorrador.strCodBarrio = dato.ahorrador.strCodBarrio; ahorrador.strCodOficio = dato.ahorrador.strCodOficio; ahorrador.strCorreo = dato.ahorrador.strCorreo; ahorrador.strDireccion = dato.ahorrador.strDireccion; ahorrador.strEscolaridad = dato.ahorrador.strEscolaridad; ahorrador.strTelefono = dato.ahorrador.strTelefono; ahorrador.strTipoCed = dato.ahorrador.strTipoCed; ahorrador.strCedulaBen = dato.ahorrador.strCedulaBen; ahorrador.strNombreBen = dato.ahorrador.strNombreBen; ahorrador.strApellidoBen = dato.ahorrador.strApellidoBen; ahorrador.strOrigen = dato.ahorrador.strOrigen; ahorrador.strTipoCed = dato.ahorrador.strTipoCed; ahorrador.strCedulaAut = dato.ahorrador.strCedulaAut; ahorrador.strNombreAut = dato.ahorrador.strNombreAut; ahorrador.strApellidoAut = dato.ahorrador.strApellidoAut; ahorrador.strLugarExpedicion = dato.ahorrador.strLugarExpedicion; ahorrador.dtmFechaExpedicion = dato.ahorrador.dtmFechaExpedicion; } return(ahorrador); } }
/// <summary> Inserta un Ahorrador. </summary> /// <param name="tobjAhorrador"> Un objeto del tipo tblAhorrador. </param> /// <returns> Un string que indica si se ejecuto o no la operación. </returns> public string gmtdInsertar(tblAhorradore tobjAhorrador) { String strRetornar; try { using (dbExequial2010DataContext ahorrador = new dbExequial2010DataContext()) { ahorrador.tblAhorradores.InsertOnSubmit(tobjAhorrador); ahorrador.tblLogdeActividades.InsertOnSubmit(tobjAhorrador.log); ahorrador.SubmitChanges(); strRetornar = "Registro Insertado"; } } catch (Exception ex) { new dao().gmtdInsertarError(ex); strRetornar = "- No se puede insertar el registro."; } return(strRetornar); }
/// <summary> Crea un objeto del tipo aplicación de acuerdo a la información de los texbox. </summary> /// <returns> Un objeto del tipo aplicación. </returns> private tblAhorradore crearObj() { tblAhorradore ahorrador = new tblAhorradore(); ahorrador.bitAhorroEstudiantil = this.chkAhorroEstudiantil.Checked; ahorrador.bitCobraCuatroxMil = this.chkExcenta4xMil.Checked; if (this.cboSexo.SelectedIndex == 0) { ahorrador.bitSexo = true; } else { ahorrador.bitSexo = false; } ahorrador.dtmFechaIng = this.dtpIngreso.Value; ahorrador.dtmFechaNac = this.dtpNacimiento.Value; ahorrador.intCodigoSoc = Convert.ToInt32(this.txtCodigo.Text); ahorrador.strApellido1Aho = this.txtApellido1.Text; ahorrador.strApellido2Aho = this.txtApellido2.Text; ahorrador.strApellidoBen = this.txtApellidoBeneficiario.Text; ahorrador.strCedulaAho = this.txtCedula.Text; ahorrador.strCedulaBen = this.txtCedulaBeneficiario.Text; ahorrador.strCodBarrio = this.cboBarrios.SelectedValue.ToString(); ahorrador.strCodOficio = this.cboOficios.SelectedValue.ToString(); ahorrador.strEscolaridad = this.cboEscolaridad.Text; ahorrador.strOrigen = this.cboOrigen.Text; ahorrador.strCorreo = this.txtMail.Text; ahorrador.strDireccion = this.txtDireccion.Text; ahorrador.strFormulario = this.Name; ahorrador.strNombreAho = this.txtNombre.Text; ahorrador.strNombreBen = this.txtNombreBeneficiario.Text; ahorrador.strTelefono = this.txtTelefono.Text; ahorrador.strTipoCed = this.cboTipo.Text; ahorrador.strCedulaAut = this.txtCedulaAut.Text; ahorrador.strNombreAut = this.txtNombreAut.Text; ahorrador.strApellidoAut = this.txtApellidoAut.Text; ahorrador.strLugarExpedicion = this.txtLugardeExpedicion.Text.Trim(); ahorrador.dtmFechaExpedicion = this.dtmFechaExpedicion.Value; return(ahorrador); }
/// <summary> Elimina un ahorrador de la base de datos. </summary> /// <param name="tobjSocio"> Un objeto del tipo tblAhorradore. </param> /// <returns> Un string que indica si se ejecuto o no el metodo. </returns> public String gmtdEliminar(tblAhorradore tobjAhorrador) { if (tobjAhorrador.strCedulaAho == "0") { return("- Debe de ingresar el código del ahorrador a eliminar."); } tblAhorradore aho = new daoAhorrador().gmtdConsultar(tobjAhorrador.strCedulaAho); if (aho.strCedulaAho == null) { return("- Este registro no aparece ingresado."); } else { if (aho.decAhorrado > 0) { return("- No puede eliminar un ahorrorrador que tiene ahorros."); } else { if (aho.decAhorrosEstudiantes > 0) { return("- No puede eliminar un ahorrorrador que tiene ahorros estudiantiles."); } else { if (aho.decAhorrosFijo > 0) { return("- No puede eliminar un ahorrorrador que tiene ahorros fijos."); } else { tobjAhorrador.log = metodos.gmtdLog("Elimina el ahorrador " + tobjAhorrador.strCedulaAho, tobjAhorrador.strFormulario); return(new daoAhorrador().gmtdEliminar(tobjAhorrador)); } } } } }
private void txtModificar_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { this.lblNombre.Text = ""; switch (this.cboTipo.Text) { case "Agraciado": agraciado = new blAgraciado().gmtdConsultarDetalle(this.txtModificar.Text); this.lblNombre.Text = agraciado.strNombreAgra + " " + agraciado.strApellido1Agra + " " + agraciado.strApellido2Agra; break; case "Ahorrador": ahorrador = new blAhorrador().gmtdConsultarDetalle(this.txtModificar.Text); this.lblNombre.Text = ahorrador.strNombreAho + " " + ahorrador.strApellido1Aho + " " + ahorrador.strApellido2Aho; break; case "Cliente": cliente = new blCliente().gmtdConsultarDetalle(this.txtModificar.Text); this.lblNombre.Text = cliente.strContacto; break; case "Socio": socio = new blSocio().gmtdConsultarDetalle(this.txtModificar.Text); this.lblNombre.Text = socio.strNombreSoc + " " + socio.strApellido1Soc + " " + socio.strApellido2Soc; break; } if (this.lblNombre.Text.Trim() == "") { MessageBox.Show("Este número de cédula no aparece registrada como " + this.cboTipo.Text, "Cambiar Cédula", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.txtCambiar.Focus(); } }
/// <summary> Elimina un ahorrador de la base de datos. </summary> /// <param name="tobjSocio"> Un objeto del tipo tblAhorradore. </param> /// <returns> Un string que indica si se ejecuto o no el metodo. </returns> public String gmtdEliminar(tblAhorradore tobjAhorrador) { String strResultado; try { using (dbExequial2010DataContext ahorradores = new dbExequial2010DataContext()) { tblAhorradore aho_old = ahorradores.tblAhorradores.SingleOrDefault(p => p.strCedulaAho == tobjAhorrador.strCedulaAho); aho_old.bitAnulado = true; aho_old.dtmFecAnulado = DateTime.Now; ahorradores.tblLogdeActividades.InsertOnSubmit(tobjAhorrador.log); ahorradores.SubmitChanges(); strResultado = "Registro Eliminado"; } } catch (Exception ex) { new dao().gmtdInsertarError(ex); strResultado = "- Ocurrió un error al Eliminar el registro."; } return(strResultado); }
/// <summary> Elimina un ahorrador de la base de datos. </summary> /// <param name="tobjSocio"> Un objeto del tipo tblAhorradore. </param> /// <returns> Un string que indica si se ejecuto o no el metodo. </returns> public String gmtdEliminar(tblAhorradore tobjAhorrador) { return(new blAhorrador().gmtdEliminar(tobjAhorrador)); }
/// <summary>Selecciona los ahorradores registrados cuya informacíón coicida con los campos de la clausula where. </summary> /// <param name="tobjAhorrador"> El objeto ahorrador con los datos para filtrar </param> /// <returns> Un lista con los ahorradores seleccionados. </returns> public IList <Ahorrador> gmtdFiltrar(tblAhorradore tobjAhorrador) { return(new blAhorrador().gmtdFiltrar(tobjAhorrador)); }
/// <summary> Modifica un ahorrador. </summary> /// <param name="tobjSocio"> Un objeto del tipo ahorrador.</param> /// <returns> Un string que indica si se ejecuto o no la operación. </returns> public string gmtdEditar(tblAhorradore tobjAhorrador) { return(new blAhorrador().gmtdEditar(tobjAhorrador)); }
/// <summary> Modifica un ahorrador. </summary> /// <param name="tobjSocio"> Un objeto del tipo ahorrador.</param> /// <returns> Un string que indica si se ejecuto o no la operación. </returns> public string gmtdEditar(tblAhorradore tobjAhorrador) { if (tobjAhorrador.strCedulaAho == "" || tobjAhorrador.strCedulaAho == "0") { return("- Debe de ingresar la cédula del ahorrador. "); } if (tobjAhorrador.intCodigoSoc.ToString().Trim() == "" || tobjAhorrador.intCodigoSoc.ToString().Trim() == "0") { return("- Debe de ingresar el código del socio al que pertenece el ahorrador. "); } if (tobjAhorrador.dtmFechaIng == null) { return("- Debe de ingresar la fecha de ingreso."); } if (tobjAhorrador.dtmFechaIng >= DateTime.Now) { return("- La fecha de ingreso no puede ser mayor a la actual. "); } if (tobjAhorrador.dtmFechaNac == null) { return("- Debe de ingresar la fecha de nacimiento. "); } if (tobjAhorrador.dtmFechaNac >= DateTime.Now) { return("- La fecha de nacimiento no puede ser mayor a la actual. "); } if (tobjAhorrador.strApellido1Aho == "") { return("- Debe de ingresar el apellido del ahorrador. "); } if (tobjAhorrador.strApellidoBen == "") { return("- Debe de ingresar el apellido del beneficiario. "); } if (tobjAhorrador.strCedulaAho == "") { return("- Debe de ingresar la cédula del ahorrador. "); } if (tobjAhorrador.strCedulaBen == "" || tobjAhorrador.strCedulaBen == "0") { return("- Debe de ingresar la cédula del beneficiario. "); } if (tobjAhorrador.strCodBarrio == "") { return("- Debe de ingresar el barrio. "); } if (tobjAhorrador.strCodOficio == "") { return("- Debe de ingresar el oficio. "); } if (tobjAhorrador.strNombreAho == "") { return("- Debe de ingresar el nombre del ahorrador. "); } if (tobjAhorrador.strNombreBen == "") { return("- Debe de ingresar el nombre del beneficiario. "); } if (tobjAhorrador.strOrigen == "") { return("- Debe de ingresar el Origen. "); } if (tobjAhorrador.strTelefono == "") { return("- Debe de ingresar el número del télefono. "); } if (tobjAhorrador.strDireccion == "") { return("- Debe de ingresar la direccion del ahorrador. "); } if (tobjAhorrador.strTipoCed == "") { return("- Debe de ingresar el tipo de cedula del ahorrador. "); } tblAhorradore aho = new daoAhorrador().gmtdConsultar(tobjAhorrador.strCedulaAho); if (aho.strCedulaAho == null) { return("- Este registro no aparece ingresado."); } else { tobjAhorrador.log = metodos.gmtdLog("Modifica el ahorrador " + tobjAhorrador.strCedulaAho, tobjAhorrador.strFormulario); return(new daoAhorrador().gmtdEditar(tobjAhorrador)); } }