/// <summary> /// Retrieving Personalised Layout /// </summary> /// <param name="objUserID">UserName of User</param> /// <param name="callback"> DashboardPreferences</param> public void GetDashboardPreferenceByUserName(string userName, Action <List <tblDashboardPreference> > callback) { string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); ServiceLog.LogServiceCall(_logger, methodNamespace, DateTime.Now.ToUniversalTime(), SessionManager.SESSION.UserName); DashboardOperationsClient client = new DashboardOperationsClient(); client.Endpoint.Behaviors.Add(new CookieBehavior()); client.GetDashboardPreferenceByUserNameAsync(userName); client.GetDashboardPreferenceByUserNameCompleted += (se, e) => { if (e.Error == null) { if (callback != null) { if (e.Result != null) { callback(e.Result.ToList()); } else { callback(null); } } } else if (e.Error is FaultException <GreenField.ServiceCaller.DashboardDefinitions.ServiceFault> ) { FaultException <GreenField.ServiceCaller.DashboardDefinitions.ServiceFault> fault = e.Error as FaultException <GreenField.ServiceCaller.DashboardDefinitions.ServiceFault>; Prompt.ShowDialog(fault.Reason.ToString(), fault.Detail.Description, MessageBoxButton.OK); if (callback != null) { callback(null); } } else { Prompt.ShowDialog(e.Error.Message, e.Error.GetType().ToString(), MessageBoxButton.OK); if (callback != null) { callback(null); } } ServiceLog.LogServiceCallback(_logger, methodNamespace, DateTime.Now.ToUniversalTime(), SessionManager.SESSION.UserName); }; }
/// <summary> /// Get all Roles /// </summary> /// <param name="callback">Roles</param> public void GetAllRoles(Action <System.Collections.Generic.List <string> > callback) { string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); ServiceLog.LogServiceCall(LoggerFacade, methodNamespace, DateTime.Now.ToUniversalTime(), SessionManager.SESSION != null ? SessionManager.SESSION.UserName : "******"); LoginDefinitions.LoginOperationsClient client = new LoginDefinitions.LoginOperationsClient(); client.Endpoint.Behaviors.Add(new CookieBehavior()); client.GetAllRolesAsync(); client.GetAllRolesCompleted += (se, e) => { if (e.Error == null) { if (callback != null) { if (e.Result != null) { callback(e.Result.ToList()); } else { callback(null); } } } else if (e.Error is FaultException <GreenField.ServiceCaller.LoginDefinitions.ServiceFault> ) { FaultException <GreenField.ServiceCaller.LoginDefinitions.ServiceFault> fault = e.Error as FaultException <GreenField.ServiceCaller.LoginDefinitions.ServiceFault>; Prompt.ShowDialog(fault.Reason.ToString(), fault.Detail.Description, MessageBoxButton.OK); if (callback != null) { callback(null); } } else { Prompt.ShowDialog(e.Error.Message, e.Error.GetType().ToString(), MessageBoxButton.OK); if (callback != null) { callback(null); } } ServiceLog.LogServiceCallback(LoggerFacade, methodNamespace, DateTime.Now.ToUniversalTime() , SessionManager.SESSION != null ? SessionManager.SESSION.UserName : "******"); }; }
/// <summary> /// Create Membership User /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <param name="email"></param> /// <param name="passwordQuestion"></param> /// <param name="passwordAnswer"></param> /// <param name="isApproved"></param> /// <param name="callback">MembershipCreateStatus</param> public void CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, Action <string> callback) { string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); ServiceLog.LogServiceCall(LoggerFacade, methodNamespace, DateTime.Now.ToUniversalTime(), SessionManager.SESSION != null ? SessionManager.SESSION.UserName : "******"); LoginDefinitions.LoginOperationsClient client = new LoginDefinitions.LoginOperationsClient(); client.Endpoint.Behaviors.Add(new CookieBehavior()); client.CreateUserAsync(username, password, email, passwordQuestion, passwordAnswer, isApproved, callback); client.CreateUserCompleted += (se, e) => { if (e.Error == null) { if (callback != null) { callback(e.Result.ToString()); } } else if (e.Error is FaultException <GreenField.ServiceCaller.LoginDefinitions.ServiceFault> ) { FaultException <GreenField.ServiceCaller.LoginDefinitions.ServiceFault> fault = e.Error as FaultException <GreenField.ServiceCaller.LoginDefinitions.ServiceFault>; Prompt.ShowDialog(fault.Reason.ToString(), fault.Detail.Description, MessageBoxButton.OK); if (callback != null) { callback(null); } } else { Prompt.ShowDialog(e.Error.Message, e.Error.GetType().ToString(), MessageBoxButton.OK); if (callback != null) { callback(null); } } ServiceLog.LogServiceCallback(LoggerFacade, methodNamespace, DateTime.Now.ToUniversalTime(), SessionManager.SESSION != null ? SessionManager.SESSION.UserName : "******"); }; }