public Entities.User GetById(int id) { using (var client = new AuthenticationServiceClient()) { AuthenticationService.User user = client.GetAll().ToList().First(authUser => authUser.Id == id); return(ServiceMapper.Mapper.Map <Entities.User>(user)); } }
private bool CheckUser(AuthenticationService.User user) { if (user != null) { return(true); } return(false); }
public void UpdateData(Updater updater, DataTable table, AuthenticationService.User user) { Log.Info("Transactions\nUser: {0}, TransactionId: {1}", user.UserName, Transaction.Current.TransactionInformation.DistributedIdentifier); if (!CheckUser(user)) { Log.Info("User: {}, Detail: Unknown User", user.UserName); throw new FaultException <SecurityTokenException>(new SecurityTokenException("Unknown User")); } try { UpdateDataFromOptions(updater, table, user); } catch (Exception ex) { Log.Error("UserId: {0}, detail: {1}", user.UserId, ex.ToString()); throw new FaultException <DbException>(new DbException(ex)); } }
public DataTable GetData(Selector selector, AuthenticationService.User user) { if (!CheckUser(user)) { Log.Info("User: {}, Detail: Unknown User", user.UserName); throw new FaultException <SecurityTokenException>(new SecurityTokenException("Unknown User")); } try { DataTable table = SelectData(user, selector); return(table); } catch (Exception ex) { Log.Error("UserId: {0}, detail: {1}", user.UserId, ex.ToString()); throw new FaultException <DbException>(new DbException(ex)); } }
private void UpdateDataFromOptions(Updater updater, DataTable table, AuthenticationService.User user) { DataUpdater update = new DataUpdater(); if (updater.UpdaterOption == UpdaterOptions.UpdateSummary) { update.UpdateSummary(table, user.UserName); } else if (updater.UpdaterOption == UpdaterOptions.UpdateAccountables) { update.UpdateAccountables(table, user.UserName); } else if (updater.UpdaterOption == UpdaterOptions.UpdateProjects) { update.UpdateProjects(table, user.UserName); } else if (updater.UpdaterOption == UpdaterOptions.UpdateItems) { update.UpdateItems(table, user.UserName); } }