/// <summary> /// Muestra el formulario para la edición de un usuario 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; UserManager userManager = new UserManager(); User user = userManager.Get(id); if (userManager.HasErrors) { Alert.ShowUP("Error", userManager.ErrorDescription); } else { UCFormNewMember.HidePasswordFields(); UCFormNewMember.DisableUserField(); UCFormNewMember.FillForm(user); Session["Ubiquicity_action"] = EDIT; ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalEdit", "$('#ucModalNewMember').modal('show');", true); upUCModalForm.Update(); } } catch (Exception exception) { Alert.ShowUP("Excepción", exception.Message); } }
/// <summary> /// Muestra el formulario para realizar responder la pregunta. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void PerformGenericAction(object sender, UbiquicityEventArg e) { int id = Convert.ToInt32(e.TheObject.ToString()); ItemCommentManager itemCommentManager = new ItemCommentManager(); ItemComment itemComment = itemCommentManager.Get(id); if (itemComment == null && itemCommentManager.HasErrors) { Alert.ShowUP("Error", itemCommentManager.ErrorDescription); } else { //Si existe la referencia, entonces a sido respondida if (itemComment.SentenceReference == null) { UCFormInquiry.CleanForm(); UCFormInquiry.FillForm(itemComment); SessionUtilHelper.KeepInSession(id.ToString(), Session); ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#modalInquiry').modal('show');", true); upUCModalForm.Update(); } else { Alert.ShowUP("Respuesta", "Esta pregunta ya ha sido respondida; no hay acciones disponibles."); } } }
protected override void ShowEditForm(object sender, UbiquicityEventArg e) { int id = Convert.ToInt32(e.TheObject); Session["Ubiquicity_itemId"] = id; UserManager userManager = new UserManager(); User user = userManager.Get(id); RoleManager roleManager = new RoleManager(); List <Role> unassignedRoles = roleManager.GetUnassignedRole(user); if (userManager.HasErrors) { Alert.Show("Error", userManager.Errors[0].description); } else { if (unassignedRoles == null) { unassignedRoles = new List <Role>(); } //Se guardan en sesión para su manejo posterior KeepInSession("granted", user.Roles); KeepInSession("toGrant", unassignedRoles); UCFormUserRole.FillForm(user, unassignedRoles); Session["Ubiquicity_action"] = EDIT; ShowCrudForm(); } }
protected void PerformRestore(object sender, UbiquicityEventArg e) { try { string fileName = Session["Ubiquicity_itemId"].ToString(); BackupManager backupManager = new BackupManager(); if (!backupManager.PerformRestore(fileName) && backupManager.HasErrors) { //TODO - NO MUESTRA MENSAJE DE CONFIRMACIÓN Alert.Show("Error", backupManager.ErrorDescription); } else { //TODO - NO MUESTRA MENSAJE DE CONFIRMACIÓN Alert.Show("Éxtito", "La restauración se ha generado exitosamente."); } } catch (Exception exception) { //TODO - NO MUESTRA MENSAJE DE Alert.Show("Exception", exception.Message); } Session.Remove("Ubiquicity_itemId"); }
/// <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; MapManager mapManager = new MapManager(); Map map = mapManager.Get(id); if (map == null && mapManager.HasErrors) { Alert.ShowUP("Error", mapManager.ErrorDescription); } else { //TODO - agregar controles de error CategoryManager newsCategoryManager = new CategoryManager(); List <Category> newsCategories = newsCategoryManager.Get(); UCFormMap.CleanForm(newsCategories); UCFormMap.FillForm(map); Session["Ubiquicity_action"] = EDIT; //Page.ClientScript.RegisterStartupScript(this.GetType(), "openModalEdit", "window.onload = function() { $('#modalMap').modal('show'); }", true); ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalEdit", "$('#modalMap').modal('show');", true); upUCModalForm.Update(); } }
protected override void ShowEditForm(object sender, UbiquicityEventArg e) { int id = Convert.ToInt32(e.TheObject); Session["Ubiquicity_itemId"] = id; RoleManager roleManager = new RoleManager(); Role role = roleManager.Get(id); List <Permission> unassignedPermission = roleManager.GetUnassignedPermission(role); if (roleManager.HasErrors) { Alert.Show("Error", roleManager.ErrorDescription); } else { if (unassignedPermission == null) { unassignedPermission = new List <Permission>(); } //Se guardan en sesión para su manejo posterior KeepPermissionInSession("granted", role.Permissions); KeepPermissionInSession("toGrant", unassignedPermission); UCFormRolePermission.FillForm(role, unassignedPermission); Session["Ubiquicity_action"] = EDIT; ShowCrudForm(); } }
/// <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); } }
/// <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(); }
/// <summary> /// Muestra el formulairo para el alta de un nuevo mapa. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void ShowNewForm(object sender, UbiquicityEventArg e) { AdImageManager adImageManager = new AdImageManager(); List <Ad> adImages = adImageManager.Get(); UCFormAd.CleanForm(); Session["Ubiquicity_action"] = CREATE; ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#modalAdImage').modal('show');", true); upUCModalForm.Update(); }
/// <summary> /// Muestra el formulairo para el alta de un nuevo mapa. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void ShowNewForm(object sender, UbiquicityEventArg e) { CategoryManager categoryManager = new CategoryManager(); List <Category> categories = categoryManager.Get(); UCFormMap.CleanForm(categories); Session["Ubiquicity_action"] = CREATE; //Page.ClientScript.RegisterStartupScript(this.GetType(), "openModalCreate", "window.onload = function() { $('#modalMap').modal('show'); }", true); ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#modalMap').modal('show');", true); upUCModalForm.Update(); }
/// <summary> /// Muestra el formulario para el alta de un nuevo rol. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void ShowNewForm(object sender, UbiquicityEventArg e) { RoleManager roleManager = new RoleManager(); List <Permission> unassignedPermission = roleManager.GetAllPermission(); List <Permission> granted = new List <Permission>(); //Se guardan en sesión para su manejo posterior KeepPermissionInSession("granted", granted); KeepPermissionInSession("toGrant", unassignedPermission); UCFormRolePermission.InitializeForm(granted, unassignedPermission); Session["Ubiquicity_action"] = CREATE; ShowCrudForm(); }
/// <summary> /// Muestra el formulairo para el alta de un nuevo usuario. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void ShowNewForm(object sender, UbiquicityEventArg e) { try { UCFormNewMember.ShowPasswordFields(); UCFormNewMember.EnableUserField(); UCFormNewMember.CleanForm(); Session["Ubiquicity_action"] = CREATE; ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#ucModalNewMember').modal('show');", true); upUCModalForm.Update(); } catch (Exception exception) { Alert.ShowUP("Excepción", exception.Message); } }
/// <summary> /// Muestra el formulario con las opciones de rechazo o de aceptación. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void PerformGenericAction(object sender, UbiquicityEventArg e) { int id = Convert.ToInt32(e.TheObject.ToString()); CreditNoteManager creditNoteManager = new CreditNoteManager(); CreditNote creditNote = creditNoteManager.Get(id); if (creditNote.Status == CreditNote.StatusType.Pendiente) { Session["Ubiquicity_itemId"] = id; Alert.ShowUP("Nota de crédtio", "Seleccione la acción a ejecutar sobre el reclamo.", "¡Rechazar!", "!Aprobar!"); } else { Alert.ShowUP("Nota de crédtio", "La nota de crédito ya fue " + creditNote.Status + "."); } }
protected virtual void PerformDeleteItem(object sender, UbiquicityEventArg e) { if (Session["Ubiquicity_itemId"] != null) { Type type = Manager.GetType(); MethodInfo info = type.GetMethod("Delete", new[] { typeof(int) }); object[] value = { Convert.ToInt32(Session["Ubiquicity_itemId"]) }; object success = info.Invoke(Manager, value); if (!Boolean.Parse(success.ToString()) && Manager.HasErrors) { Alert.ShowUP("Error", Manager.ErrorDescription); } else { Session.Remove("Ubiquicity_itemId"); LoadGridView(); } } }
protected void SendPasswordReset(object sender, UbiquicityEventArg e) { try { if (Session["Ubiquicity_itemId"] != null) { int id = Convert.ToInt32(Session["Ubiquicity_itemId"]); UserManager userManager = new UserManager(); userManager.ResetPasswordRequest(id); Session.Remove("Ubiquicity_itemId"); //TODO - No se muestra la alerta :| Alert.ShowUP("Solicitud enviada", "Se ha enviado la solicitud de reseteo de password."); } } catch (Exception exception) { Alert.ShowUP("Excepción", exception.Message); } }
/// <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(); } }
/// <summary> /// Atiende la petición de creación lanzada desde al alert creado por ShowNewForm. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void PerformBackup(object sender, UbiquicityEventArg e) { try { BackupManager backupManager = new BackupManager(); if (!backupManager.PerformBackup() && backupManager.HasErrors) { //TODO - NO MUESTRA MENSAJE DE CONFIRMACIÓN Alert.Show("Error", backupManager.ErrorDescription); } else { LoadGridView(); //TODO - NO MUESTRA MENSAJE DE CONFIRMACIÓN Alert.ShowUP("Éxtito", "El respaldo se ha generado exitosamente."); } } catch (Exception exception) { Alert.Show("Exception", exception.Message); } }
/// <summary> /// Muestra el formulario para realizar responder la pregunta. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void PerformGenericAction(object sender, UbiquicityEventArg e) { try { int id = Convert.ToInt32(e.TheObject.ToString()); //UCFormInquiry.CleanForm(); //UCFormInquiry.FillForm(itemComment); SessionUtilHelper.KeepInSession(id.ToString(), Session); //ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#modalInquiry').modal('show');", true); //upUCModalForm.Update(); //SessionUtilHelper.KeepInSession(e.CommandArgument.ToString(), Session); //Page.ClientScript.RegisterStartupScript(this.GetType(), "openModal", "window.onload = function() { $('#modalInvoiceItemSupport').modal('show'); }", true); UCModalInvoiceItemSupport.LoadCommentsSupport(id); ScriptManager.RegisterStartupScript(upUCModalInvoiceItemSupport, upUCModalInvoiceItemSupport.GetType(), "openModalCreate", "$('#modalInvoiceItemSupport').modal('show');", true); upUCModalInvoiceItemSupport.Update(); } catch (Exception exception) { Alert.Show("Excepción", exception.Message); } }
/// <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); } }
/// <summary> /// Muestra el formulairo para el alta de un nuevo usuario /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void ShowNewForm(object sender, UbiquicityEventArg e) { Alert.ShowUP("Crear respaldo", "¿Está seguro de querer crear el respaldo? El sistema se inhabilitará durante la ejecución.", "Si, crear respaldo"); }
protected override void PerformGenericAction(object sender, UbiquicityEventArg e) { Session["Ubiquicity_itemId"] = e.TheObject.ToString(); Alert.ShowUP("Restaurar respaldo", "¿Está seguro de querer restaurar el respaldo? El sistema se inhabilitará y se perderán los datos posteriores al punto de restauración.", null, "Si, restaurar respaldo"); }
/// <summary> /// Muestra el mensaje para que se confirme la eliminación, mostrando los mensajes con UP. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void AskForDelete(object sender, UbiquicityEventArg e) { Session["Ubiquicity_itemId"] = Convert.ToInt32(e.TheObject); Alert.ShowUP("Eliminar registro", "¿Está seguro de querer eliminar el registro?", "Si, eliminarlo"); }
protected void AcceptCreditNote(object sender, UbiquicityEventArg e) { ApproveOrReject(true); }
protected void RejectCreditNote(object sender, UbiquicityEventArg e) { ApproveOrReject(false); }
protected virtual void ShowNewForm(object sender, UbiquicityEventArg e) { }
protected virtual void PerformGenericAction(object sender, UbiquicityEventArg e) { }
/// <summary> /// Se emplea el alert con uno de los eventos genéricos para solicitar que el administrador /// confirme si envía el reseteo de password al usuario. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void PerformGenericAction(object sender, UbiquicityEventArg e) { Session["Ubiquicity_itemId"] = e.TheObject.ToString(); Alert.ShowUP("Resetear password", "Estás a punto de iniciar el proceso de reseteo de password. Estás seguro?", null, "Si, resetear"); }