///<summary>Used to link SmsFromMobiles to the patients that they came from. Returns list of patnum,garantorNum combos.</summary> public static List <long[]> FindPatNums(string phonePat, string countryCode, List <long> listClinicNums = null) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <long[]> >(MethodBase.GetCurrentMethod(), phonePat, countryCode, listClinicNums)); } List <long[]> retVal = new List <long[]>(); try { string phoneRegexp = ConvertPhoneToRegexp(phonePat, countryCode); //DO NOT POut THESE PHONE NUMBERS. They have been cleaned for use in this function by dirtyPhoneHelper. string command = "SELECT PatNum, Guarantor FROM patient WHERE " + "PatStatus NOT IN (" + POut.Int((int)PatientStatus.Archived) + "," + POut.Int((int)PatientStatus.Deleted) + ") " + "AND (" + DbHelper.Regexp("HmPhone", phoneRegexp) + " " + "OR " + DbHelper.Regexp("WkPhone", phoneRegexp) + " " + "OR " + DbHelper.Regexp("WirelessPhone", phoneRegexp) + ")"; if (listClinicNums != null && listClinicNums.Count > 0) { command += " AND ClinicNum IN(" + string.Join(",", listClinicNums) + ")"; } DataTable table = Db.GetTable(command); foreach (DataRow row in table.Rows) { retVal.Add(new long[] { PIn.Long(row["PatNum"].ToString()), PIn.Long(row["Guarantor"].ToString()) }); } } catch { //should only happen if phone number is blank, if so, return empty list below. } return(retVal); }
///<summary>Gets all Supplies, ordered by category and itemOrder. Optionally hides those marked IsHidden. FindText must only include alphanumeric characters.</summary> public static List <Supply> CreateObjects(bool includeHidden, long supplierNum, string findText) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <Supply> >(MethodBase.GetCurrentMethod(), includeHidden, supplierNum, findText)); } string command = "SELECT supply.* FROM supply,definition " + "WHERE definition.DefNum=supply.Category " + "AND supply.SupplierNum=" + POut.Long(supplierNum) + " "; if (findText != "") { command += "AND (" + DbHelper.Regexp("supply.CatalogNumber", POut.String(findText)) + " OR " + DbHelper.Regexp("supply.Descript", POut.String(findText)) + ") "; } if (!includeHidden) { command += "AND supply.IsHidden=0 "; } command += "ORDER BY definition.ItemOrder,supply.ItemOrder"; return(Crud.SupplyCrud.SelectMany(command)); }