Пример #1
0
        public void SaveOrUpdate(PagoLinea instance)
        {
            ISession hisession = null;
            try
            {
                hisession = NHibernateHelper.GetCurrentSession();
                hisession.BeginTransaction();
                if (instance.Id == 0)
                {
                    hisession.Save(instance);
                }
                else
                {
                    hisession.Update(instance);
                }
                hisession.Transaction.Commit();
                hisession.Close();
            }
            catch (Exception ex)
            {
                if (hisession != null)
                {
                    if (hisession.IsOpen)
                    {
                        hisession.Close();

                    }
                }

            }
        }
Пример #2
0
        private void btnAgregarMedioPago_Click(object sender, EventArgs e)
        {
            PagoLinea pagolinea = new PagoLinea();

            pagolinea.MedioDePago = cboMedioPago.SelectedItem.ToString();
            string strMedioPago = cboMedioPago.SelectedItem.ToString();
            if (strMedioPago != "Efectivo")
            {
                if (txtNumeroMedio.Text == "")
                {
                    Utils.Utils.Error(null, "El número de tarjeta/cheque no es válido");
                    return;
                }
                pagolinea.Numero = int.Parse(txtNumeroMedio.Text);
            }
            else
            {
                pagolinea.Numero = 0;
            }
            pagolinea.Moneda = (TipoMoneda)cboMoneda.SelectedItem;
            pagolinea.Monto = float.Parse(txtMonto.Text == "" ? "0" : txtMonto.Text);

            object[] row = { cboMedioPago.SelectedItem.ToString(), txtNumeroMedio.Text, pagolinea.Moneda.Nombre, txtMonto.Text };
            dgvMedioPago.Rows.Add(row);

            lineasMedioPago.Add(pagolinea);
        }
Пример #3
0
 public void Grabar(PagoLinea pagoLinea)
 {
     new PagoLineaDA().SaveOrUpdate(pagoLinea);
 }