Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CajOperacion _one = new CajOperacion();

            _one = srv.GetOne(Globals.logEmpresa.id, cmbTipoOperacion.SelectedValue.ToString(), "0");
            Console.WriteLine("A GUARDAR MOVIMIENTO");


            btnSave.Enabled = false;
            try
            {
                //DETALLE
                instrumentoSeleccionado.monto              = Convert.ToDouble(txtMonto.Text) / factor;
                instrumentoSeleccionado.monto_moneda       = Convert.ToDouble(txtMonto.Text);
                instrumentoSeleccionado.id_moneda          = Globals.cotizacion[cmbCotizacion.SelectedIndex].id_moneda;
                instrumentoSeleccionado.moneda_nombre      = Globals.cotizacion[cmbCotizacion.SelectedIndex].moneda_nombre;
                instrumentoSeleccionado.moneda_descrip     = Globals.cotizacion[cmbCotizacion.SelectedIndex].moneda_descrip;
                instrumentoSeleccionado.factor             = factor;
                instrumentoSeleccionado.id_instrumento     = cmbInstrumento.SelectedValue.ToString();
                instrumentoSeleccionado.instrumento_nombre = cmbInstrumento.Text;
                instrumentoSeleccionado.id_cuenta          = "";
                instrumentoSeleccionado.cuenta_numero      = "";
                instrumentoSeleccionado.cuenta_banco       = "";
                instrumentoSeleccionado.id_banco           = "";
                instrumentoSeleccionado.banco_nombre       = "";
                instrumentoSeleccionado.numero_operacion   = "";

                if (cmbCuenta.Visible)
                {
                    instrumentoSeleccionado.id_cuenta = cmbCuenta.SelectedValue.ToString();
                }
                if (cmbBanco.Visible)
                {
                    instrumentoSeleccionado.id_banco = cmbBanco.SelectedValue.ToString();
                }
                if (txtNroOperacion.Visible)
                {
                    instrumentoSeleccionado.numero_operacion = txtNroOperacion.Text;
                }

                List <App.CajOperacionService.CajMovimiento> _listaPago = new List <App.CajOperacionService.CajMovimiento>();
                _listaPago.Add(instrumentoSeleccionado);

                _one.monto         = Convert.ToDouble(txtMonto.Text) / factor;
                _one.descripcion   = txtDescripcion.Text;
                _one.id_cotizacion = Globals.cotizacion[0].id_cotizacion;
                _one.id_usuario    = Globals.logUser.id;
                _one.id_status     = 1;
                _one.id_estado     = 1;

                string res = srvCaja.SetOne(_one, _listaPago);
                Console.WriteLine("HUBO RESPUESTA");
                if (res.Length > 1)
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    Console.WriteLine("res: " + res);
                    MetroFramework.MetroMessageBox.Show(this.MdiParent, "No se guardó el registro", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ex: " + ex.Message);
                MetroFramework.MetroMessageBox.Show(this.MdiParent, "Se produjeron errores intentando procesar el registro, por favor revise los valores e intente nuevamente", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                btnSave.Enabled = true;
            }
        }
Exemplo n.º 2
0
        public string NullOne(CajOperacion one)
        {
            string _id = srv.NullOne(one);

            return(_id);
        }
Exemplo n.º 3
0
        public string SetOne(CajOperacion one, List <CajMovimiento> detail)
        {
            string _id = srv.SetOne(one, detail);

            return(_id);
        }
Exemplo n.º 4
0
        public CajOperacion GetOne(string idEmpresa, string idTipo, string id)
        {
            CajOperacion _one = srv.GetOne(idEmpresa, idTipo, id);

            return(_one);
        }