public LoginInternalResult Login(string username, string password, int companyNumber, string languageID, bool firstLogin, bool singleTenant) { _nLogLogger.Debug($"username {username}", "Login"); _nLogLogger.Debug($"password {password}", "Login"); _nLogLogger.Debug($"companyNumber {companyNumber}", "Login"); _nLogLogger.Debug($"languageID {languageID}", "Login"); _nLogLogger.Debug($"firstLogin {firstLogin}", "Login"); _nLogLogger.Debug($"singleTenant {singleTenant}", "Login"); var pdsUserLoginDataSet = new pdsUserLoginDataSet(); pdsUserLoginDataSet.ttblUserLogin.AddttblUserLoginRow(username, password, companyNumber, languageID, firstLogin, singleTenant); var cErrorMessage = string.Empty; StopwatchUtil.Time( () => { this._poLoginproxy.Login(ref this._pdsContext, ref pdsUserLoginDataSet, out cErrorMessage); }); _nLogLoggerP.Trace("Login"); if (!string.IsNullOrEmpty(cErrorMessage)) { if (cErrorMessage.Contains(OperInUse)) { _nLogLogger.Warn($"Error returned - {cErrorMessage}", "PopulateLoginModel"); } else { _nLogLogger.Error($"Error returned - {cErrorMessage}", "PopulateLoginModel"); } } if (pdsUserLoginDataSet.HasErrors) { _nLogLogger.Error("pdsUserContext is showing errors", "Login"); } var result = new UserLogin(); if (pdsUserLoginDataSet.ttblUserLogin.Count > 0) { result = UserLogin.BuildUserLoginFromRow(pdsUserLoginDataSet.ttblUserLogin[0]); } var loginInternalResult = this.PopulateLoginModel(pdsUserLoginDataSet.HasErrors, cErrorMessage, result, firstLogin); loginInternalResult.availUsers = new List <AvailUsers>(); foreach (DataRow row in pdsUserLoginDataSet.ttblAvailUsers) { _nLogLogger.Debug($"Building Avail Users", "Login"); loginInternalResult.availUsers.Add(AvailUsers.BuildAvailUsersFromRow(row)); } _nLogLogger.Debug($"Finished Login", "Login"); return(loginInternalResult); }
public LoginLoginResponseAPI Login(UserLogin UserLogin) { var result = new LoginLoginResponseAPI(); var pdsUserLogin = new pdsUserLoginDataSet(); DataRow ttblUserLoginCriteria = pdsUserLogin.ttblUserLogin.NewttblUserLoginRow(); UserLogin.UpdateRowFromUserLogin(ref ttblUserLoginCriteria, UserLogin); pdsUserLogin.ttblUserLogin.AddttblUserLoginRow((pdsUserLoginDataSet.ttblUserLoginRow)ttblUserLoginCriteria); string cErrorMessage = string.Empty; NLogLoggerP.Trace("Login - Login - Before Call"); StopwatchUtil.Time( () => { using (var poLoginproxy = this.proxyAppObject.CreatePO_loginproxy()) { this.SetRequiredContextParameters(); poLoginproxy.Login(ref pdsContext, ref pdsUserLogin, out cErrorMessage); } }); NLogLoggerP.Info("Login - Login - After Call"); this.ReportErrors(cErrorMessage); this.ReportErrors(this.pdsContext); this.ReportErrors(pdsUserLogin); foreach (DataRow row in pdsUserLogin.ttblAvailUsers) { result.availUsers.Add(AvailUsers.BuildAvailUsersFromRow(row)); } if (pdsUserLogin.ttblUserLogin.Count > 0) { result.userLogin = UserLogin.BuildUserLoginFromRow(pdsUserLogin.ttblUserLogin[0]); } return(result); }