public DocumentFolderListReturnValue GetDocumentFolderList(HostSecurityToken oHostSecurityToken, Guid projectId) { DocumentFolderListReturnValue ReturnValue = new DocumentFolderListReturnValue(); if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDocumentService = new DocumentService(); ReturnValue = oDocumentService.GetDocumentFolderList(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId); } else { ReturnValue returnValue = new ReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(ReturnValue); }
public DocumentFolderListReturnValue GetDocumentFolderList(Guid logonId, Guid projectId) { DataTable dtDocumentFolders = new DataTable(); DocumentFolderListReturnValue returnValue = new DocumentFolderListReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { using (SqlConnection cn = new SqlConnection(ApplicationSettings.Instance.ConnectionString)) { SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_GetDocumentFolders"; cmd.Parameters.Add(new SqlParameter("@ProjectId", projectId)); cn.Open(); using (SqlDataAdapter da = new SqlDataAdapter(null,cn)) { da.SelectCommand = cmd; da.Fill(dtDocumentFolders); } } returnValue.Document = new List<string>(); // Add the Default Folder that's always there but not shown in the ILB database see PmsSolution\Pms\IRIS.Law.PmsCommon\CommonForms\FrmDocDetails.cs returnValue.Document.Add("Documents"); foreach (DataRow dr in dtDocumentFolders.Rows) { returnValue.Document.Add(dr[0].ToString()); } } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }