protected override void RecordSheetCount(string accid, uint sheetCount, string propName, string propValue, JOB_RESULTS_BASE_TYPE results) { if (!UserAccount.Has(accid)) { return; } UserAccount uac = UserAccount.Get(accid); string paperSize = string.Empty; foreach (PROPERTY_SET_TYPE propType in results.properties) { if (propType.sysname.IndexOf("original-size", StringComparison.OrdinalIgnoreCase) >= 0) { paperSize = propType.Value; break; } } JOB_MODE_TYPE jobMode = results.jobmode; E_JOB_STATUS_TYPE jobStatus = results.jobstatus.status; if (jobStatus.ToString().ToUpper() == "FINISHED") { string keyLine = MapJobModeToLimits(jobMode) + "," + propName + "," + propValue; // Fog Big size Pages int pageScaler = int.Parse(WebConfigurationManager.AppSettings["PageScaler"].ToString()); string bigSizePages = WebConfigurationManager.AppSettings["BigSizePages"].ToString(); if (string.IsNullOrEmpty(paperSize) == false && bigSizePages.ToLower().IndexOf(paperSize.ToLower()) >= 0) { sheetCount = (uint)(sheetCount / pageScaler); } lock (uac) { uint currentLimit = uac.limit[keyLine]; uint newLimit = (currentLimit > sheetCount) ? (currentLimit - sheetCount) : 0; uac.limit[keyLine] = newLimit; string jobType = MapKeylineToJobType(keyLine); // Update Job Type try { Helper.UserAccount.Get(accid).jobType = jobType; } catch (Exception) { } //AccountingBSL.UpdateLimit(accid, jobType, newLimit, sheetCount, paperSize); } } }
public static string MapJobModeToLimits(JOB_MODE_TYPE jobmode) { switch (jobmode.sysname) { //COPY case "JOB_MODE_COPIER": return("COPY"); //PRINT case "JOB_MODE_PRINT": case "JOB_MODE_DIRECT_PRINT_EMAIL": case "JOB_MODE_DIRECT_PRINT_WEB": case "JOB_MODE_DIRECT_PRINT_FTP": case "JOB_MODE_DIRECT_PRINT_USB": return("PRINT"); //SCAN case "JOB_MODE_SCAN_TO_DESKTOP": case "JOB_MODE_SCAN_TO_SMB": case "JOB_MODE_SCAN_TO_USB": case "JOB_MODE_SCAN_TO_HDD": case "JOB_MODE_FTP_SEND": case "JOB_MODE_E_MAIL_SEND": case "JOB_MODE_E_MAIL_FTP_SEND": //??? case "JOB_MODE_META_E_MAIL": case "JOB_MODE_META_FTP": case "JOB_MODE_META_DESKTOP": case "JOB_MODE_META_SMB": case "JOB_MODE_TWAIN_PRE_SCAN": case "JOB_MODE_TWAIN": case "JOB_MODE_RELAY_E_MAIL": return("SCANNER"); //DOC FILING case "JOB_MODE_REPRINT": return("DOC-FILING-PRINT"); //LIST-PRINT case "JOB_MODE_LIST_PRINT": return("LIST-PRINT"); //FAX-SEND case "JOB_MODE_FAX_SEND": case "JOB_MODE_FAX_SEND2": case "JOB_MODE_PC_FAX_SEND": case "JOB_MODE_PC_FAX_SEND2": case "JOB_MODE_POLLING_MODE": case "JOB_MODE_POLLING_MODE2": case "JOB_MODE_TRF_FAX": case "JOB_MODE_TRF_FAX2": case "JOB_MODE_RELAY_FAX": case "JOB_MODE_RELAY_FAX2": case "JOB_MODE_MULTI_POLLING": case "JOB_MODE_SCAN_TO_MEMBOX": return("FAX-SEND"); //FAX-SEND case "JOB_MODE_FAX_PRINT": return("FAX-PRINT"); //IFAX-SEND case "JOB_MODE_INTERNET_FAX_SEND": case "JOB_MODE_PC_I_FAX_SEND": case "JOB_MODE_TRF_I_FAX": return("I-FAX-SEND"); default: return(null); } }