/// <summary> /// Populate User's details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void mrsClient_GetCurrentUserCompleted(object sender, GetCurrentUserCompletedEventArgs e) { if (e.Error == null) { User currentUser = e.Result; if (currentUser != null) { txtFullName.Text = currentUser.FullName; txtRegion.Text = currentUser.RegionName; _currentApp.CurrentUserFullName = currentUser.FullName; _currentApp.CurrentUserId = currentUser.UserId; _currentApp.CurrentRegionId = currentUser.RegionId; _currentApp.CurrentUserStateID = currentUser.StateId.ToString(); _currentApp.CurrentUserPrimaryRoleId = currentUser.PrimaryRoleId; RetailSystemClient mrsClient = new RetailSystemClient(); mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl()); mrsClient.GetUserRolesCompleted += new EventHandler <GetUserRolesCompletedEventArgs>(mrsClient_GetUserRolesCompleted); mrsClient.GetUserRolesAsync(currentUser.UserId); } else { UserValidationError(); } } else { ExceptionHandler.PopUpErrorMessage(e.Error, "GetCurrentUserCompleted"); UserValidationError(); } }
/// <summary> /// Populate User's details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void mrsClient_GetCurrentUserCompleted(object sender, GetCurrentUserCompletedEventArgs e) { if (e.Error == null) { User currentUser = e.Result; if (currentUser != null) { _currentApp.CurrentUserFullName = currentUser.FullName; _currentApp.CurrentUserId = currentUser.UserId; _currentApp.CurrentRegionId = currentUser.RegionId; _currentApp.LoginPriceRegionId = currentUser.LoginPriceRegionId; _currentApp.CurrentUserStateID = currentUser.StateId.ToString(); _currentApp.CurrentUserPrimaryRoleId = currentUser.PrimaryRoleId; txtFullName.Text = String.Format("Welcome {0} from {1}", currentUser.FullName, currentUser.RegionName); RetailSystemClient mrsClient = new RetailSystemClient(); mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Utilities.GetMetriconRetailSystemWcfClientEndpointUrl()); mrsClient.GetUserRolesCompleted += new EventHandler<GetUserRolesCompletedEventArgs>(mrsClient_GetUserRolesCompleted); mrsClient.GetUserRolesAsync(currentUser.UserId); mrsClient.GetRoleAccessModuleCompleted += new EventHandler<GetRoleAccessModuleCompletedEventArgs>(mrsClient_GetRoleAccessModuleCompleted); mrsClient.GetRoleAccessModuleAsync(currentUser.PrimaryRoleId); } else UserValidationError(); } else { ExceptionHandler.PopUpErrorMessage(e.Error, "GetCurrentUserCompleted"); UserValidationError(); } BusyIndicator1.IsBusy = false; }