private void Guardar() { try { if (this.TxtId_Cte.Text == string.Empty) { Alerta("Debe seleccionar una factura"); return; } Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID]; CapaEntidad.CapFacturaLegal fac = new CapaEntidad.CapFacturaLegal(); CN_CapFacturaLegal cn_fac = new CN_CapFacturaLegal(); int Verificador = 0; LlenarObjeto(ref fac); cn_fac.CapFacturaLegal_Guardar(ref fac, ref Verificador, sesion.Emp_Cnx); if (Verificador == -1) { LimpiarCampos(); Alerta("Los datos se guardaron correctamente"); } else { Alerta("Error al intentar guardar la infromación"); } } catch (Exception ex) { throw ex; } }
private void ConsultarFactura() { try { if (this.TxtId_Cd.Text == string.Empty) { Alerta("Seleccione un centro de distribución"); return; } if (this.TxtId_Fac.Text == string.Empty) { Alerta("Ingrese el número de factura"); return; } Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID]; CN_CapFacturaLegal cn_fac = new CN_CapFacturaLegal(); CapaEntidad.CapFacturaLegal fac = new CapaEntidad.CapFacturaLegal(); int Verificador = 0; cn_fac.CapFacturaLegal_Consulta(ref fac, ref Verificador, int.Parse(this.TxtId_Cd.Text), int.Parse(this.TxtId_Fac.Text), int.Parse(this.RblTipo.SelectedValue), sesion.Emp_Cnx); if (Verificador == 1) { this.TxtId_Cte.Text = fac.Id_Cte.ToString(); this.Txt_Nombre.Text = fac.Cte_Nombre; this.TxtTotal.Text = fac.Total.ToString("C2"); this.TxtPagado.Text = fac.Pagado.ToString("C2"); this.TxtSaldo.Text = fac.Saldo.ToString("C2"); if (fac.FacL_Legal == 1) { this.ChkLegal.Checked = true; } else { this.ChkLegal.Checked = false; } this.TxtFacL_Comentarios.Text = fac.FacL_Comentarios; } else { Alerta("No se enconto la factura, por favor verifique la información"); this.TxtId_Cd.Enabled = true; this.TxtId_Fac.Enabled = true; this.CmbId_Cd.Enabled = true; this.RblTipo.Enabled = true; } } catch (Exception ex) { throw ex; } }
private void LlenarObjeto(ref CapaEntidad.CapFacturaLegal fac) { try { fac.Id_Cd = int.Parse(this.TxtId_Cd.Text); fac.Id_Fac = int.Parse(this.TxtId_Fac.Text); fac.Id_Cte = int.Parse(this.TxtId_Cte.Text); if (this.ChkLegal.Checked == true) { fac.FacL_Legal = 1; } else { fac.FacL_Legal = 0; } fac.FacL_Comentarios = this.TxtFacL_Comentarios.Text; fac.Fac_Tipo = int.Parse(this.RblTipo.SelectedValue); } catch (Exception ex) { throw ex; } }