public int GuardarListaValores(ListaValores listavalores, int Usuario) { try { using (MySqlConnection Cn = new MySqlConnection(Conexion.ObtenerConexion)) { Cmd = new MySqlCommand("SPR_IU_ListaValores", Cn); Cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.Add("p_LISTAVALORES_ID", MySqlDbType.Int32, 10).Value = listavalores.Listavalores_id; Cmd.Parameters.Add("p_NOMBRE", MySqlDbType.VarChar, 50).Value = listavalores.Nombre; Cmd.Parameters.Add("p_DESCRIPCION", MySqlDbType.VarChar, 255).Value = listavalores.Descripcion; Cmd.Parameters.Add("p_TIPO", MySqlDbType.VarChar, 50).Value = listavalores.Tipo; Cmd.Parameters.Add("p_USUARIOCONECTADO", MySqlDbType.Int32, 4).Value = Usuario; Cmd.Parameters.Add("p_RESULTADO", MySqlDbType.Int32, 1).Direction = ParameterDirection.Output; Cn.Open(); Cmd.ExecuteNonQuery(); int Resultado = Convert.ToInt32(Cmd.Parameters["p_RESULTADO"].Value); LiberarRecursos(); return(Resultado); } } catch (Exception e) { throw e; } }
public int GuardarListaValores(ListaValores listavalores, int Usuario) { try { using (OracleConnection Cn = new OracleConnection(Conexion.ObtenerConexion)) { Cmd = new OracleCommand("SPR_IU_ListaValores", Cn); Cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.Add("p_LISTAVALORES_ID", OracleDbType.Int32, 4).Value = listavalores.Listavalores_id; Cmd.Parameters.Add("p_NOMBRE", OracleDbType.Varchar2, 50).Value = listavalores.Nombre; Cmd.Parameters.Add("p_DESCRIPCION", OracleDbType.Varchar2, 255).Value = listavalores.Descripcion; Cmd.Parameters.Add("p_TIPO", OracleDbType.Varchar2, 6).Value = listavalores.Tipo; Cmd.Parameters.Add("p_USUARIOCONECTADO", OracleDbType.Int32, 10).Value = Usuario; Cmd.Parameters.Add("p_RESULTADO", OracleDbType.Int32, 1).Direction = ParameterDirection.Output; Cn.Open(); Cmd.ExecuteNonQuery(); Int32 Resultado = (Int32)(Oracle.ManagedDataAccess.Types.OracleDecimal)Cmd.Parameters["p_RESULTADO"].Value; LiberarRecursos(); return(Resultado); } } catch (Exception e) { throw e; } }
/* * ======================================================================================================================================================= * Fin Operaciones sobre estructura Operarios * ======================================================================================================================================================= */ /* * ======================================================================================================================================================= * Inicio Operaciones sobre estructura ListaValores * ======================================================================================================================================================= */ public ListaValores ObtenerListaValores(int DatoBuscar) { ListaValores listavalores = new ListaValores(); try { BuscarRegistro("TBL_LISTAVALORES", DatoBuscar); if (sdr.Read()) { listavalores.Listavalores_id = Convert.ToInt32(sdr["LISTAVALORES_ID"].ToString()); listavalores.Nombre = sdr["NOMBRE"].ToString(); listavalores.Descripcion = sdr["DESCRIPCION"].ToString(); sdr.Close(); LiberarRecursos(); return(listavalores); } else { sdr.Close(); LiberarRecursos(); return(null); } } catch (Exception ex) { throw ex; } }
private void MostrarValores() { ListaValores.BeginUpdate(); ListaValores.Items.Clear(); Lbl.Comprobantes.Recibo Rec = this.Elemento as Lbl.Comprobantes.Recibo; if (this.DePago) { foreach (Lbl.Comprobantes.Pago Pg in Rec.Pagos) { ListViewItem itm = ListaValores.Items.Add(Pg.GetHashCode().ToString()); switch (Pg.FormaDePago.Tipo) { case Lbl.Pagos.TiposFormasDePago.Efectivo: itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Pg.FormaDePago.ToString())); itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Lfx.Types.Formatting.FormatCurrency(Pg.Importe, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales))); break; case Lbl.Pagos.TiposFormasDePago.Caja: itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Pg.FormaDePago.ToString())); itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Lfx.Types.Formatting.FormatCurrency(Pg.Importe, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales))); itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, "Débito desde " + Pg.CajaOrigen.ToString())); break; default: itm.SubItems.Add(Pg.FormaDePago.ToString()); itm.SubItems.Add(Lfx.Types.Formatting.FormatCurrency(Pg.Importe, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales)); itm.SubItems.Add(Pg.ToString()); break; } } EtiquetaValoresImporte.Text = Lfx.Types.Formatting.FormatCurrency(Rec.Pagos.ImporteTotal, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales); } else { foreach (Lbl.Comprobantes.Cobro Cb in Rec.Cobros) { ListViewItem itm = ListaValores.Items.Add(Cb.GetHashCode().ToString()); switch (Cb.FormaDePago.Tipo) { case Lbl.Pagos.TiposFormasDePago.Efectivo: itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Cb.FormaDePago.ToString())); itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Lfx.Types.Formatting.FormatCurrency(Cb.Importe, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales))); break; case Lbl.Pagos.TiposFormasDePago.Tarjeta: itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Cb.FormaDePago.ToString())); itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Lfx.Types.Formatting.FormatCurrency(Cb.Importe, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales))); itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, "Cupón Nº " + Cb.Cupon.Numero + " de " + Cb.Cupon.FormaDePago.ToString())); break; case Lbl.Pagos.TiposFormasDePago.Caja: itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Cb.FormaDePago.ToString())); itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, Lfx.Types.Formatting.FormatCurrency(Cb.Importe, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales))); itm.SubItems.Add(new ListViewItem.ListViewSubItem(itm, "Depósito en " + Cb.CajaDestino.ToString())); break; default: itm.SubItems.Add(Cb.FormaDePago.ToString()); itm.SubItems.Add(Lfx.Types.Formatting.FormatCurrency(Cb.Importe, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales)); itm.SubItems.Add(Cb.ToString()); break; } } EtiquetaValoresImporte.Text = Lfx.Types.Formatting.FormatCurrency(Rec.Cobros.ImporteTotal, Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales); } LabelAgregarValores.Visible = ListaValores.Items.Count == 0 && this.Elemento.Existe == false; BotonQuitarValor.Visible = ListaValores.Items.Count > 0; if (ListaValores.Items.Count > 0 && ListaValores.SelectedItems.Count == 0) { ListaValores.Items[ListaValores.Items.Count - 1].Selected = true; ListaValores.Items[ListaValores.Items.Count - 1].Focused = true; } ListaValores.EndUpdate(); }