protected override bool AcceptModify(BL.BaseManager manager, int id) { Poll poll = ((PollManager)manager).Get(id); UCFormPoll.PopulateModel(poll); return(((PollManager)manager).Edit(poll)); }
/// <summary> /// Muestra el formulario para la edición de un elemento existente. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void ShowEditForm(object sender, UbiquicityEventArg e) { try { int id = Convert.ToInt32(e.TheObject); Session["Ubiquicity_itemId"] = id; PollManager pollManager = new PollManager(); Poll poll = pollManager.Get(id); if (poll == null && pollManager.HasErrors) { Alert.ShowUP("Error", pollManager.ErrorDescription); } else { //TODO - agregar controles de error PollOptionManager pollOptionManager = new PollOptionManager(); List <PollOption> pollOptions = pollOptionManager.Get(); UCFormPoll.CleanForm(pollOptions); UCFormPoll.FillForm(poll); Session["Ubiquicity_action"] = EDIT; //Page.ClientScript.RegisterStartupScript(this.GetType(), "openModalEdit", "window.onload = function() { $('#modalMap').modal('show'); }", true); ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalEdit", "$('#modalPol').modal('show');", true); upUCModalForm.Update(); } } catch (Exception exception) { Alert.ShowUP("Exception", exception.Message); } }
protected override bool AcceptCreate(BL.BaseManager manager) { Poll poll = new Poll(); UCFormPoll.PopulateModel(poll); return(((PollManager)manager).Save(poll)); }
/// <summary> /// Muestra el formulairo para el alta de un nuevo elemento. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void ShowNewForm(object sender, UbiquicityEventArg e) { try { PollOptionManager pollOptionManager = new PollOptionManager(); List <PollOption> pollOptions = pollOptionManager.Get(); if (pollOptions == null && pollOptionManager.HasErrors) { Alert.ShowUP("Error", pollOptionManager.ErrorDescription); } else { UCFormPoll.CleanForm(pollOptions); Session["Ubiquicity_action"] = CREATE; ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#modalPol').modal('show');", true); upUCModalForm.Update(); } } catch (Exception exception) { Alert.ShowUP("Exception", exception.Message); } }