public User LoginSMUSer(String user, String password) { User loggedUser = new User(); try { RichDocument document = new RichDocument(); document.SetResponseType(ResponseType.Data); document.AddUserLogin(user, password); document.EncryptAuthentication = false; //document.AddHeader("USER", "SYSTEM"); //document.AddHeader("PASSWORD", ""); Entity entity = document.AddEntity("USER"); Thermo.SM.LIMSML.Helper.Low.Action action = entity.AddAction("LOGIN"); Limsml response = callService(document.Xml); if (response != null) { if (response.NumberOfErrors() > 0) { for (int i = 0; i < response.Errors.Count; i++) { log.Error(response.GetError(i).ToString()); } //throw new ReportGeneratorException(); } else { //success if (response.GetData("").Tables.Count == 0) { throw new Exception("Unexpected return"); } loggedUser.Login = user; loggedUser.Password = password; } } } catch (Exception e) { log.Error("Erro ao processar o Web Service", e); } return(loggedUser); }
//private readonly String smURL = Properties.Settings.Default.samplemanager_url; public List <Report> ListAllReports(String user, String password) { List <Report> reportsList = new List <Report>(); try { RichDocument document = new RichDocument(); document.SetResponseType(ResponseType.Data); document.AddUserLogin(user, password); document.EncryptAuthentication = false; //document.AddHeader("USER", "SYSTEM"); //document.AddHeader("PASSWORD", ""); Entity entity = document.AddEntity("INFOMAKER_LINK"); Thermo.SM.LIMSML.Helper.Low.Action action = entity.AddAction("BROWSE"); action.AddParameter("CRITERIA", "INFOMAKER_LINKS"); action.AddParameter("FIELD", "IDENTITY"); //action.AddParameter("ALL_VERSIONS", "FALSE"); Limsml response = callService(document.Xml); if (response != null) { if (response.NumberOfErrors() > 0) { for (int i = 0; i < response.Errors.Count; i++) { log.Error(response.GetError(i).ToString()); } //throw new ReportGeneratorException(); } else { //success if (response.GetData("").Tables.Count == 0) { throw new Exception("Unexpected return"); } int rows = response.GetData("").Tables[0].Rows.Count; for (int i = 0; i < rows; i++) { //ReportParameter parameter = new ReportParameter(); Report rep = new Report(); rep.Id = response.GetData("").Tables[0].Rows[i][0].ToString(); rep.Name = response.GetData("").Tables[0].Rows[i][6].ToString(); rep.Description = response.GetData("").Tables[0].Rows[i][7].ToString(); rep.Library = response.GetData("").Tables[0].Rows[i][8].ToString(); rep.IM_Report = response.GetData("").Tables[0].Rows[i][9].ToString(); reportsList.Add(rep); } } } } catch (Exception e) { log.Error("Erro ao processar o Web Service", e); } return(reportsList); }