Esempio n. 1
0
        protected override bool AcceptModify(BL.BaseManager manager, int id)
        {
            Category category = ((CategoryManager)manager).Get(id);

            UCFormCategory.PopulateModel(category);
            return(((CategoryManager)manager).Edit(category));
        }
Esempio n. 2
0
        protected override bool AcceptCreate(BL.BaseManager manager)
        {
            Category category = new Category();

            UCFormCategory.PopulateModel(category);
            return(((CategoryManager)manager).Save(category));
        }
Esempio n. 3
0
 /// <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)
 {
     UCFormCategory.CleanForm();
     Session["Ubiquicity_action"] = CREATE;
     Page.ClientScript.RegisterStartupScript(this.GetType(), "openModalCreate", "window.onload = function() { $('#modalCategory').modal('show'); }", true);
     ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#modalCategory').modal('show');", true);
     upUCModalForm.Update();
 }
Esempio n. 4
0
        /// <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)
        {
            int id = Convert.ToInt32(e.TheObject);

            Session["Ubiquicity_itemId"] = id;

            CategoryManager categoryManager = new CategoryManager();
            Category        category        = categoryManager.Get(id);

            if (category == null && categoryManager.HasErrors)
            {
                Alert.Show("Error", categoryManager.ErrorDescription);
            }
            else
            {
                UCFormCategory.FillForm(category);
                Session["Ubiquicity_action"] = EDIT;
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "openModalEdit", "window.onload = function() { $('#modalCategory').modal('show'); }", true);
                ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalEdit", "$('#modalCategory').modal('show');", true);
                upUCModalForm.Update();
            }
        }