private IEnumerable <string> GetSelectedIds() { ISelectionService oSelectionService = SelectionServiceRequest.GetSelectionService(); if (oSelectionService == null) { ShowMessage("Err_SelectionService"); return(null); } ISelectionContext oSelectionContext = oSelectionService.GetSelectionContext(hfSelections.Value); if (oSelectionContext == null) { ShowMessage("Err_SelectionContext"); return(null); } var ids = oSelectionContext.GetSelectedIds(); if (ids.Count == 0) { ShowMessage("Err_Selection"); return(null); } return(ids); }
protected void btnComplete_Click(object sender, EventArgs e) { string key = hfSelections.Value; bool completeAll = true; ISelectionService srv = SelectionServiceRequest.GetSelectionService(); ISelectionContext selectionContext = srv.GetSelectionContext(key); List <string> ids = selectionContext.GetSelectedIds(); foreach (string id in ids) { ILitRequest lit = EntityFactory.GetById <ILitRequest>(id); if (UserCalendar.CurrentUserCanEdit(lit.CreateUser)) { lit.CompleteLitRequest(); } else { completeAll = false; } } // this has to occur after the fulfillment is completed. The status needs to be updated before refresh is called. ScriptManager.RegisterStartupScript(this, typeof(SmartParts_TaskPane_LiteratureManagementTasks), "refreshList", "RefreshList();", true); if (!completeAll) { DialogService.ShowMessage(GetLocalResourceObject("Err_Complete").ToString(), 70, 400); } }
protected void btnFulfill_Click(object sender, EventArgs e) { StringBuilder labelIds = new StringBuilder(); string key = hfSelections.Value; ISelectionService srv = SelectionServiceRequest.GetSelectionService(); ISelectionContext selectionContext = srv.GetSelectionContext(key); List <string> ids = selectionContext.GetSelectedIds(); foreach (string id in ids) { if (hfLastFulfilledIds.Value.Contains(id)) { var lit = EntityFactory.GetById <ILitRequest>(id); if (lit != null) { labelIds.Append(string.Format("{0},", lit.Contact.Id)); lit.FulfillLitRequest(); } } } if (LabelsDropdown.SelectedIndex > 0) { string sPluginId = LabelsDropdown.SelectedValue; if (labelIds.ToString().EndsWith(",")) { labelIds = labelIds.Remove(labelIds.Length - 1, 1); } ScriptManager.RegisterStartupScript(this, typeof(SmartParts_TaskPane_LiteratureManagementTasks), "printLabels", string.Format("PrintLabels('{0}', '{1}');", sPluginId, labelIds), true); } // this has to occur after the fulfillment is completed. The status needs to be updated before refresh is called. ScriptManager.RegisterStartupScript(this, typeof(SmartParts_TaskPane_LiteratureManagementTasks), "refreshList", "RefreshList();", true); }
private List <String> GetSelectedRecords() { ISelectionService srv = SelectionServiceRequest.GetSelectionService(); ISelectionContext selectionContext = srv.GetSelectionContext(hfSelections.Value); if (selectionContext != null) { return(selectionContext.GetSelectedIds()); } //if none selected, assume it is the current one EntityPage page = Page as EntityPage; if (page != null && page.EntityContext != null) { return(new List <string> { page.EntityContext.EntityID.ToString() }); } return(null); }
public void MergeRecords(String selectionContextKey) { Dialog.SetSpecs(-1, -1, 750, 650, "MergeRecords"); IGroupContextService srv = ApplicationContext.Current.Services.Get <IGroupContextService>() as GroupContextService; EntityGroupInfo currentEntityGroupInfo = srv.GetGroupContext().CurrentGroupInfo; ISelectionService selectionService = (ISelectionService)SelectionServiceRequest.GetSelectionService(); ISelectionContext selectionContext = selectionService.GetSelectionContext(selectionContextKey); IList <string> list = selectionContext.GetSelectedIds(); if (list != null) { MergeArguments mergeArguments = new MergeArguments(list[0], list[1], currentEntityGroupInfo.EntityType, currentEntityGroupInfo.EntityType); Dialog.DialogParameters.Add("mergeArguments", mergeArguments); Dialog.ShowDialog(); } else { throw new ValidationException("The selection service does not contain any selected records."); } }
/// <summary> /// /// </summary> /// <returns></returns> private IList <string> GetSelectedIds(string selectionKey) { List <string> ids = new List <string>(); if (selectionKey == "selectAll") { GroupContextService groupContextService = ApplicationContext.Current.Services.Get <IGroupContextService>() as GroupContextService; if (groupContextService != null) { CachedGroup currentGroup = groupContextService.GetGroupContext().CurrentGroupInfo.CurrentGroup; ids = currentGroup.GetIdList(); } } else { ISelectionService srv = SelectionServiceRequest.GetSelectionService(); ISelectionContext selectionContext = srv.GetSelectionContext(selectionKey); ids = selectionContext.GetSelectedIds(); } return(ids); }
private string GetSelectedRecord() { ISelectionService srv = (ISelectionService)SelectionServiceRequest.GetSelectionService(); ISelectionContext selectionContext = srv.GetSelectionContext(hfSelections.Value); if (selectionContext != null) { List <string> ids = selectionContext.GetSelectedIds(); if (ids.Count > 0) { return(ids[0]); } } //if none selected, assume it is the current one EntityPage page = Page as EntityPage; if (page != null && !page.IsListMode && page.EntityContext != null) { return(page.EntityContext.EntityID.ToString()); } return(String.Empty); }
private string GetSelectedRecord() { var page = Page as EntityPage; if (page != null && page.IsListMode) { var srv = SelectionServiceRequest.GetSelectionService(); var selectionContext = srv.GetSelectionContext("list"); if (selectionContext != null) { var ids = selectionContext.GetSelectedIds(); if (ids.Count > 0) { return(ids[0]); } } } else if (page != null && page.EntityContext != null) { return(page.EntityContext.EntityID.ToString()); } return(String.Empty); }