public string TestSapConnection(SAPProfile profile) { try { string returnStr = "Success"; //var repo = new RepositoryFactory().CreateConfigurationRepository(); //ServerConfig serverConfig = repo.Get(x => x.IsActive == true).FirstOrDefault(); GlobalInstance.Instance.UName = profile.UserId; GlobalInstance.Instance.Pword = profile.Password; GlobalInstance.Instance.DisposeSboComObject(); GlobalInstance.Instance.InitializeSboComObject(); if (!GlobalInstance.Instance.IsConnected) { returnStr = GlobalInstance.Instance.SBOErrorMessage; } return(returnStr); } catch (Exception ex) { //log error here return($"Unable to test profile. {ex.Message} Please contact administrator."); } }
public string UpdateSAPProfile(SAPProfile profile) { try { ConfigurationManager.AppSettings["uid"] = profile.UserId; ConfigurationManager.AppSettings["pword"] = profile.Password; return("Success"); } catch (Exception) { return("Unable to update profile. Please contact administrator."); } }