/// <summary> /// Retrieves the user information about the job data /// </summary> /// <param name="jali">JobAccountingLogItem</param> /// <param name="jad">XElement</param> private void GetUserInfoData(JobAccountingLogItem jali, XElement jad) { var ui = GetElementsSelf(jad, "UserInfo"); var uiLog = ui.Select(x => new UserLogItem() { AuthenticationAgentIdentifier = GetChildElementValue(x, "AuthenticationAgentIdentifier"), AuthenticationAgentName = GetChildElementValue(x, "AuthenticationAgentName"), AuthenticationAgentUUID = GetChildElementValue(x, "AuthenticationAgentUUID"), AuthenticationCategory = GetChildElementValue(x, "AuthenticationCategory"), AuthorizationAgentName = GetChildElementValue(x, "AuthorizationAgentName"), AuthorizationAgentUUID = GetChildElementValue(x, "AuthorizationAgentUUID"), Department = GetChildElementValue(x, "Department"), DepartmentAccessCode = GetChildElementValue(x, "DepartmentAccessCode"), DisplayName = GetChildElementValue(x, "DisplayName"), FullyQualifiedUserName = GetChildElementValue(x, "FullyQualifiedUserName"), UserDomain = GetChildElementValue(x, "UserDomain"), UserName = GetChildElementValue(x, "UserName") }).First(); jali.UserInfo = uiLog; }
/// <summary> /// Retrieves the HTTP job info from the given XElement and stores in JobAcountingLogItem /// </summary> /// <param name="jali">JobAccountingLogItem</param> /// <param name="jad">XElement</param> private void GetHttpInfoData(JobAccountingLogItem jali, XElement jad) { // get the URI path and completion status var log = GetHttpInfo(jad).First(); var fs = GetElementsSelf(jad, "FileSummaries"); // <HTTPInfo><DeliveredFilesInfo></FileSummaries></DelivededFilesInfo></HTTPInfo> if (fs.Count > 0) { // retrieve inner node info var fsLog = fs.Select(f => new HTTPLogItem() { FileNameBase = GetChildElementValue(f, "FileNameBase"), TotalDataSize = GetChildElementValue(f, "TotalDataSize"), FileNameExtension = GetChildElementValue(f, "FileNameExtension"), }).First(); // now add in the retrieved child elements. log.FileNameBase = fsLog.FileNameBase; log.FileNameExtension = fsLog.FileNameExtension; log.TotalDataSize = fsLog.TotalDataSize; jali.HttpInfo = log; } }
/// <summary> /// Retrieves the driver information of the job data /// </summary> /// <param name="jali">JobAccountingLogItem</param> /// <param name="jad">XElement</param> private void GetDriverInfoData(JobAccountingLogItem jali, XElement jad) { var clientInfo = GetElements(jad, "ClientInfo"); var ApplicationInfo = GetElements(jad, "ApplicationInfo"); // Some DriverInfo does not have any data other than a few paired values if (clientInfo.Count > 0 && ApplicationInfo.Count > 0) { var ciLog = clientInfo.Select(x => new DriverLogItem() { ClientInfo_Hostname = GetChildElementValue(x, "Hostname"), ClientInfo_IPAddress = GetChildElementValue(x, "IPAddress") }).First(); var aiLog = ApplicationInfo.Select(y => new DriverLogItem() { ApplicationName = GetChildElementValue(y, "ApplicationName"), FileName = GetChildElementValue(y, "FileName") }).First(); jali.DriverInfo = ciLog; jali.DriverInfo.ApplicationName = aiLog.ApplicationName; jali.DriverInfo.FileName = aiLog.FileName; jali.DriverInfo.JobUUID = GetChildElementValue(jad, "JobUUID"); } }
/// <summary> /// Creates a new JobAcountingLogItem. If the passed in value isn't null adds to list. /// Only time it should be null is first time through. /// </summary> /// <param name="JobAccountList"></param> /// <param name="jali">JobAccountingLogItem</param> /// <returns>JobAccountingLogItem</returns> private JobAccountingLogItem AddJobAccountingItemToList(List <JobAccountingLogItem> JobAccountList, JobAccountingLogItem jali) { if (jali != null) { JobAccountList.Add(jali); } jali = new JobAccountingLogItem(); return(jali); }
/// <summary> /// Retrieves the scan information for the Job log and stores in JobAccountingLogItem /// </summary> /// <param name="jali">JobAccountingLogItem</param> /// <param name="jad">XElement</param> private void GetScanInfoData(JobAccountingLogItem jali, XElement jad) { var counters = GetElementsFirst(jad, "Counter"); var fss = GetElements(jad, "FirstScannedSheet"); if (fss.Count > 0 && counters.Count > 0) { var fssLog = fss.Select(fs => new ScanLogItem() { MediaInputID = GetChildElementValue(fs, "MediaInputID"), MediaSizeID = GetChildElementValue(fs, "MediaSizeID"), Plex = GetChildElementValue(fs, "Plex"), }); jali.ScanInfo = fssLog.First(); GetScanerInfoData(jali.ScanInfo, counters); } }
/// <summary> /// Uses the retrieved job log to retrieve information on the following types /// of device jobs: JobInfo, HTTPInfo, PrintInfo, FolderInfo, and ScanInfo /// </summary> /// <param name="role">string</param> /// <param name="password">string</param> /// <returns>List<JobAccountingLogItem></returns> public List <JobAccountingLogItem> GetJobLog(string role, string password) { List <JobAccountingLogItem> JobAccountList = new List <JobAccountingLogItem>(); var jobAccountingTable = GetJobLogAsElement(role, password); var jobAccountingData = GetElements(jobAccountingTable, "JobAccountingData"); JobAccountingLogItem jali = null; foreach (XElement jad in jobAccountingData.Nodes()) { XName name = jad.Name; switch (name.LocalName) { case "JobInfo": jali = AddJobAccountingItemToList(JobAccountList, jali); GetJobInfoData(jali, jad); break; case "UserInfo": GetUserInfoData(jali, jad); break; case "HTTPInfo": GetHttpInfoData(jali, jad); break; case "PrintInfo": GetPrintInfoData(jali, jad); break; case "FolderInfoList": GetFolderInfoData(jali, jad); break; case "ScanInfo": GetScanInfoData(jali, jad); break; case "DriverInfo": GetDriverInfoData(jali, jad); break; } } JobAccountList.Add(jali); return(JobAccountList); }
/// <summary> /// Retrieves the job info data retrieved form the device job log /// </summary> /// <param name="jali">XElement</param> /// <param name="jad">JobAccountingLogItem</param> private void GetJobInfoData(JobAccountingLogItem jali, XElement jad) { var ji = GetElementsSelf(jad, "JobInfo"); var jobLog = ji.Select(x => new JobLogItem() { UUID = GetChildElementValue(x, "UUID"), ApplicationName = GetChildElementValue(x, "ApplicationName"), DeviceJobName = GetChildElementValue(x, "DeviceJobName"), JobCategory = GetChildElementValue(x, "JobCategory"), JobDoneStatus = GetChildElementValue(x, "JobDoneStatus"), JobDoneTimestamp = GetChildElementValue(x, "JobDoneTimeStamp"), JobStartedTimestamp = GetChildElementValue(x, "JobStartedTimeStamp"), }); foreach (var jl in jobLog) { jali.JobInfo = jl; } }
/// <summary> /// Retrieves and adds the Print job information /// </summary> /// <param name="jali">JobAccountingLogItem</param> /// <param name="jad">XElement</param> private void GetPrintInfoData(JobAccountingLogItem jali, XElement jad) { var counters = GetPICounters(jad); var ps = GetElements(jad, "PrintSettings"); var fps = GetElements(jad, "FirstPrintedSheet"); if (fps.Count > 0 && ps.Count > 0) { var fpsLog = fps.Select(f => new PrintLogItem() { MediaSizeID = GetChildElementValue(f, "MediaSizeID"), MediaTypeID = GetChildElementValue(f, "MediaTypeID"), MediaInputID = GetChildElementValue(f, "MediaInputID"), Plex = GetChildElementValue(f, "Plex"), }); jali.PrintInfo = fpsLog.First(); jali.PrintInfo.PrintQuality = GetPrintQuality(ps); GetCounterData(jali.PrintInfo, counters); } }
/// <summary> /// Retrieves and adds the Folder information /// </summary> /// <param name="jali">JobAccountingLogItem</param> /// <param name="jad">XElement</param> private void GetFolderInfoData(JobAccountingLogItem jali, XElement jad) { var folder = GetElements(jad, "FolderInfo"); var file = GetElements(folder.FirstOrDefault(), "File"); if (folder.Count > 0 && file.Count > 0) { var folderLog = folder.Select(fld => new FolderLogItem() { UNCPath = GetChildElementValue(fld, "UNCPath"), CompletionStatus = GetChildElementValue(fld, "CompletionStatus"), }); var fileLog = file.Select(f => new FolderLogItem() { Filename = GetChildElementValue(f, "FileName"), DataSize = GetChildElementValue(f, "DataSize"), }); jali.FolderInfo = folderLog.First(); jali.FolderInfo.Filename = fileLog.First().Filename; jali.FolderInfo.DataSize = fileLog.First().DataSize; } }