protected void btnOk_Click(object sender, EventArgs e) { if (AccountHelper.AuthorizedModifyAccount(SiteID, true)) { string resultMessage = string.Empty; Action action = (Action)ValidationHelper.GetInteger(drpAction.SelectedItem.Value, 0); What what = (What)ValidationHelper.GetInteger(drpWhat.SelectedItem.Value, 0); string where = string.Empty; switch (what) { // All items case What.All: where = CMSContext.ResolveMacros(gridElem.WhereCondition); break; // Selected items case What.Selected: where = SqlHelperClass.GetWhereCondition <int>("AccountID", gridElem.SelectedItems, false); break; default: return; } switch (action) { // Action 'Remove' case Action.Remove: // Clear HQ ID of selected accounts AccountInfoProvider.UpdateAccountHQ(0, where); resultMessage = GetString("om.account.massaction.removed"); break; default: return; } if (!string.IsNullOrEmpty(resultMessage)) { lblInfo.Text = resultMessage; lblInfo.Visible = true; } // Reload UniGrid gridElem.ClearSelectedItems(); gridElem.ReloadData(); pnlUpdate.Update(); } }
protected void btnOk_Click(object sender, EventArgs e) { if (AccountHelper.AuthorizedModifyAccount(SiteID, true)) { Action action = (Action)ValidationHelper.GetInteger(drpAction.SelectedItem.Value, 0); What what = (What)ValidationHelper.GetInteger(drpWhat.SelectedItem.Value, 0); string where = string.Empty; switch (what) { // All items case What.All: where = MacroResolver.Resolve(gridElem.WhereCondition); break; // Selected items case What.Selected: where = SqlHelper.GetWhereCondition <int>("AccountID", gridElem.SelectedItems, false); break; default: return; } switch (action) { // Action 'Remove' case Action.Remove: // Clear HQ ID of selected accounts AccountInfoProvider.UpdateAccountHQ(0, where); ShowConfirmation(GetString("om.account.massaction.removed")); break; default: return; } // Reload UniGrid gridElem.ClearSelectedItems(); gridElem.ReloadData(); pnlUpdate.Update(); } }
/// <summary> /// Items changed event handler. /// </summary> private void UniSelector_OnItemsSelected(object sender, EventArgs e) { if (AccountHelper.AuthorizedModifyAccount(SiteID, true)) { // Get new items from selector string newValues = ValidationHelper.GetString(accountSelector.Value, null); string[] newItems = newValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (newItems != null) { // Set HQ ID of selected accounts to edited account ID string where = SqlHelper.GetWhereCondition <int>("AccountID", newItems, false); AccountInfoProvider.UpdateAccountHQ(ai.AccountID, where); gridElem.ReloadData(); pnlUpdate.Update(); accountSelector.Value = null; } } }