///<summary>this code is similar to code in the phone tracking server. But here, we frequently only change clockStatus and ColorBar by setting employeeNum=-1. If employeeNum is not -1, then EmployeeName also gets set. If employeeNum==0, then clears employee from that row.</summary> public static void SetPhoneStatus(ClockStatusEnum clockStatus, int extens, long employeeNum = -1) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), clockStatus, extens, employeeNum); return; } string command = @"SELECT phoneempdefault.EmployeeNum,phoneempdefault.IsTriageOperator,Description,phoneempdefault.EmpName,HasColor,phone.ClockStatus " + "FROM phone " + "LEFT JOIN phoneempdefault ON phone.Extension=phoneempdefault.PhoneExt " + "WHERE phone.Extension=" + POut.Long(extens); DataTable tablePhone = Db.GetTable(command); if (tablePhone.Rows.Count == 0) { //It would be nice if we could create a phone row for this extension. return; } long empNum = PIn.Long(tablePhone.Rows[0]["EmployeeNum"].ToString()); bool isTriageOperator = PIn.Bool(tablePhone.Rows[0]["IsTriageOperator"].ToString()); string empName = PIn.String(tablePhone.Rows[0]["EmpName"].ToString()); string clockStatusDb = PIn.String(tablePhone.Rows[0]["ClockStatus"].ToString()); Employee emp = Employees.GetEmp(employeeNum); if (emp != null) //A new employee is going to take over this extension. { empName = emp.FName; empNum = emp.EmployeeNum; } else if (employeeNum == 0) //Clear the employee from that row. { empName = ""; empNum = 0; } //if these values are null because of missing phoneempdefault row, they will default to false //PhoneEmpStatusOverride statusOverride=(PhoneEmpStatusOverride)PIn.Int(tablePhone.Rows[0]["StatusOverride"].ToString()); bool hasColor = PIn.Bool(tablePhone.Rows[0]["HasColor"].ToString()); #region DateTimeStart //When a user shows up as a color on the phone panel, we want a timer to be constantly going to show how long they've been off the phone. string dateTimeStart = ""; //It's possible that a new user has never clocked in before, therefore their clockStatus will be empty. Simply set it to the status that they are trying to go to. if (clockStatusDb == "") { clockStatusDb = clockStatus.ToString(); } if (clockStatus == ClockStatusEnum.Break || clockStatus == ClockStatusEnum.Lunch) { //The user is going on Lunch or Break. Start the DateTimeStart counter so we know how long they have been gone. dateTimeStart = "DateTimeStart=NOW(), "; } else if (clockStatus == ClockStatusEnum.Home) { //User is going Home. Always clear the DateTimeStart column no matter what. dateTimeStart = "DateTimeStart='0001-01-01', "; } else //User shows as a color on big phones and is not going to a status of Home, Lunch, or Break. Example: Available, Training etc. //Get the current clock status from the database. { ClockStatusEnum clockStatusCur = (ClockStatusEnum)Enum.Parse(typeof(ClockStatusEnum), clockStatusDb); //Start the clock if the user is going from a break status to any other non-break status. if (clockStatusCur == ClockStatusEnum.Home || clockStatusCur == ClockStatusEnum.Lunch || clockStatusCur == ClockStatusEnum.Break) { //The user is clocking in from home, lunch, or break. Start the timer up. if (hasColor) //Only start up the timer when someone with color clocks in. { dateTimeStart = "DateTimeStart=NOW(), "; } else //Someone with no color then reset the timer. They are back from break, that's all we need to know. { dateTimeStart = "DateTimeStart='0001-01-01', "; } } } string dateTimeNeedsHelpStart; if (clockStatus == ClockStatusEnum.NeedsHelp) { dateTimeNeedsHelpStart = "DateTimeNeedsHelpStart=NOW(), "; } else { dateTimeNeedsHelpStart = "DateTimeNeedsHelpStart=" + POut.DateT(DateTime.MinValue) + ", "; } #endregion //Update the phone row to reflect the new clock status of the user. string clockStatusNew = clockStatus.ToString(); if (clockStatus == ClockStatusEnum.None) { clockStatusNew = ""; } if (clockStatus == ClockStatusEnum.HelpOnTheWay && clockStatusDb == ClockStatusEnum.HelpOnTheWay.ToString()) //If HelpOnTheWay already { clockStatusNew = ClockStatusEnum.Available.ToString(); } command = "UPDATE phone SET ClockStatus='" + POut.String(clockStatusNew) + "', " + dateTimeStart + dateTimeNeedsHelpStart //+"ColorBar=-1, " //ColorBar is now determined at runtime by OD using Phones.GetPhoneColor. + "EmployeeNum=" + POut.Long(empNum) + ", " + "EmployeeName='" + POut.String(empName) + "' " + "WHERE Extension=" + extens; Db.NonQ(command); //Zero out any duplicate phone table rows for this employee. //This is possible if a user logged off and another employee logs into their computer. This would cause duplicate entries in the big phones window. UpdatePhoneToEmpty(employeeNum, extens); }
///<summary>If ClientWeb, then this method is instead run on the server, and the result passed back to the client. And since it's ClientWeb, FillCache will be run on the client.</summary> public static DataSet GetCacheDs(string itypesStr) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetDS(MethodBase.GetCurrentMethod(), itypesStr)); } //so this part below only happens if direct or server------------------------------------------------ List <int> itypes = new List <int>(); string[] strArray = itypesStr.Split(','); for (int i = 0; i < strArray.Length; i++) { itypes.Add(PIn.Int(strArray[i])); } bool isAll = false; if (itypes.Contains((int)InvalidType.AllLocal)) { isAll = true; } DataSet ds = new DataSet(); if (itypes.Contains((int)InvalidType.AccountingAutoPays) || isAll) { ds.Tables.Add(AccountingAutoPays.RefreshCache()); } if (itypes.Contains((int)InvalidType.AutoCodes) || isAll) { ds.Tables.Add(AutoCodes.RefreshCache()); ds.Tables.Add(AutoCodeItems.RefreshCache()); ds.Tables.Add(AutoCodeConds.RefreshCache()); } if (itypes.Contains((int)InvalidType.Automation) || isAll) { ds.Tables.Add(Automations.RefreshCache()); } if (itypes.Contains((int)InvalidType.AutoNotes) || isAll) { ds.Tables.Add(AutoNotes.RefreshCache()); ds.Tables.Add(AutoNoteControls.RefreshCache()); } if (itypes.Contains((int)InvalidType.Carriers) || isAll) { ds.Tables.Add(Carriers.RefreshCache()); //run on startup, after telephone reformat, after list edit. } if (itypes.Contains((int)InvalidType.ClaimForms) || isAll) { ds.Tables.Add(ClaimFormItems.RefreshCache()); ds.Tables.Add(ClaimForms.RefreshCache()); } if (itypes.Contains((int)InvalidType.ClearHouses) || isAll) { ds.Tables.Add(Clearinghouses.RefreshCache()); //kh wants to add an EasyHideClearHouses to disable this } if (itypes.Contains((int)InvalidType.Computers) || isAll) { ds.Tables.Add(Computers.RefreshCache()); ds.Tables.Add(Printers.RefreshCache()); } if (itypes.Contains((int)InvalidType.Defs) || isAll) { ds.Tables.Add(Defs.RefreshCache()); } if (itypes.Contains((int)InvalidType.DentalSchools) || isAll) { ds.Tables.Add(SchoolClasses.RefreshCache()); ds.Tables.Add(SchoolCourses.RefreshCache()); } if (itypes.Contains((int)InvalidType.DictCustoms) || isAll) { ds.Tables.Add(DictCustoms.RefreshCache()); } if (itypes.Contains((int)InvalidType.Diseases) || isAll) { ds.Tables.Add(DiseaseDefs.RefreshCache()); ds.Tables.Add(ICD9s.RefreshCache()); } if (itypes.Contains((int)InvalidType.DisplayFields) || isAll) { ds.Tables.Add(DisplayFields.RefreshCache()); } if (itypes.Contains((int)InvalidType.ElectIDs) || isAll) { ds.Tables.Add(ElectIDs.RefreshCache()); } if (itypes.Contains((int)InvalidType.Email) || isAll) { ds.Tables.Add(EmailAddresses.RefreshCache()); ds.Tables.Add(EmailTemplates.RefreshCache()); } if (itypes.Contains((int)InvalidType.Employees) || isAll) { ds.Tables.Add(Employees.RefreshCache()); ds.Tables.Add(PayPeriods.RefreshCache()); } if (itypes.Contains((int)InvalidType.Employers) || isAll) { ds.Tables.Add(Employers.RefreshCache()); } if (itypes.Contains((int)InvalidType.Fees) || isAll) { ds.Tables.Add(Fees.RefreshCache()); } if (itypes.Contains((int)InvalidType.FeeScheds) || isAll) { ds.Tables.Add(FeeScheds.RefreshCache()); } if (itypes.Contains((int)InvalidType.HL7Defs) || isAll) { ds.Tables.Add(HL7Defs.RefreshCache()); ds.Tables.Add(HL7DefMessages.RefreshCache()); ds.Tables.Add(HL7DefSegments.RefreshCache()); ds.Tables.Add(HL7DefFields.RefreshCache()); } if (itypes.Contains((int)InvalidType.InsCats) || isAll) { ds.Tables.Add(CovCats.RefreshCache()); ds.Tables.Add(CovSpans.RefreshCache()); } if (itypes.Contains((int)InvalidType.InsFilingCodes) || isAll) { ds.Tables.Add(InsFilingCodes.RefreshCache()); ds.Tables.Add(InsFilingCodeSubtypes.RefreshCache()); } if (itypes.Contains((int)InvalidType.Languages) || isAll) { if (CultureInfo.CurrentCulture.Name != "en-US") { ds.Tables.Add(Lans.RefreshCache()); } } if (itypes.Contains((int)InvalidType.Letters) || isAll) { ds.Tables.Add(Letters.RefreshCache()); } if (itypes.Contains((int)InvalidType.LetterMerge) || isAll) { ds.Tables.Add(LetterMergeFields.RefreshCache()); ds.Tables.Add(LetterMerges.RefreshCache()); } if (itypes.Contains((int)InvalidType.Operatories) || isAll) { ds.Tables.Add(Operatories.RefreshCache()); } if (itypes.Contains((int)InvalidType.PatFields) || isAll) { ds.Tables.Add(PatFieldDefs.RefreshCache()); ds.Tables.Add(ApptFieldDefs.RefreshCache()); } if (itypes.Contains((int)InvalidType.Pharmacies) || isAll) { ds.Tables.Add(Pharmacies.RefreshCache()); } if (itypes.Contains((int)InvalidType.Prefs) || isAll) { ds.Tables.Add(Prefs.RefreshCache()); } if (itypes.Contains((int)InvalidType.ProcButtons) || isAll) { ds.Tables.Add(ProcButtons.RefreshCache()); ds.Tables.Add(ProcButtonItems.RefreshCache()); } if (itypes.Contains((int)InvalidType.ProcCodes) || isAll) { ds.Tables.Add(ProcedureCodes.RefreshCache()); ds.Tables.Add(ProcCodeNotes.RefreshCache()); } if (itypes.Contains((int)InvalidType.Programs) || isAll) { ds.Tables.Add(Programs.RefreshCache()); ds.Tables.Add(ProgramProperties.RefreshCache()); } if (itypes.Contains((int)InvalidType.ProviderIdents) || isAll) { ds.Tables.Add(ProviderIdents.RefreshCache()); } if (itypes.Contains((int)InvalidType.Providers) || isAll) { ds.Tables.Add(Providers.RefreshCache()); } if (itypes.Contains((int)InvalidType.QuickPaste) || isAll) { ds.Tables.Add(QuickPasteNotes.RefreshCache()); ds.Tables.Add(QuickPasteCats.RefreshCache()); } if (itypes.Contains((int)InvalidType.RecallTypes) || isAll) { ds.Tables.Add(RecallTypes.RefreshCache()); ds.Tables.Add(RecallTriggers.RefreshCache()); } if (itypes.Contains((int)InvalidType.ReplicationServers) || isAll) { ds.Tables.Add(ReplicationServers.RefreshCache()); } if (itypes.Contains((int)InvalidType.Security) || isAll) { ds.Tables.Add(Userods.RefreshCache()); ds.Tables.Add(UserGroups.RefreshCache()); } if (itypes.Contains((int)InvalidType.Sheets) || isAll) { ds.Tables.Add(SheetDefs.RefreshCache()); ds.Tables.Add(SheetFieldDefs.RefreshCache()); } if (itypes.Contains((int)InvalidType.Signals) || isAll) { ds.Tables.Add(SigElementDefs.RefreshCache()); ds.Tables.Add(SigButDefs.RefreshCache()); //includes SigButDefElements.Refresh() } if (itypes.Contains((int)InvalidType.Sites) || isAll) { ds.Tables.Add(Sites.RefreshCache()); } if (itypes.Contains((int)InvalidType.Sops) || isAll) { ds.Tables.Add(Sops.RefreshCache()); } //InvalidTypes.Tasks not handled here. if (itypes.Contains((int)InvalidType.TimeCardRules) || isAll) { ds.Tables.Add(TimeCardRules.RefreshCache()); } if (itypes.Contains((int)InvalidType.ToolBut) || isAll) { ds.Tables.Add(ToolButItems.RefreshCache()); } if (itypes.Contains((int)InvalidType.Vaccines) || isAll) { ds.Tables.Add(VaccineDefs.RefreshCache()); ds.Tables.Add(DrugManufacturers.RefreshCache()); ds.Tables.Add(DrugUnits.RefreshCache()); } if (itypes.Contains((int)InvalidType.Views) || isAll) { ds.Tables.Add(ApptViews.RefreshCache()); ds.Tables.Add(ApptViewItems.RefreshCache()); ds.Tables.Add(AppointmentRules.RefreshCache()); ds.Tables.Add(ProcApptColors.RefreshCache()); } if (itypes.Contains((int)InvalidType.Wiki) || isAll) { ds.Tables.Add(WikiListHeaderWidths.RefreshCache()); ds.Tables.Add(WikiPages.RefreshCache()); } if (itypes.Contains((int)InvalidType.ZipCodes) || isAll) { ds.Tables.Add(ZipCodes.RefreshCache()); } return(ds); }
protected override void FillCacheIfNeeded() { Employees.GetTableFromCache(false); }
///<summary>only if ClientWeb</summary> public static void FillCache(DataSet ds, string itypesStr) { List <int> itypes = new List <int>(); string[] strArray = itypesStr.Split(','); for (int i = 0; i < strArray.Length; i++) { itypes.Add(PIn.Int(strArray[i])); } bool isAll = false; if (itypes.Contains((int)InvalidType.AllLocal)) { isAll = true; } if (itypes.Contains((int)InvalidType.AccountingAutoPays) || isAll) { AccountingAutoPays.FillCache(ds.Tables["AccountingAutoPay"]); } if (itypes.Contains((int)InvalidType.AutoCodes) || isAll) { AutoCodes.FillCache(ds.Tables["AutoCode"]); AutoCodeItems.FillCache(ds.Tables["AutoCodeItem"]); AutoCodeConds.FillCache(ds.Tables["AutoCodeCond"]); } if (itypes.Contains((int)InvalidType.Automation) || isAll) { Automations.FillCache(ds.Tables["Automation"]); } if (itypes.Contains((int)InvalidType.AutoNotes) || isAll) { AutoNotes.FillCache(ds.Tables["AutoNote"]); AutoNoteControls.FillCache(ds.Tables["AutoNoteControl"]); } if (itypes.Contains((int)InvalidType.Carriers) || isAll) { Carriers.FillCache(ds.Tables["Carrier"]); //run on startup, after telephone reformat, after list edit. } if (itypes.Contains((int)InvalidType.ClaimForms) || isAll) { ClaimFormItems.FillCache(ds.Tables["ClaimFormItem"]); ClaimForms.FillCache(ds.Tables["ClaimForm"]); } if (itypes.Contains((int)InvalidType.ClearHouses) || isAll) { Clearinghouses.FillCache(ds.Tables["Clearinghouse"]); //kh wants to add an EasyHideClearHouses to disable this } if (itypes.Contains((int)InvalidType.Computers) || isAll) { Computers.FillCache(ds.Tables["Computer"]); Printers.FillCache(ds.Tables["Printer"]); } if (itypes.Contains((int)InvalidType.Defs) || isAll) { Defs.FillCache(ds.Tables["Def"]); } if (itypes.Contains((int)InvalidType.DentalSchools) || isAll) { SchoolClasses.FillCache(ds.Tables["SchoolClass"]); SchoolCourses.FillCache(ds.Tables["SchoolCourse"]); } if (itypes.Contains((int)InvalidType.DictCustoms) || isAll) { DictCustoms.FillCache(ds.Tables["DictCustom"]); } if (itypes.Contains((int)InvalidType.Diseases) || isAll) { DiseaseDefs.FillCache(ds.Tables["DiseaseDef"]); ICD9s.FillCache(ds.Tables["ICD9"]); } if (itypes.Contains((int)InvalidType.DisplayFields) || isAll) { DisplayFields.FillCache(ds.Tables["DisplayField"]); } if (itypes.Contains((int)InvalidType.ElectIDs) || isAll) { ElectIDs.FillCache(ds.Tables["ElectID"]); } if (itypes.Contains((int)InvalidType.Email) || isAll) { EmailAddresses.FillCache(ds.Tables["EmailAddress"]); EmailTemplates.FillCache(ds.Tables["EmailTemplate"]); } if (itypes.Contains((int)InvalidType.Employees) || isAll) { Employees.FillCache(ds.Tables["Employee"]); PayPeriods.FillCache(ds.Tables["PayPeriod"]); } if (itypes.Contains((int)InvalidType.Employers) || isAll) { Employers.FillCache(ds.Tables["Employer"]); } if (itypes.Contains((int)InvalidType.Fees) || isAll) { Fees.FillCache(ds.Tables["Fee"]); } if (itypes.Contains((int)InvalidType.FeeScheds) || isAll) { FeeScheds.FillCache(ds.Tables["FeeSched"]); } if (itypes.Contains((int)InvalidType.HL7Defs) || isAll) { HL7Defs.FillCache(ds.Tables["HL7Def"]); HL7DefMessages.FillCache(ds.Tables["HL7DefMessage"]); HL7DefSegments.FillCache(ds.Tables["HL7DefSegment"]); HL7DefFields.FillCache(ds.Tables["HL7DefField"]); } if (itypes.Contains((int)InvalidType.InsCats) || isAll) { CovCats.FillCache(ds.Tables["CovCat"]); CovSpans.FillCache(ds.Tables["CovSpan"]); } if (itypes.Contains((int)InvalidType.InsFilingCodes) || isAll) { InsFilingCodes.FillCache(ds.Tables["InsFilingCode"]); InsFilingCodeSubtypes.FillCache(ds.Tables["InsFilingCodeSubtype"]); } if (itypes.Contains((int)InvalidType.Languages) || isAll) { Lans.FillCache(ds.Tables["Language"]); } if (itypes.Contains((int)InvalidType.Letters) || isAll) { Letters.FillCache(ds.Tables["Letter"]); } if (itypes.Contains((int)InvalidType.LetterMerge) || isAll) { LetterMergeFields.FillCache(ds.Tables["LetterMergeField"]); LetterMerges.FillCache(ds.Tables["LetterMerge"]); } if (itypes.Contains((int)InvalidType.Operatories) || isAll) { Operatories.FillCache(ds.Tables["Operatory"]); } if (itypes.Contains((int)InvalidType.PatFields) || isAll) { PatFieldDefs.FillCache(ds.Tables["PatFieldDef"]); ApptFieldDefs.FillCache(ds.Tables["ApptFieldDef"]); } if (itypes.Contains((int)InvalidType.Pharmacies) || isAll) { Pharmacies.FillCache(ds.Tables["Pharmacy"]); } if (itypes.Contains((int)InvalidType.Prefs) || isAll) { Prefs.FillCache(ds.Tables["Pref"]); } if (itypes.Contains((int)InvalidType.ProcButtons) || isAll) { ProcButtons.FillCache(ds.Tables["ProcButton"]); ProcButtonItems.FillCache(ds.Tables["ProcButtonItem"]); } if (itypes.Contains((int)InvalidType.ProcCodes) || isAll) { ProcedureCodes.FillCache(ds.Tables["ProcedureCode"]); ProcCodeNotes.FillCache(ds.Tables["ProcCodeNote"]); } if (itypes.Contains((int)InvalidType.Programs) || isAll) { Programs.FillCache(ds.Tables["Program"]); ProgramProperties.FillCache(ds.Tables["ProgramProperty"]); } if (itypes.Contains((int)InvalidType.ProviderIdents) || isAll) { ProviderIdents.FillCache(ds.Tables["ProviderIdent"]); } if (itypes.Contains((int)InvalidType.Providers) || isAll) { Providers.FillCache(ds.Tables["Provider"]); } if (itypes.Contains((int)InvalidType.QuickPaste) || isAll) { QuickPasteNotes.FillCache(ds.Tables["QuickPasteNote"]); QuickPasteCats.FillCache(ds.Tables["QuickPasteCat"]); } if (itypes.Contains((int)InvalidType.RecallTypes) || isAll) { RecallTypes.FillCache(ds.Tables["RecallType"]); RecallTriggers.FillCache(ds.Tables["RecallTrigger"]); } if (itypes.Contains((int)InvalidType.ReplicationServers) || isAll) { ReplicationServers.FillCache(ds.Tables["ReplicationServer"]); } if (itypes.Contains((int)InvalidType.Security) || isAll) { Userods.FillCache(ds.Tables["Userod"]); UserGroups.FillCache(ds.Tables["UserGroup"]); } if (itypes.Contains((int)InvalidType.Sheets) || isAll) { SheetDefs.FillCache(ds.Tables["SheetDef"]); SheetFieldDefs.FillCache(ds.Tables["SheetFieldDef"]); } if (itypes.Contains((int)InvalidType.Signals) || isAll) { SigElementDefs.FillCache(ds.Tables["SigElementDef"]); SigButDefs.FillCache(ds.Tables["SigButDef"]); //includes SigButDefElements.Refresh() } if (itypes.Contains((int)InvalidType.Sites) || isAll) { Sites.FillCache(ds.Tables["Site"]); } if (itypes.Contains((int)InvalidType.Sops) || isAll) { Sops.FillCache(ds.Tables["Sop"]); } if (itypes.Contains((int)InvalidType.TimeCardRules) || isAll) { TimeCardRules.FillCache(ds.Tables["TimeCardRule"]); } //InvalidTypes.Tasks not handled here. if (itypes.Contains((int)InvalidType.ToolBut) || isAll) { ToolButItems.FillCache(ds.Tables["ToolButItem"]); } if (itypes.Contains((int)InvalidType.Vaccines) || isAll) { VaccineDefs.FillCache(ds.Tables["VaccineDef"]); DrugManufacturers.FillCache(ds.Tables["DrugManufacturer"]); DrugUnits.FillCache(ds.Tables["DrugUnit"]); } if (itypes.Contains((int)InvalidType.Views) || isAll) { ApptViews.FillCache(ds.Tables["ApptView"]); ApptViewItems.FillCache(ds.Tables["ApptViewItem"]); AppointmentRules.FillCache(ds.Tables["AppointmentRule"]); ProcApptColors.FillCache(ds.Tables["ProcApptColor"]); } if (itypes.Contains((int)InvalidType.Wiki) || isAll) { WikiListHeaderWidths.FillCache(ds.Tables["WikiListHeaderWidth"]); WikiPages.FillCache(ds.Tables["WikiPage"]); } if (itypes.Contains((int)InvalidType.ZipCodes) || isAll) { ZipCodes.FillCache(ds.Tables["ZipCode"]); } }