public Response[] GetMenu(GetMenuUSER[] users, bool useDomainInUserID) { Authorizer authorizer = Authorizer.GetInstance(); try { if (users == null || users.Length == 0) { return(new Response[0]); } GetMenuServiceReal.GetMenuServiceClient client = new GetMenuServiceReal.GetMenuServiceClient(); GetMenuServiceReal.GetMenuUSER[] realUsers = new GetMenuServiceReal.GetMenuUSER[users.Length]; for (int i = 0; i < users.Length; i++) { GetMenuUSER user = users[i]; GetMenuServiceReal.GetMenuUSER realUser = new GetMenuServiceReal.GetMenuUSER(); if (user.LoginId == null) { return(errorResponse("loginId is null")); } else if (!authorizer.IsAuthorized(user.LoginId, useDomainInUserID)) { return(errorResponse("unauthorized query for login id: " + user.LoginId)); } realUser.LoginId = user.LoginId; realUser.Language = user.Language; realUsers[i] = realUser; } object[] realObjects = client.GetMenu(realUsers); int n = realObjects.Length; Response[] responses = new Response[n]; for (int i = 0; i < n; i++) { object o = realObjects[i]; Response response = new Response(); responses[i] = response; if (o is GetMenuServiceReal.ResponseSuccess) { GetMenuServiceReal.ResponseSuccess realSuccess = (GetMenuServiceReal.ResponseSuccess)o; response.Description = realSuccess.Description; response.MenuId = realSuccess.MenuId; response.MenuLineType = realSuccess.MenuLineType; response.RoutineId = realSuccess.RoutineId; response.Success = true; } else if (o is GetMenuServiceReal.ResponseFailure) { GetMenuServiceReal.ResponseFailure realFailure = (GetMenuServiceReal.ResponseFailure)o; response.ErrorText = realFailure.ErrorText; response.Success = false; } } return(responses); } catch (Exception e) { Console.WriteLine("got an Exception in GetMenu: {0}", e.Message); throw new Exception("GetMenu Exception", e); } }
public XmlDocument GetMenu() { GetMenuUSER user = new GetMenuUSER(); OMSConfigurationSection config = ConfigurationManager.GetSection("imi.supplychain.ux.modules.ordermanagement") as OMSConfigurationSection; if (config.SendDomainUserId) { user.LoginId = UserSessionService.DomainUser; } else { user.LoginId = UserSessionService.UserId; } user.Language = omsSessionContext.OMSLanguageCode; Imi.SupplyChain.Services.OrderManagement.Menu.DataContracts.Response[] orderMenu = GetMenuService.GetMenu(new GetMenuUSER[] { user }, config.SendDomainUserId); XmlDocument menu = TransformOrderMenuXml(orderMenu); //Debug.WriteLine(menu.OuterXml); return(menu); }