public static WebChatSession GetActiveSessionsForEmployee(string techName) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <WebChatSession>(MethodBase.GetCurrentMethod(), techName)); } WebChatSession webChatSession = null; WebChatMisc.DbAction(() => { string command = "SELECT * FROM webchatsession WHERE DateTend < " + POut.DateT(new DateTime(1880, 1, 1)) + " AND webchatsession.TechName = '" + POut.String(techName) + "'" + " ORDER BY webchatsession.DateTcreated "; webChatSession = Crud.WebChatSessionCrud.SelectOne(command); }); return(webChatSession); }
public static List <long> GetChangedSinceAllergyNums(DateTime changedSince) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <long> >(MethodBase.GetCurrentMethod(), changedSince)); } string command = "SELECT AllergyNum FROM allergy WHERE DateTStamp > " + POut.DateT(changedSince); DataTable dt = Db.GetTable(command); List <long> allergynums = new List <long>(dt.Rows.Count); for (int i = 0; i < dt.Rows.Count; i++) { allergynums.Add(PIn.Long(dt.Rows[i]["AllergyNum"].ToString())); } return(allergynums); }
///<summary>Gets a list of charges for the passed in fkey and link type (i.e. adjustment, procedure...)</summary> public static List <PayPlanCharge> GetForLinkTypeAndFKeys(PayPlanLinkType linkType, params long[] arrayFKeys) { if (arrayFKeys.IsNullOrEmpty()) { return(new List <PayPlanCharge>()); } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <PayPlanCharge> >(MethodBase.GetCurrentMethod(), linkType, arrayFKeys)); } string command = $"SELECT * FROM payplancharge " + $"WHERE payplancharge.FKey IN({string.Join(",",arrayFKeys.Select(x => POut.Long(x)))}) " + $"AND payplancharge.LinkType={POut.Int((int)linkType)}"; return(Crud.PayPlanChargeCrud.SelectMany(command)); }
///<summary>Returns a list of just the codes for use in the codesystem import tool.</summary> public static List <string> GetAllCodes() { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <string> >(MethodBase.GetCurrentMethod())); } List <string> retVal = new List <string>(); string command = "SELECT RxCui FROM rxnorm"; //will return some duplicates due to the nature of the data in the table. This is acceptable. DataTable table = DataCore.GetTable(command); for (int i = 0; i < table.Rows.Count; i++) { retVal.Add(table.Rows[i].ItemArray[0].ToString()); } return(retVal); }
public static List <JobReview> GetReviewsForJobs(params long[] arrayJobNums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <JobReview> >(MethodBase.GetCurrentMethod(), arrayJobNums)); } if (arrayJobNums == null || arrayJobNums.Length == 0) { return(new List <JobReview>()); } string command = "SELECT * FROM jobreview WHERE JobNum IN (" + string.Join(",", arrayJobNums) + ") " + "AND ReviewStatus!='" + POut.String(JobReviewStatus.TimeLog.ToString()) + "' " + "ORDER BY DateTStamp"; return(Crud.JobReviewCrud.SelectMany(command)); }
///<summary>Get one TerminalActive from the db with ComputerName, SessionId, and ProcessId. ComputerName is case-insensitive. ///Will return null if not found.</summary> public static TerminalActive GetForCmptrSessionAndId(string computerName, int sessionId, int processId = 0) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <TerminalActive>(MethodBase.GetCurrentMethod(), computerName, sessionId, processId)); } string command = "SELECT * FROM terminalactive " + "WHERE ComputerName='" + POut.String(computerName) + "' " + "AND SessionId=" + POut.Int(sessionId); if (processId > 0) { command += " AND ProcessId=" + POut.Int(processId); } return(Crud.TerminalActiveCrud.SelectOne(command)); }
public static double GetValAmountTotal(long claimNum, string valCode) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <double>(MethodBase.GetCurrentMethod(), claimNum, valCode)); } //double total = 0; string command = "SELECT SUM(ValAmount) FROM claimvalcodelog WHERE ClaimNum=" + POut.Long(claimNum) + " AND ValCode='" + POut.String(valCode) + "'"; return(PIn.Double(Db.GetScalar(command))); //DataTable table=Db.GetTable(command); //for(int i=0;i<table.Rows.Count;i++){ // total+=PIn.Double(table.Rows[i][4].ToString()); //} //return total; }
///<summary>Gets all logs with the passed-in FKey of the specified LogType. ///Only returns logs that occurred before the passed-in log. ///Called from GetChangedLogs and, between the two methods, recursively retrieves logs linked to the logs that are returned from this method.</summary> private static List <InsEditLog> GetLinkedLogs(long FKey, InsEditLogType logType, InsEditLog logCur, List <InsEditLog> listLogs) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <InsEditLog> >(MethodBase.GetCurrentMethod(), FKey, logType, logCur, listLogs)); } string command = "SELECT * FROM inseditlog " + "WHERE FKey = " + POut.Long(FKey) + " " + "AND LogType = " + POut.Int((int)logType) + " " + "AND DateTStamp < " + POut.DateT(logCur.DateTStamp) + " " + "AND InsEditLogNum NOT IN( " + string.Join(",", listLogs.Select(x => POut.Long(x.InsEditLogNum)).ToList()) + ")"; List <InsEditLog> listLinkedLogs = Crud.InsEditLogCrud.SelectMany(command); GetChangedLogs(listLinkedLogs); return(listLinkedLogs); }
public static List <string> GetAllLists() { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <string> >(MethodBase.GetCurrentMethod())); } List <string> retVal = new List <string>(); string command = "SHOW TABLES LIKE 'wikilist\\_%'"; //must escape _ (underscore) otherwise it is interpreted as a wildcard character. DataTable Table = Db.GetTable(command); foreach (DataRow row in Table.Rows) { retVal.Add(row[0].ToString()); } return(retVal); }
public static List <ClaimPayment> GetByClaimPaymentNums(List <long> listClaimPaymentNums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <ClaimPayment> >(MethodBase.GetCurrentMethod(), listClaimPaymentNums)); } if (listClaimPaymentNums.Count == 0) { return(new List <ClaimPayment>()); } string command = "SELECT * " + "FROM claimpayment " + "WHERE ClaimPaymentNum IN(" + string.Join(",", listClaimPaymentNums.Select(x => POut.Long(x))) + ")"; return(Crud.ClaimPaymentCrud.SelectMany(command)); }
public static List <Adjustment> GetForProcs(List <long> listProcNums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Adjustment> >(MethodBase.GetCurrentMethod(), listProcNums)); } List <Adjustment> listAdjustments = new List <Adjustment>(); if (listProcNums == null || listProcNums.Count < 1) { return(listAdjustments); } string command = "SELECT * FROM adjustment WHERE ProcNum IN(" + string.Join(",", listProcNums) + ")"; return(Crud.AdjustmentCrud.SelectMany(command)); }
//Retotals all items attached to order and updates AmountTotal. public static SupplyOrder UpdateOrderPrice(long orderNum) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <SupplyOrder>(MethodBase.GetCurrentMethod(), orderNum)); } string command = "SELECT SUM(Qty*Price) FROM supplyorderitem WHERE SupplyOrderNum=" + orderNum; double amountTotal = PIn.Double(Db.GetScalar(command)); command = "SELECT * FROM supplyorder WHERE SupplyOrderNum=" + orderNum; SupplyOrder so = Crud.SupplyOrderCrud.SelectOne(command); so.AmountTotal = amountTotal; SupplyOrders.Update(so); return(so); }
///<summary></summary> public static string[] GetListCat() { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <string[]>(MethodBase.GetCurrentMethod())); } string command = "SELECT Distinct ClassType FROM language ORDER BY ClassType "; DataTable table = Db.GetTable(command); string[] ListCat = new string[table.Rows.Count]; for (int i = 0; i < table.Rows.Count; i++) { ListCat[i] = PIn.String(table.Rows[i][0].ToString()); } return(ListCat); }
///<summary>Gets all logs with the passed-in FKey of the specified LogType. ///Only returns logs that occurred before the passed-in log. ///Called from GetChangedLogs and, between the two methods, recursively retrieves logs linked to the logs that are returned from this method.</summary> private static List <InsEditLog> GetLinkedLogs(long FKey, InsEditLogType logType, InsEditLog logCur, bool isRecursive) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <InsEditLog> >(MethodBase.GetCurrentMethod(), FKey, logType, logCur, isRecursive)); } string command = "SELECT * FROM inseditlog " + "WHERE FKey = " + POut.Long(FKey) + " " + "AND LogType = " + POut.Int((int)logType) + " " + "AND DateTStamp < " + POut.DateT(logCur.DateTStamp) + " " + "AND InsEditLogNum != " + POut.Long(logCur.InsEditLogNum); List <InsEditLog> listLogs = Crud.InsEditLogCrud.SelectMany(command); GetChangedLogs(listLogs); return(listLogs); }
///<summary>Used in FormLabCaseEdit to view an existing lab slip. Will return null if none exist.</summary> public static Sheet GetLabSlip(long patNum, long labCaseNum) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <Sheet>(MethodBase.GetCurrentMethod(), patNum, labCaseNum)); } string command = "SELECT sheet.* FROM sheet,sheetfield " + "WHERE sheet.SheetNum=sheetfield.SheetNum" + " AND sheet.PatNum=" + POut.Long(patNum) + " AND sheet.SheetType=" + POut.Long((int)SheetTypeEnum.LabSlip) + " AND sheetfield.FieldType=" + POut.Long((int)SheetFieldType.Parameter) + " AND sheetfield.FieldName='LabCaseNum' " + "AND sheetfield.FieldValue='" + POut.Long(labCaseNum) + "'"; return(Crud.SheetCrud.SelectOne(command)); }
///<summary></summary> public static List <Claim> GetClaimsByCheck(long claimPaymentNum) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Claim> >(MethodBase.GetCurrentMethod(), claimPaymentNum)); } string command = "SELECT * " + "FROM claim " + "WHERE claim.ClaimNum IN " + "(SELECT DISTINCT claimproc.ClaimNum " + "FROM claimproc " + "WHERE claimproc.ClaimPaymentNum=" + claimPaymentNum + ")"; return(ClaimCrud.SelectMany(command)); }
///<summary>Returns the original prepayment.</summary> public static PaySplit GetOriginalPrepayment(PaySplit paySplit) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <PaySplit>(MethodBase.GetCurrentMethod(), paySplit)); } long fSplitNum = paySplit.FSplitNum; if (paySplit.UnearnedType == 0) //paySplit is pos allocation split, find negative income transfer split first { fSplitNum = Db.GetLong("SELECT FSplitNum FROM paysplit WHERE paysplit.SplitNum=" + POut.Long(paySplit.FSplitNum)); } string command = "SELECT * FROM paysplit WHERE paysplit.SplitNum=" + POut.Long(fSplitNum); return(Crud.PaySplitCrud.SelectOne(command)); }
///<summary>Returns the time of the oldest task within the Triage task list. Returns 0 if there is no tasks in the list.</summary> public static DateTime GetTriageTime() { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <DateTime>(MethodBase.GetCurrentMethod())); } string command = "SELECT GREATEST(IFNULL(task.DateTimeEntry,'0001-01-01'), IFNULL((SELECT MAX(DateTimeNote) FROM tasknote WHERE tasknote.tasknum=task.tasknum),'0001-01-01')) AS triageTime " + "FROM task " + "WHERE TaskListNum=1697 " //Triage task list. + "AND TaskStatus<>2 " //Not done (new or viewed). + "AND TaskNum NOT IN (SELECT TaskNum FROM tasknote) " //Not waiting a call back. + "AND PriorityDefNum IN(502,501) " //Blue and Red tasks only. + "LIMIT 1"; return(PIn.DateT(Db.GetScalar(command))); }
///<summary>Returns a list of just the codes for use in update or insert logic.</summary> public static List <string> GetAllCodes() { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <string> >(MethodBase.GetCurrentMethod())); } List <string> retVal = new List <string>(); string command = "SELECT icd9code FROM icd9"; DataTable table = DataCore.GetTable(command); for (int i = 0; i < table.Rows.Count; i++) { retVal.Add(table.Rows[i].ItemArray[0].ToString()); } return(retVal); }
///<summary>Returns all keys in the given years.</summary> public static List <EhrQuarterlyKey> GetAllKeys(DateTime startDate, DateTime endDate) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <EhrQuarterlyKey> >(MethodBase.GetCurrentMethod(), startDate, endDate)); } int startYear = startDate.Year - 2000; int endYear = endDate.Year - 2000; string command; command = "SELECT * FROM ehrquarterlykey WHERE (YearValue BETWEEN " + startYear + " " + "AND " + endYear + ") " + "AND PatNum=0 ORDER BY YearValue,QuarterValue"; List <EhrQuarterlyKey> ehrKeys = Crud.EhrQuarterlyKeyCrud.SelectMany(command); return(ehrKeys); }
///<summary>There can be multiple PatPlans returned for a single InsSubNum.</summary> public static List <PatPlan> GetListByInsSubNums(List <long> listInsSubNums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <PatPlan> >(MethodBase.GetCurrentMethod(), listInsSubNums)); } List <PatPlan> listPatPlans = new List <PatPlan>(); if (listInsSubNums == null || listInsSubNums.Count < 1) { return(listPatPlans); } string command = "SELECT * FROM patplan WHERE InsSubNum IN(" + string.Join(",", listInsSubNums) + ")"; return(Crud.PatPlanCrud.SelectMany(command)); }
public static InvalidType[] SendEnumParamsWithArgs(bool argBool, string argString, params InvalidType[] arrayITypes) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <InvalidType[]>(MethodBase.GetCurrentMethod(), argBool, argString, arrayITypes)); } if (!argBool) { throw new ArgumentException("Invalid boolean value. Required to be set to true.", "argBool"); } if (argString != DirtyString) { throw new ArgumentException("Invalid string value. Required to be equal to DirtyString.", "argString"); } return(arrayITypes); }
///<summary>Gets the installment plans for these families. If there are none for a family, the guarantor will not be present in the dictionary. ///</summary> ///<returns>Dictionary where the key is the guarantor num and the value is the installment plan for the family.</returns> public static SerializableDictionary <long, InstallmentPlan> GetForFams(List <long> listGuarNums) { if (listGuarNums.Count == 0) { return(new SerializableDictionary <long, InstallmentPlan>()); } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <SerializableDictionary <long, InstallmentPlan> >(MethodBase.GetCurrentMethod(), listGuarNums)); } string command = "SELECT * FROM installmentplan WHERE PatNum IN(" + string.Join(",", listGuarNums.Select(x => POut.Long(x))) + ") "; return(Crud.InstallmentPlanCrud.SelectMany(command) .GroupBy(x => x.PatNum) .ToSerializableDictionary(x => x.Key, y => y.First())); //Only returning one installment plan per family. }
public static List <Schedule> SendObjectParamsWithArgs(bool argBool, string argString, params Schedule[] arraySchedules) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Schedule> >(MethodBase.GetCurrentMethod(), argBool, argString, arraySchedules)); } if (!argBool) { throw new ArgumentException("Invalid boolean value. Required to be set to true.", "argBool"); } if (argString != DirtyString) { throw new ArgumentException("Invalid string value. Required to be equal to DirtyString.", "argString"); } return(arraySchedules.ToList()); }
///<summary>Gets the current date/Time direcly from the server. Mostly used to prevent uesr from altering the workstation date to bypass security.</summary> public static DateTime GetNowDateTime() { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <DateTime>(MethodBase.GetCurrentMethod())); } string command = "SELECT NOW()"; if (DataConnection.DBtype == DatabaseType.Oracle) { command = "SELECT CURRENT_TIMESTAMP FROM DUAL"; } DataTable table = Db.GetTable(command); return(PIn.DateT(table.Rows[0][0].ToString())); }
public static List <Task> GetListTasksSpecialChars(List <Task> listTasks) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Task> >(MethodBase.GetCurrentMethod(), listTasks)); } List <Task> retVal = listTasks.Select(x => x.Copy()).ToList(); retVal.Add(new Task { ParentDesc = NewLineString, DateTask = DateTodayTest, DateTimeEntry = DateTEntryTest, TaskStatus = TaskStatusEnum.Done }); return(retVal); }
///<summary>If a commlog exists with today's date for the current user and has no stop time, then that commlog is returned so it can be reopened. Otherwise, return null.</summary> public static Commlog GetIncompleteEntry(long userNum, long patNum) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <Commlog>(MethodBase.GetCurrentMethod(), userNum, patNum)); } //no need for Oracle compatibility string command = "SELECT * FROM commlog WHERE DATE(CommDateTime)=CURDATE() " + "AND UserNum=" + POut.Long(userNum) + " " + "AND PatNum=" + POut.Long(patNum) + " " + "AND (CommType=292 OR CommType=441) " //support call or chat, DefNums + "AND Mode_=" + POut.Int((int)CommItemMode.Phone) + " " //mode=phone + "AND DateTimeEnd < '1880-01-01' LIMIT 1"; return(Crud.CommlogCrud.SelectOne(command)); }
///<summary>Used in FormRefAttachEdit to show all referral slips for the patient/referral combo. Usually 0 or 1 results.</summary> public static List <Sheet> GetReferralSlips(long patNum, long referralNum) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Sheet> >(MethodBase.GetCurrentMethod(), patNum, referralNum)); } string command = "SELECT * FROM sheet WHERE PatNum=" + POut.Long(patNum) + " AND EXISTS(SELECT * FROM sheetfield " + "WHERE sheet.SheetNum=sheetfield.SheetNum " + "AND sheetfield.FieldType=" + POut.Long((int)SheetFieldType.Parameter) + " AND sheetfield.FieldName='ReferralNum' " + "AND sheetfield.FieldValue='" + POut.Long(referralNum) + "')" + " ORDER BY DateTimeSheet"; return(Crud.SheetCrud.SelectMany(command)); }
///<summary>Overload gets fees that exactly match criteria with a clinic list.</summary> public static List <Fee> GetListExact(long feeSched, List <long> listClinicNums, long provNum) { if (listClinicNums.IsNullOrEmpty()) { return(new List <Fee>()); } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Fee> >(MethodBase.GetCurrentMethod(), feeSched, listClinicNums, provNum)); } string command = "SELECT * FROM fee WHERE " + "FeeSched=" + POut.Long(feeSched) + " AND ClinicNum IN (" + string.Join(",", listClinicNums.Select(x => POut.Long(x))) + ") AND ProvNum=" + POut.Long(provNum); return(Crud.FeeCrud.SelectMany(command)); }
///<summary>Gets all the AllergyDefs for the given patient, including those linked to an Allergy such that StatisIsActive!=0 if ///includeInactive==true. If an Allergy linked to this patNum is linked to a missing AllergyDef, this missing AllergyDef is ignored.</summary> public static List <AllergyDef> GetAllergyDefs(long patNum, bool includeInactive) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <AllergyDef> >(MethodBase.GetCurrentMethod(), patNum, includeInactive)); } string command = @"SELECT allergydef.* FROM allergydef INNER JOIN allergy ON allergy.AllergyDefNum=allergydef.AllergyDefNum WHERE allergy.PatNum=" + POut.Long(patNum) + " "; if (!includeInactive) { command += "AND allergy.StatusIsActive!=0"; } return(Crud.AllergyDefCrud.TableToList(Db.GetTable(command))); }