Exemplo n.º 1
0
    private int Grabar()
    {
        int result = -1;

        try
        {
            if (CaptchaControl1.IsValid)
            {
                Core.Iventure ivent = new Core.Iventure();
                ivent.Id           = Convert.ToInt32(txtIdIventure.Text.Trim());
                ivent.Proveedor    = new Proveedor();
                ivent.Proveedor.Id = ((Proveedor)(Session["Proveedor"])).Id;
                ivent.DetalleAereo = txtDetalle.Text.Trim();
                ivent.ImporteTotal = Convert.ToDouble(txtImporte.Text.Trim());
                ivent.Vencimiento  = (txtFechaHasta.Text.Trim() == "")?null:(DateTime?)Convert.ToDateTime(txtFechaHasta.Text.Trim(), ci);
                ivent.CntCuotas    = Convert.ToInt32(cboCntCuotas.SelectedValue);
                ivent.IdVendedor   = Convert.ToInt32(cboVendedores.SelectedValue);
                result             = FacadeDao.ActualizarIventure(ivent);
                if (result != 1)
                {
                    throw (new Exception("Ocurrió un error en la actualización de la solicitud"));
                }
            }
            else
            {
                throw (new Exception(CaptchaControl1.ErrorMessage));
            }
            return(result);
        }
        catch (Exception ex)
        {
            //Logger.EscribirEventLog(ex);
            string script = "alert('" + ex.Message + "');";
            ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script);
            return(result);
        }
    }