Example #1
0
        ///<summary>Used from FormPayment to return the total payments for a procedure without requiring a supplied list.</summary>
        public static string GetTotForProc(long procNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), procNum));
            }
            string command = "SELECT SUM(paysplit.SplitAmt) FROM paysplit "
                             + "WHERE paysplit.ProcNum=" + POut.Long(procNum);

            return(Db.GetScalar(command));
        }
Example #2
0
        /// <summary>Returns the default storage engine.</summary>
        public static string GetDefaultEngine()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            string command       = "SELECT @@default_storage_engine";
            string defaultengine = Db.GetScalar(command).ToString();

            return(defaultengine);
        }
Example #3
0
        public static string GetCurrentDatabase()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            string    command = "SELECT database()";
            DataTable table   = Db.GetTable(command);

            return(PIn.String(table.Rows[0][0].ToString()));
        }
Example #4
0
 public static string SendProviderColor(Provider prov)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetString(MethodBase.GetCurrentMethod(), prov));
     }
     if (prov.ProvColor.ToArgb() == Color.Fuchsia.ToArgb())
     {
         return("fuchsiaOK");
     }
     return("error");
 }
Example #5
0
 public static string SendSheetParameter(SheetParameter sheetParam)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetString(MethodBase.GetCurrentMethod(), sheetParam));
     }
     if (sheetParam.ParamName == "ParamNameOK")
     {
         return("paramNameOK");
     }
     return("error");
 }
Example #6
0
 ///<summary>Returns the name of the allergy. Returns an empty string if allergyDefNum=0.</summary>
 public static string GetDescription(long allergyDefNum)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetString(MethodBase.GetCurrentMethod(), allergyDefNum));
     }
     if (allergyDefNum == 0)
     {
         return("");
     }
     return(Crud.AllergyDefCrud.SelectOne(allergyDefNum).Description);
 }
Example #7
0
 public static string SendSheetWithFields(Sheet sheet)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetString(MethodBase.GetCurrentMethod(), sheet));
     }
     if (sheet.SheetFields[0].FieldName == "FieldNameGreen")
     {
         return("fieldOK");
     }
     return("error");
 }
Example #8
0
 public static string SendSheetDefWithFieldDefs(SheetDef sheetdef)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetString(MethodBase.GetCurrentMethod(), sheetdef));
     }
     if (sheetdef.SheetFieldDefs[0].FieldName == "FieldNameTeal")
     {
         return("fielddefOK");
     }
     return("error");
 }
Example #9
0
        ///<summary>This will return "SopCode - Description" or empty string if the patient does not have a payor type entered.</summary>
        public static string GetCurrentDescription(long patNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), patNum));
            }
            PayorType payorType = GetCurrentType(patNum);

            if (payorType == null)
            {
                return("");
            }
            return(payorType.SopCode + " - " + Sops.GetDescriptionFromCode(payorType.SopCode));
        }
Example #10
0
        public static string GetPageContent(long wikiPageNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), wikiPageNum));
            }
            if (wikiPageNum < 1)
            {
                return("");
            }
            string command = "SELECT PageContent FROM wikipagehist WHERE WikiPageNum=" + POut.Long(wikiPageNum);

            return(Db.GetScalar(command));
        }
Example #11
0
        ///<summary>Gets the assembly version from the OpenDentBusiness assembly (technically the assembly of the MiscData Type) for the Middle Tier.
        ///Returns an empty string if this is not the ServerWeb or if not currently utilizing the Middle Tier (e.g. ClientWeb).</summary>
        public static string GetAssemblyVersionForMiddleTier()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            string assemblyVersion = "";

            if (RemotingClient.RemotingRole == RemotingRole.ServerWeb)
            {
                assemblyVersion = GetAssemblyVersion();
            }
            return(assemblyVersion);
        }
Example #12
0
        ///<Summary>Gets name from database for the submitter passed in.  Not very efficient.</Summary>
        public static string GetSubmitterName(long bugUserId)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), bugUserId));
            }
            string submitterName = "";

            DataAction.RunBugsHQ(() => {
                string command = "SELECT UserName FROM buguser WHERE BugUserId=" + POut.Long(bugUserId);
                submitterName  = Db.GetScalar(command);
            }, false);
            return(submitterName);
        }
Example #13
0
 public static string SendNullParam(string str)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetString(MethodBase.GetCurrentMethod(), str));
     }
     if (str == null)
     {
         return("nullOK");
     }
     else
     {
         return("null not found");
     }
 }
Example #14
0
        ///<summary>Called from FormInsPlan when user wants to view a benefit note for other subscribers on a plan.  Should never include the current subscriber that the user is editing.  This function will get one note from the database, not including blank notes.  If no note can be found, then it returns empty string.</summary>
        public static string GetBenefitNotes(long planNum, long subNumExclude)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), planNum, subNumExclude));
            }
            string    command = "SELECT BenefitNotes FROM inssub WHERE BenefitNotes != '' AND PlanNum=" + POut.Long(planNum) + " AND InsSubNum !=" + POut.Long(subNumExclude) + " " + DbHelper.LimitAnd(1);
            DataTable table   = Db.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return("");
            }
            return(PIn.String(table.Rows[0][0].ToString()));
        }
Example #15
0
        ///<summary>Used in FormUAppoint to get frequent and current data.</summary>
        public static string GetValFromDb(long programNum, string desc)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), programNum, desc));
            }
            string command = "SELECT PropertyValue FROM programproperty WHERE ProgramNum=" + POut.Long(programNum)
                             + " AND PropertyDesc='" + POut.String(desc) + "'";
            DataTable table = Db.GetTable(command);

            if (table.Rows.Count == 0)
            {
                return("");
            }
            return(table.Rows[0][0].ToString());
        }
Example #16
0
		///<summary>Returns a list of patients that are dependent on the Cur employer. The list includes carriage returns for easy display.  Used before deleting an employer to make sure employer is not in use.</summary>
		public static string DependentPatients(Employer Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetString(MethodBase.GetCurrentMethod(),Cur);
			}
			string command="SELECT CONCAT(CONCAT(LName,', '),FName) FROM patient" 
				+" WHERE EmployerNum = '"+POut.Long(Cur.EmployerNum)+"'";
			DataTable table=Db.GetTable(command);
			string retStr="";
			for(int i=0;i<table.Rows.Count;i++){
				if(i>0){
					retStr+="\r\n";//return, newline for multiple names.
				}
				retStr+=PIn.String(table.Rows[i][0].ToString());
			}
			return retStr;
		}
Example #17
0
        ///<summary>Returns a string if medication is in use in medicationpat, allergydef, eduresources, or preference.MedicationsIndicateNone. The string will explain where the medication is in use.</summary>
        public static string IsInUse(Medication med)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), med));
            }
            string[] brands;
            if (med.MedicationNum == med.GenericNum)
            {
                brands = GetBrands(med.MedicationNum);
            }
            else
            {
                brands = new string[0];
            }
            if (brands.Length > 0)
            {
                return("You can not delete a medication that has brand names attached.");
            }
            string command = "SELECT COUNT(*) FROM medicationpat WHERE MedicationNum=" + POut.Long(med.MedicationNum);

            if (PIn.Int(Db.GetCount(command)) != 0)
            {
                return("Not allowed to delete medication because it is in use by a patient");
            }
            command = "SELECT COUNT(*) FROM allergydef WHERE MedicationNum=" + POut.Long(med.MedicationNum);
            if (PIn.Int(Db.GetCount(command)) != 0)
            {
                return("Not allowed to delete medication because it is in use by an allergy");
            }
            command = "SELECT COUNT(*) FROM eduresource WHERE MedicationNum=" + POut.Long(med.MedicationNum);
            if (PIn.Int(Db.GetCount(command)) != 0)
            {
                return("Not allowed to delete medication because it is in use by an education resource");
            }
            command = "SELECT COUNT(*) FROM rxalert WHERE MedicationNum=" + POut.Long(med.MedicationNum);
            if (PIn.Int(Db.GetCount(command)) != 0)
            {
                return("Not allowed to delete medication because it is in use by an Rx alert");
            }
            //If any more tables are added here in the future, then also update GetAllInUseMedicationNums() to include the new table.
            if (PrefC.GetLong(PrefName.MedicationsIndicateNone) == med.MedicationNum)
            {
                return("Not allowed to delete medication because it is in use by a medication");
            }
            return("");
        }
Example #18
0
        public static string GetString(WebChatPrefName prefName)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), prefName));
            }
            WebChatPref pref = null;

            WebChatMisc.DbAction(delegate() {
                string command = "SELECT * FROM webchatpref WHERE PrefName='" + POut.String(prefName.ToString()) + "'";
                pref           = Crud.WebChatPrefCrud.SelectOne(command);
            });
            if (pref == null)
            {
                return("");
            }
            return(pref.ValueString);
        }
Example #19
0
        ///<summary>Returns the major and minor version of MySQL for the current connection.  Returns a version of 0.0 if the MySQL version cannot be determined.</summary>
        public static string GetMySqlVersion()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            string    command = "SELECT @@version";
            DataTable table   = Db.GetTable(command);
            string    version = PIn.String(table.Rows[0][0].ToString());

            string[] arrayVersion = version.Split('.');
            try {
                return(int.Parse(arrayVersion[0]) + "." + int.Parse(arrayVersion[1]));
            }
            catch {
            }
            return("0.0");
        }
Example #20
0
        /// <summary>Returns the number of MyISAM tables and the number of InnoDB tables in the current database.</summary>
        public static string GetEngineCount()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            string    command = @"SELECT SUM(CASE WHEN information_schema.tables.engine='MyISAM' THEN 1 ELSE 0 END) AS 'myisam',
				SUM(CASE WHEN information_schema.tables.engine='InnoDB' THEN 1 ELSE 0 END) AS 'innodb'
				FROM information_schema.tables
				WHERE table_schema=(SELECT DATABASE())"                ;
            DataTable results = Db.GetTable(command);
            string    retval  = Lans.g("FormInnoDb", "Number of MyISAM tables: ");

            retval += Lans.g("FormInnoDb", results.Rows[0]["myisam"].ToString()) + "\r\n";
            retval += Lans.g("FormInnoDb", "Number of InnoDB tables: ");
            retval += Lans.g("FormInnoDb", results.Rows[0]["innodb"].ToString()) + "\r\n";
            return(retval);
        }
Example #21
0
        ///<summary>When this is called, all WikiPage links in pageContent should be [[PageTitle]] and NOT [[WikiPageNum]],
        ///otherwise this will invalidate every wiki page link.</summary>
        public static string ConvertTitlesToPageNums(string pageContent)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), pageContent));
            }
            MatchCollection mc            = Regex.Matches(pageContent, @"\[\[.+?\]\]");//Find [[ and ]] pairs in the pageContent string.
            List <string>   listWikiLinks = new List <string>();

            foreach (Match match in mc)
            {
                string val = match.Value;
                if (!IsWikiLink(val))
                {
                    continue;
                }
                val = val.TrimStart('[').TrimEnd(']');
                listWikiLinks.Add(val);
            }
            //Getting the MIN(WikiPageNum) is safe because there will always only be 1 non-draft reference to the PageTitle.
            //This is because we reuse WikiPageNums instead of deleting and reinserting like before 17.4.
            string command = @"SELECT PageTitle,MIN(WikiPageNum) WikiPageNum FROM wikipage 
				WHERE IsDraft=0 AND PageTitle IN('"                 + string.Join("','", listWikiLinks.Select(x => POut.String(x))) + @"')
				GROUP BY PageTitle"                ;
            Dictionary <string, long> dictTitleToNum = Db.GetTable(command).Select()
                                                       .ToDictionary(x => PIn.String(x["PageTitle"].ToString()), x => PIn.Long(x["WikiPageNum"].ToString()));
            StringBuilder sbPageContent = new StringBuilder(pageContent);

            foreach (string wikiLink in listWikiLinks)
            {
                string replace;
                long   wikiPageNum;
                if (dictTitleToNum.TryGetValue(wikiLink, out wikiPageNum))
                {
                    replace = "[[" + wikiPageNum + "]]";
                }
                else
                {
                    replace = "[[0]]";                  //wiki page does not exist. replace with wikipagenum=0
                }
                sbPageContent.Replace("[[" + wikiLink + "]]", replace);
            }
            return(sbPageContent.ToString());
        }
Example #22
0
        ///<summary>Before reqneeded.Delete, this checks to make sure that req is not in use by students.  Used to prompt user.</summary>
        public static string InUseBy(long reqNeededNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), reqNeededNum));
            }
            string command = "SELECT LName,FName FROM provider,reqstudent "
                             + "WHERE provider.ProvNum=reqstudent.ProvNum "
                             + "AND reqstudent.ReqNeededNum=" + POut.Long(reqNeededNum)
                             + " AND reqstudent.DateCompleted > " + POut.Date(new DateTime(1880, 1, 1));
            DataTable table  = Db.GetTable(command);
            string    retVal = "";

            for (int i = 0; i < table.Rows.Count; i++)
            {
                retVal += table.Rows[i]["LName"].ToString() + ", " + table.Rows[i]["FName"].ToString() + "\r\n";
            }
            return(retVal);
        }
Example #23
0
        ///<summary>Returns the number of messages which have not yet been read.  If there are no unread messages, then empty string is returned.  If more than 99 messages are unread, then "99" is returned.  The count limit is 99, because only 2 digits can fit in the SMS notification text.</summary>
        public static string GetSmsNotification()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            string command        = "SELECT COUNT(*) FROM smsfrommobile WHERE SmsStatus=" + POut.Int((int)SmsFromStatus.ReceivedUnread);
            int    smsUnreadCount = PIn.Int(Db.GetCount(command));

            if (smsUnreadCount == 0)
            {
                return("");
            }
            if (smsUnreadCount > 99)
            {
                return("99");
            }
            return(smsUnreadCount.ToString());
        }
Example #24
0
        ///<summary>If the message text is X12, then it always normalizes it to include carriage returns for better readability.</summary>
        public static string GetMessageText(long etransMessageTextNum, bool isFormattingNeededX12 = true)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), etransMessageTextNum, isFormattingNeededX12));
            }
            if (etransMessageTextNum == 0)
            {
                return("");
            }
            string command = "SELECT MessageText FROM etransmessagetext WHERE EtransMessageTextNum=" + POut.Long(etransMessageTextNum);
            string msgText = Db.GetScalar(command);

            if (isFormattingNeededX12)
            {
                return(TidyMessageTextX12(msgText));
            }
            return(msgText);
        }
Example #25
0
        ///<summary>Generates an order id that is not in use by any other xwebresponses.</summary>
        public static string CreateOrderId()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            int attempts = 0;

            while (++attempts < 1000)
            {
                string orderId = MiscUtils.CreateRandomNumericString(10);
                string command = $"SELECT COUNT(*) FROM xwebresponse WHERE OrderId='{POut.String(orderId)}'";
                if (Db.GetCount(command) == "0")
                {
                    return(orderId);
                }
            }
            throw new ODException("Reached 1000 attempts of trying to generate OrderId.");
        }
Example #26
0
        ///<summary>Gets the MoreInfo column from the most recent event of the specified type. Returns blank if none exists.</summary>
        public static string GetLatestInfoByType(EhrMeasureEventType measureEventType)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), measureEventType));
            }
            string command = "SELECT * FROM ehrmeasureevent WHERE EventType=" + POut.Int((int)measureEventType)
                             + " ORDER BY DateTEvent DESC LIMIT 1";
            EhrMeasureEvent measureEvent = Crud.EhrMeasureEventCrud.SelectOne(command);

            if (measureEvent == null)
            {
                return("");
            }
            else
            {
                return(measureEvent.MoreInfo);
            }
        }
Example #27
0
		///<summary>Returns a list of insplans that are dependent on the Cur employer. The list includes carriage returns for easy display.  Used before deleting an employer to make sure employer is not in use.</summary>
		public static string DependentInsPlans(Employer Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetString(MethodBase.GetCurrentMethod(),Cur);
			}
			string command="SELECT carrier.CarrierName,CONCAT(CONCAT(patient.LName,', '),patient.FName) "
				+"FROM insplan "
				+"LEFT JOIN inssub ON insplan.PlanNum=inssub.PlanNum "
				+"LEFT JOIN patient ON inssub.Subscriber=patient.PatNum "
				+"LEFT JOIN carrier ON insplan.CarrierNum=carrier.CarrierNum "
				+"WHERE insplan.EmployerNum = "+POut.Long(Cur.EmployerNum);
			DataTable table=Db.GetTable(command);
			string retStr="";
			for(int i=0;i<table.Rows.Count;i++){
				if(i>0){
					retStr+="\r\n";//return, newline for multiple names.
				}
				retStr+=PIn.String(table.Rows[i][1].ToString())+": "+PIn.String(table.Rows[i][0].ToString());
			}
			return retStr;
		}
Example #28
0
        ///<summary>When saving an abbrev, this makes sure that the abbreviation is not already in use.
        ///This checks the current cache for duplicates.</summary>
        public static string AbbrAlreadyInUse(QuickPasteNote note)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), note));
            }
            string msgText = "";
            List <QuickPasteCat>  listQuickPasteCats = QuickPasteCats.GetDeepCopy();
            List <QuickPasteNote> listDuplicates     = GetWhere(x => note.Abbreviation == x.Abbreviation && note.QuickPasteNoteNum != x.QuickPasteNoteNum).ToList();

            if (listDuplicates.Count <= 0)
            {
                return(msgText);
            }
            msgText = Lans.g("FormQuickPasteNoteEdit", "The abbreviation")
                      + " '" + note.Abbreviation + "' " + Lans.g("FormQuickPasteNoteEdit", "is in use in the categories:") + "\r\n"
                      + String.Join(", ", listQuickPasteCats.Where(x => x.QuickPasteCatNum.In(listDuplicates.Select(z => z.QuickPasteCatNum))).Select(x => x.Description))
                      + "\r\n" + Lans.g("FormQuickPasteNoteEdit", "Do you wish to continue?");
            return(msgText);
        }
Example #29
0
        ///<summary>Gets the human readable host name of the database server, even when using the middle-tier.  This will return an empty string if Dns lookup fails.</summary>
        public static string GetODServer()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            //string command="SELECT @@hostname";//This command fails in MySQL 5.0.22 (the version of MySQL 5.0 we used to use), because the hostname variable was added in MySQL 5.0.38.
            //string rawHostName=DataConnection.GetServerName();//This could be a human readable name, or it might be "localhost" or "127.0.0.1" or another IP address.
            //return Dns.GetHostEntry(rawHostName).HostName;//Return the human readable name (full domain name) corresponding to the rawHostName.
            //Had to strip off the port, caused Dns.GetHostEntry to fail and is not needed to get the hostname
            string rawHostName = DataConnection.GetServerName().Split(':')[0];          //This could be a human readable name, or it might be "localhost" or "127.0.0.1" or another IP address.
            string retval      = "";

            try {
                retval = Dns.GetHostEntry(rawHostName).HostName;              //Return the human readable name (full domain name) corresponding to the rawHostName.
            }
            catch (Exception ex) {
            }
            return(retval);
        }
        ///<summary>Used when attempting to delete.  Returns empty string if not in use and an untranslated string if in use.</summary>
        public static string CheckInUse(long appointmentTypeNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), appointmentTypeNum));
            }
            string command = "SELECT COUNT(*) FROM appointment WHERE AppointmentTypeNum = " + POut.Long(appointmentTypeNum);

            if (PIn.Int(Db.GetCount(command)) > 0)
            {
                return("Not allowed to delete appointment types that are in use on an appointment.");
            }
            command = "SELECT COUNT(*) FROM deflink "
                      + "WHERE LinkType = " + POut.Int((int)DefLinkType.AppointmentType) + " "
                      + "AND FKey = " + POut.Long(appointmentTypeNum) + " ";
            if (PIn.Int(Db.GetCount(command)) > 0)
            {
                //This message will need to change in the future if more definition categories utilize appointment types with the deflink table.
                return("Not allowed to delete appointment types that are in use by Web Sched New Pat Appt Types definitions.");
            }
            return("");
        }