public string SelectClientFromAutoCompleteDropDown(string clientId) { try { string[] strDummy = clientId.Split('_'); clientId = (strDummy[0].Contains("("))?parseClientID(strDummy[0]):strDummy[0]; string viewID = strDummy[1]; if (!string.IsNullOrEmpty(clientId)) { if ((((CffPrincipal)Context.User).IsInClientRole == true || ((CffPrincipal)Context.User).IsInCustomerRole == true) && (clientId == "-1")) { //force to zero to return an error so we do not allow allclients scope for client or customer role clientId = "0"; } SessionWrapper.Instance.GetSession(viewID).ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(Convert.ToInt32(clientId)); SessionWrapper.Instance.GetSession(viewID).IsDeselectingCustomer = false; if (SessionWrapper.Instance.GetSession(viewID).CurrentUserID != (System.Web.HttpContext.Current.User as CffPrincipal).CffUser.UserId.ToString()) { SessionWrapper.Instance.GetSession(viewID).CurrentUserID = (System.Web.HttpContext.Current.User as CffPrincipal).CffUser.UserId.ToString(); } if (SessionWrapper.Instance.Get != null) { SessionWrapper.Instance.Get.ClientFromQueryString = SessionWrapper.Instance.GetSession(viewID).ClientFromQueryString; } } IScopeService scopeService = new ScopeService(this, SecurityManagerFactory.Create(Context.User as CffPrincipal, SessionWrapper.Instance.GetSession(viewID).Scope), RepositoryFactory.CreateClientRepository(), RepositoryFactory.CreateCustomerRepository() ); scopeService.SelectClient(int.Parse(clientId)); } catch (FormatException) { } return(string.Empty); }