/// <summary> /// Handles the LoadComplete event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void Page_LoadComplete(object sender, EventArgs e) { if (String.Compare(Request.Form["__EVENTTARGET"], CommandManager.GetCurrent(this.Page).ID, false) == 0) { object objArgs = Request.Form["__EVENTARGUMENT"]; if (objArgs != null) { Dictionary <string, object> cmd = new System.Web.Script.Serialization.JavaScriptSerializer().DeserializeObject(objArgs.ToString()) as Dictionary <string, object>; if (cmd != null && cmd.Count > 1) { object cmdName = cmd[_CommandName]; if (String.Compare((string)cmdName, _MoveDialogCommand, true) == 0) { // process move command Dictionary <string, object> args = cmd[_CommandArguments] as Dictionary <string, object>; if (args != null) { ProcessMoveCommand(args); ManagementHelper.SetBindGridFlag(MyListView.CurrentListView.ID); } } } } } if (IsPostBack && (ManagementHelper.GetBindGridFlag(MyListView.CurrentListView.ID) || String.Compare(Request.Form["__EVENTTARGET"], CommandManager.GetCurrent(this.Page).ID, false) == 0)) { LoadDataAndDataBind(); DataBind(); MyListView.MainUpdatePanel.Update(); } }
public void Invoke(object sender, object element) { if (element is CommandParameters) { //first check permissions if (JurisdictionType == JurisdictionManager.JurisdictionType.Tax) { SecurityManager.CheckRolePermission("order:admin:taxes:mng:delete"); } else { SecurityManager.CheckRolePermission("order:admin:shipping:jur:mng:delete"); } CommandParameters cp = (CommandParameters)element; int error = 0; string errorMessage = String.Empty; try { string[] items = null; if (cp.CommandArguments.ContainsKey(EcfListView.GridCommandParameterName) && Boolean.Parse(cp.CommandArguments[EcfListView.GridCommandParameterName])) { // process command from grid (delete only one item) string primaryKeyId = cp.CommandArguments["primaryKeyId"]; items = new string[] { primaryKeyId }; } else { // get checked items and process batch delete command (from toolbar) string gridId = cp.CommandArguments["GridId"]; items = EcfListView.GetCheckedCollection(((Control)sender).Page, gridId); ManagementHelper.SetBindGridFlag(gridId); } if (items != null) { ProcessDeleteCommand(items); } } catch (Exception ex) { error++; errorMessage = ex.Message; } if (error > 0) { errorMessage = errorMessage.Replace("'", "\\'").Replace(Environment.NewLine, "\\n"); ClientScript.RegisterStartupScript(((Control)sender).Page, ((Control)sender).Page.GetType(), Guid.NewGuid().ToString("N"), String.Format("alert('{0}{1}');", "Failed to delete item(s). Error: ", errorMessage), true); } } }
public void Invoke(object sender, object element) { //first check permissions if (!ProfileContext.Current.CheckPermission("profile:roles:mng:delete")) { //permissions not present, deny throw new UnauthorizedAccessException("Current user does not have enough rights to access the requested operation."); } if (element is CommandParameters) { CommandParameters cp = (CommandParameters)element; int error = 0; string errorMessage = String.Empty; try { string[] items = null; if (cp.CommandArguments.ContainsKey(EcfListView.GridCommandParameterName) && Boolean.Parse(cp.CommandArguments[EcfListView.GridCommandParameterName])) { // process command from grid (delete only one item) string primaryKeyId = cp.CommandArguments["primaryKeyId"]; items = new string[] { primaryKeyId }; } else { // get checked items and process batch delete command (from toolbar) string gridId = cp.CommandArguments["GridId"]; items = EcfListView.GetCheckedCollection(((Control)sender).Page, gridId); ManagementHelper.SetBindGridFlag(gridId); } if (items != null) { ProcessDeleteCommand(items); } } catch (Exception ex) { error++; errorMessage = ex.Message; } if (error > 0) { errorMessage = errorMessage.Replace("'", "\\'").Replace(Environment.NewLine, "\\n"); ClientScript.RegisterStartupScript(((Control)sender).Page, ((Control)sender).Page.GetType(), Guid.NewGuid().ToString("N"), String.Format("alert('{0}{1}');", "Failed to delete item(s). Error: ", errorMessage), true); } } }
/// <summary> /// Handles the LoadComplete event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void Page_LoadComplete(object sender, EventArgs e) { if (String.Compare(Request.Form["__EVENTTARGET"], CommandManager.GetCurrent(this.Page).ID, false) == 0) { ManagementHelper.SetBindGridFlag(MyListView.CurrentListView.ID); } if (IsPostBack && ManagementHelper.GetBindGridFlag(MyListView.CurrentListView.ID)) { LoadDataAndDataBind(String.Empty); MyListView.MainUpdatePanel.Update(); } }
public void Invoke(object sender, object element) { if (element is CommandParameters) { CommandParameters cp = (CommandParameters)element; string gridId = cp.CommandArguments["GridId"]; string[] items = EcfListView.GetCheckedCollection(((Control)sender).Page, gridId); if (items != null) { int error = 0; string errorMessage = String.Empty; try { ProcessDeleteCommand(items); ManagementHelper.SetBindGridFlag(gridId); } catch (SqlException sqlEx) { error++; if (sqlEx.Number == 547) { errorMessage = Resources.ContentStrings.Site_Template_Delete_ReferenceException; } else { errorMessage = String.Concat(Resources.ContentStrings.Site_Template_Delete_TitleException, sqlEx.Message); } } catch (Exception ex) { error++; errorMessage = String.Concat(Resources.ContentStrings.Site_Template_Delete_TitleException, ex.Message); } if (error > 0) { errorMessage = errorMessage.Replace("'", "\\'").Replace(Environment.NewLine, "\\n"); ClientScript.RegisterStartupScript(((Control)sender).Page, ((Control)sender).Page.GetType(), Guid.NewGuid().ToString("N"), String.Format("alert('{0}');", errorMessage), true); } } else { return; } } }
/// <summary> /// Invokes the specified sender. /// </summary> /// <param name="sender">The sender.</param> /// <param name="element">The element.</param> public void Invoke(object sender, object element) { if (!ProfileContext.Current.CheckPermission("content:site:mng:delete")) { throw new UnauthorizedAccessException("Current user does not have enough rights to access the requested operation."); } if (element is CommandParameters) { CommandParameters cp = (CommandParameters)element; string gridId = cp.CommandArguments["GridId"]; string[] items = EcfListView.GetCheckedCollection(((Control)sender).Page, gridId); if (items != null) { int error = 0; string errorMessage = String.Empty; try { ProcessDeleteCommand(items); ManagementHelper.SetBindGridFlag(gridId); } catch (Exception ex) { error++; errorMessage = ex.Message; } if (error > 0) { errorMessage = errorMessage.Replace("'", "\\'").Replace(Environment.NewLine, "\\n"); ClientScript.RegisterStartupScript(((Control)sender).Page, ((Control)sender).Page.GetType(), Guid.NewGuid().ToString("N"), String.Format("alert('{0}{1}');", "Failed to delete item(s). Error: ", errorMessage), true); } } else { return; } } }
/// <summary> /// Invokes the specified sender. /// </summary> /// <param name="sender">The sender.</param> /// <param name="element">The element.</param> public void Invoke(object sender, object element) { if (element is CommandParameters) { CommandParameters cp = (CommandParameters)element; string gridId = cp.CommandArguments["GridId"]; string[] items = EcfListView.GetCheckedCollection(((Control)sender).Page, gridId); if (items != null) { int error = 0; string errorMessage = String.Empty; try { ProcessDeleteCommand(items, ManagementHelper.GetIntFromQueryString("catalogid"), ManagementHelper.GetIntFromQueryString("catalognodeid")); ManagementHelper.SetBindGridFlag(gridId); } catch (Exception ex) { error++; errorMessage = ex.Message; } if (error > 0) { errorMessage = errorMessage.Replace("'", "\\'").Replace(Environment.NewLine, "\\n"); ClientScript.RegisterStartupScript(((Control)sender).Page, ((Control)sender).Page.GetType(), Guid.NewGuid().ToString("N"), String.Format("alert('{0}{1}');", "Failed to delete item(s). Error: ", errorMessage), true); } } else { return; } //NameValueCollection qs = ((Control)sender).Page.Request.QueryString; } }
/// <summary> /// Invokes the specified sender. /// </summary> /// <param name="sender">The sender.</param> /// <param name="element">The element.</param> public void Invoke(object sender, object element) { if (element is CommandParameters) { CommandParameters cp = (CommandParameters)element; string gridId = cp.CommandArguments["GridId"]; if (!String.IsNullOrEmpty(cp.CommandName)) { int error = 0; string errorMessage = String.Empty; try { if (cp.CommandName.Equals("cmdApplicationLogDeleteAll")) { ProcessDeleteCommand(ApplicationLogType.ApplicationLog); } else if (cp.CommandName.Equals("cmdSystemLogDeleteAll")) { ProcessDeleteCommand(ApplicationLogType.SystemLog); } ManagementHelper.SetBindGridFlag(gridId); } catch (Exception ex) { error++; errorMessage = ex.Message; } if (error > 0) { errorMessage = errorMessage.Replace("'", "\\'").Replace(Environment.NewLine, "\\n"); ClientScript.RegisterStartupScript(((Control)sender).Page, ((Control)sender).Page.GetType(), Guid.NewGuid().ToString("N"), String.Format("alert('{0}{1}');", "Failed to delete item(s). Error: ", errorMessage), true); } } } }
/// <summary> /// Handles the LoadComplete event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void Page_LoadComplete(object sender, EventArgs e) { if (String.Compare(Request.Form["__EVENTTARGET"], CommandManager.GetCurrent(this.Page).ID, false) == 0) { object objArgs = Request.Form["__EVENTARGUMENT"]; if (objArgs != null) { Dictionary <string, object> cmd = new System.Web.Script.Serialization.JavaScriptSerializer().DeserializeObject(objArgs.ToString()) as Dictionary <string, object>; if (cmd != null && cmd.Count > 1) { object cmdName = cmd[_CommandName]; if (String.Compare((string)cmdName, _MoveCopyDialogCommand, true) == 0) { // reset start index _StartRowIndex = 0; // process move/copy command Dictionary <string, object> args = cmd[_CommandArguments] as Dictionary <string, object>; if (args != null) { ProcessMoveCopyCommand(args); ManagementHelper.SetBindGridFlag(MyListView2.CurrentListView.ID); } } } } } if (ManagementHelper.GetBindGridFlag(MyListView2.CurrentListView.ID)) { // reset start index _StartRowIndex = 0; InitDataSource(_StartRowIndex, GetMaximumRows(), true, MyListView2.CurrentListView.SortExpression); DataBind(); MyListView2.MainUpdatePanel.Update(); } }