Exemplo n.º 1
0
    public void btn_editGrabar_Click(object sender, EventArgs e)
    {
        PlayaBC playa = new PlayaBC();

        playa.CODIGO       = txt_editCodigo.Text;
        playa.DESCRIPCION  = txt_editDesc.Text;
        playa.ZONA_ID      = int.Parse(ddl_editZona.SelectedValue);
        playa.VIRTUAL      = chk_editVirtual.Checked;
        playa.ID_TIPOPLAYA = int.Parse(ddl_editTipo.SelectedValue);
        //playa.PLAYA_X = double.Parse(txt_editPosX.Text);
        //playa.PLAYA_Y = double.Parse(txt_editPosY.Text);
        //playa.ROTACION = int.Parse(txt_editRotacion.Text);
        //playa.ALTO = double.Parse(txt_editAltura.Text);
        //playa.ANCHO = double.Parse(txt_editAnchura.Text);
        if (string.IsNullOrEmpty(hf_idPlaya.Value))
        {
            if (playa.Crear(playa))
            {
                ObtenerPlaya(true);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Playa creada exitosamente');", true);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPlaya');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Ocurrió un error al agregar playa. Intente nuevamente.');", true);
            }
            //txt_editPosX.Text = "";
            //txt_editPosY.Text = "";
            //txt_editRotacion.Text = "";
            //txt_editAnchura.Text = "";
            //txt_editAltura.Text = "";
        }
        else
        {
            playa.ID = int.Parse(hf_idPlaya.Value);
            if (playa.Modificar(playa))
            {
                ObtenerPlaya(true);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Playa modificada exitosamente');", true);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalPlaya');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Ocurrió un error al modificar playa. Intente nuevamente.');", true);
            }
        }
    }