Ejemplo n.º 1
0
        ///<summary>Gets a list of all future appointments for a given Operatory.  Ordered by dateTime</summary>
        public static bool HasFutureApts(long operatoryNum, params ApptStatus[] arrayIgnoreStatuses)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod(), operatoryNum, arrayIgnoreStatuses));
            }
            string command = "SELECT COUNT(*) FROM appointment "
                             + "WHERE Op = " + POut.Long(operatoryNum) + " ";

            if (arrayIgnoreStatuses.Length > 0)
            {
                command += "AND AptStatus NOT IN (";
                for (int i = 0; i < arrayIgnoreStatuses.Length; i++)
                {
                    if (i > 0)
                    {
                        command += ",";
                    }
                    command += POut.Int((int)arrayIgnoreStatuses[i]);
                }
                command += ") ";
            }
            command += "AND AptDateTime > " + DbHelper.Now();
            return(PIn.Int(Db.GetScalar(command)) > 0);
        }
Ejemplo n.º 2
0
        ///<Summary>Gets name from database.  Not very efficient.</Summary>
        public static string GetSubmitterName(long submitter)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), submitter));
            }
            //Create an ODThread so that we can safely change the database connection settings without affecting the calling method's connection.
            ODThread odThread = new ODThread(new ODThread.WorkerDelegate((ODThread o) => {
                //Always set the thread static database connection variables to set the serviceshq db conn.
#if DEBUG
                new DataConnection().SetDbT("localhost", "bugs", "root", "", "", "", DatabaseType.MySql, true);
#else
                new DataConnection().SetDbT("server", "bugs", "root", "", "", "", DatabaseType.MySql, true);
#endif
                string command = "SELECT UserName FROM buguser WHERE BugUserId=" + submitter;
                o.Tag          = Db.GetScalar(command);
            }));

            odThread.AddExceptionHandler(new ODThread.ExceptionDelegate((Exception e) => { }));            //Do nothing
            odThread.Name = "bugsGetSubmitterNameThread";
            odThread.Start(true);
            if (!odThread.Join(THREAD_TIMEOUT))
            {
                return("");
            }
            return(odThread.Tag.ToString());
        }
Ejemplo n.º 3
0
		///<summary>Gets a pref of type bool without using the cache.</summary>
		public static bool GetBoolNoCache(PrefName prefName) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetBool(MethodBase.GetCurrentMethod(),prefName);
			}
			string command="SELECT ValueString FROM preference WHERE PrefName = '"+POut.String(prefName.ToString())+"'";
			return PIn.Bool(Db.GetScalar(command));
		}
Ejemplo n.º 4
0
        ///<summary>Generates a unique 3 char alphanumeric serialnumber.  Checks to make sure it's not already in use.</summary>
        public static string GenerateSerialNum()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod()));
            }
            string retVal      = "";
            bool   isDuplicate = true;
            Random rand        = new Random();

            while (isDuplicate)
            {
                retVal = "";
                for (int i = 0; i < 4; i++)
                {
                    int r = rand.Next(0, 34);
                    if (r < 9)
                    {
                        retVal += (char)('1' + r);                    //1-9, no zero
                    }
                    else
                    {
                        retVal += (char)('A' + r - 9);
                    }
                }
                string command = "SELECT COUNT(*) FROM equipment WHERE SerialNumber = '" + POut.String(retVal) + "'";
                if (Db.GetScalar(command) == "0")
                {
                    isDuplicate = false;
                }
            }
            return(retVal);
        }
Ejemplo n.º 5
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)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), etransMessageTextNum));
            }
            if (etransMessageTextNum == 0)
            {
                return("");
            }
            string command = "SELECT MessageText FROM etransmessagetext WHERE EtransMessageTextNum=" + POut.Long(etransMessageTextNum);
            string msgText = Db.GetScalar(command);

            if (!X12object.IsX12(msgText))
            {
                return(msgText);
            }
            Match match = Regex.Match(msgText, "~[^(\n)(\r)]");

            while (match.Success)
            {
                msgText = msgText.Substring(0, match.Index) + "~\r\n" + msgText.Substring(match.Index + 1);
                match   = Regex.Match(msgText, "~[^(\n)(\r)]");
            }
            return(msgText);
            //MatchCollection matches=Regex.Matches(msgText,"~[^(\n)(\r)]");
            //for(int i=0;i<matches.Count;i++) {
            //Regex.
            //	matches[i].
            //}
            //msgText=Regex.Replace(msgText,"~[^(\r\n)(\n)(\r)]","~\r\n");
        }
Ejemplo n.º 6
0
        ///<summary>Gets the current date/Time with milliseconds directly from server.  In Mysql we must query the server until the second rolls over, which may take up to one second.  Used to confirm synchronization in time for EHR.</summary>
        public static DateTime GetNowDateTimeWithMilli()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <DateTime>(MethodBase.GetCurrentMethod()));
            }
            string command;
            string dbtime;

            if (DataConnection.DBtype == DatabaseType.MySql)
            {
                command = "SELECT NOW()";               //Only up to 1 second precision pre-Mysql 5.6.4.  Does not round milliseconds.
                dbtime  = Db.GetScalar(command);
                int secondInit = PIn.DateT(dbtime).Second;
                int secondCur;
                //Continue querying server for current time until second changes (milliseconds will be close to 0)
                do
                {
                    dbtime    = Db.GetScalar(command);
                    secondCur = PIn.DateT(dbtime).Second;
                }while(secondInit == secondCur);
            }
            else
            {
                command = "SELECT CURRENT_TIMESTAMP(3) FROM DUAL";               //Timestamp with milliseconds
                dbtime  = Db.GetScalar(command);
            }
            return(PIn.DateT(dbtime));
        }
Ejemplo n.º 7
0
        /// <summary>Returns the default storage engine.</summary>
        public static string GetDefaultEngine()
        {
            string command       = "SELECT @@default_storage_engine";
            string defaultengine = Db.GetScalar(command).ToString();

            return(defaultengine);
        }
Ejemplo n.º 8
0
        ///<summary>Inserts item at corresponding itemOrder. If item order is out of range, item will be placed at beginning or end of category.</summary>
        public static long Insert(Supply supp, int itemOrder)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                supp.SupplyNum = Meth.GetLong(MethodBase.GetCurrentMethod(), supp, itemOrder);
                return(supp.SupplyNum);
            }
            string command = "";

            if (itemOrder < 0)
            {
                itemOrder = 0;
            }
            else
            {
                command = "SELECT MAX(ItemOrder) FROM supply WHERE Category=" + POut.Long(supp.Category);
                int itemOrderMax = PIn.Int(Db.GetScalar(command));
                if (itemOrder > itemOrderMax)
                {
                    itemOrder = itemOrderMax + 1;
                }
            }
            //Set new item order.
            supp.ItemOrder = itemOrder;
            //move other items
            command = "UPDATE supply SET ItemOrder=(ItemOrder+1) WHERE Category=" + POut.Long(supp.Category) + " AND ItemOrder>=" + POut.Int(supp.ItemOrder);
            Db.NonQ(command);
            //insert and return new supply
            return(Crud.SupplyCrud.Insert(supp));
        }
Ejemplo n.º 9
0
        ///<summary>Checks the database to see if the reseller has customers with active repeating charges.</summary>
        public static bool HasActiveResellerCustomers(Reseller reseller)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod(), reseller));
            }
            string command = @"SELECT COUNT(*) FROM patient
				INNER JOIN registrationkey ON patient.PatNum=registrationkey.PatNum AND IsResellerCustomer=1
				INNER JOIN repeatcharge ON patient.PatNum=repeatcharge.PatNum
				INNER JOIN procedurecode ON repeatcharge.ProcCode=procedurecode.ProcCode
				INNER JOIN resellerservice ON procedurecode.CodeNum=resellerservice.CodeNum 
				WHERE resellerservice.ResellerNum="                 + POut.Long(reseller.ResellerNum) + " "
                             + "AND (patient.Guarantor=" + POut.Long(reseller.PatNum) + " OR patient.SuperFamily=" + POut.Long(reseller.PatNum) + ") "
                             + "AND ("
                             + "(DATE(repeatcharge.DateStart)<=DATE(NOW()) "
                             + "AND "
                             + "((YEAR(repeatcharge.DateStop)<1880) OR (DATE(NOW()<DATE(repeatcharge.DateStop)))))"
                             + ") "
                             + "GROUP BY patient.PatNum";

            if (PIn.Int(Db.GetScalar(command)) > 0)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 10
0
        ///<summary>Returns current clinic limit minus message usage for current calendar month.</summary>
        public static double GetClinicBalance(long clinicNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetDouble(MethodBase.GetCurrentMethod(), clinicNum));
            }
            double limit = 0;

            if (!PrefC.HasClinicsEnabled)
            {
                if (PrefC.GetDate(PrefName.SmsContractDate).Year > 1880)
                {
                    limit = PrefC.GetDouble(PrefName.SmsMonthlyLimit);
                }
            }
            else
            {
                if (clinicNum == 0 && Clinics.GetCount(true) > 0)               //Sending text for "Unassigned" patient.  Use the first non-hidden clinic. (for now)
                {
                    clinicNum = Clinics.GetFirst(true).ClinicNum;
                }
                Clinic clinicCur = Clinics.GetClinic(clinicNum);
                if (clinicCur != null && clinicCur.SmsContractDate.Year > 1880)
                {
                    limit = clinicCur.SmsMonthlyLimit;
                }
            }
            DateTime dtStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
            DateTime dtEnd   = dtStart.AddMonths(1);
            string   command = "SELECT SUM(MsgChargeUSD) FROM smstomobile WHERE ClinicNum=" + POut.Long(clinicNum) + " "
                               + "AND DateTimeSent>=" + POut.Date(dtStart) + " AND DateTimeSent<" + POut.Date(dtEnd);

            limit -= PIn.Double(Db.GetScalar(command));
            return(limit);
        }
Ejemplo n.º 11
0
        public static bool IsInnodbAvail()
        {
            string command  = "SELECT @@have_innodb";
            string innoDbOn = Db.GetScalar(command).ToString();

            return(innoDbOn == "YES");
        }
Ejemplo n.º 12
0
        /// <summary>Will throw an exception if this InsSub is being used anywhere. Set strict true to test against every check.</summary>
        public static void ValidateNoKeys(long subNum, bool strict)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), subNum, strict);
                return;
            }
            string command = "SELECT 1 FROM claim WHERE InsSubNum=" + POut.Long(subNum) + " OR InsSubNum2=" + POut.Long(subNum) + " " + DbHelper.LimitAnd(1);

            if (!string.IsNullOrEmpty(Db.GetScalar(command)))
            {
                throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing claims and so the subscriber cannot be deleted."));
            }
            if (strict)
            {
                command = "SELECT 1 FROM claimproc WHERE InsSubNum=" + POut.Long(subNum) + " AND Status!=" + POut.Int((int)ClaimProcStatus.Estimate) + " " + DbHelper.LimitAnd(1);    //ignore estimates
                if (!string.IsNullOrEmpty(Db.GetScalar(command)))
                {
                    throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing claim procedures and so the subscriber cannot be deleted."));
                }
            }
            command = "SELECT 1 FROM etrans WHERE InsSubNum=" + POut.Long(subNum) + " " + DbHelper.LimitAnd(1);
            if (!string.IsNullOrEmpty(Db.GetScalar(command)))
            {
                throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing etrans entry and so the subscriber cannot be deleted."));
            }
            command = "SELECT 1 FROM payplan WHERE InsSubNum=" + POut.Long(subNum) + " " + DbHelper.LimitAnd(1);
            if (!string.IsNullOrEmpty(Db.GetScalar(command)))
            {
                throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing insurance linked payment plans and so the subscriber cannot be deleted."));
            }
        }
Ejemplo n.º 13
0
        ///<summary>The only allowed parameters are "InnoDB" or "MyISAM".  Converts tables to toEngine type and returns the number of tables converted.</summary>
        public static int ConvertTables(string fromEngine, string toEngine)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetInt(MethodBase.GetCurrentMethod(), fromEngine, toEngine));
            }
            int    numtables = 0;
            string command   = "SELECT DATABASE()";
            string database  = Db.GetScalar(command);

            command = @"SELECT table_name
				FROM information_schema.tables
				WHERE table_schema='"                 + POut.String(database) + "' AND information_schema.tables.engine='" + fromEngine + "'";
            DataTable results = Db.GetTable(command);

            command = "";
            if (results.Rows.Count == 0)
            {
                return(numtables);
            }
            for (int i = 0; i < results.Rows.Count; i++)
            {
                command += "ALTER TABLE `" + database + "`.`" + results.Rows[i]["table_name"].ToString() + "` ENGINE='" + toEngine + "'; ";
                numtables++;
            }
            Db.NonQ(command);
            return(numtables);
        }
Ejemplo n.º 14
0
 public static bool IsInnodbAvail()
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetBool(MethodBase.GetCurrentMethod()));
     }
     try {
         string command  = "SELECT @@have_innodb";
         string innoDbOn = Db.GetScalar(command).ToString();
         return(innoDbOn == "YES");
     }
     catch (Exception ex) {           //MySQL 5.6 and higher
         ex.DoNothing();
         string    command = "SHOW ENGINES";
         DataTable table   = Db.GetTable(command);
         foreach (DataRow row in table.Rows)
         {
             if (row["Engine"].ToString().ToLower() == "innodb" &&
                 row["Support"].ToString().ToLower().In("yes", "default"))
             {
                 return(true);
             }
         }
         return(false);
     }
 }
Ejemplo n.º 15
0
        ///<summary>Helper method to determine if an index already exists with the given name.  Returns true if indexName matches the INDEX_NAME of any
        ///index in the table.  This will always return false for Oracle.</summary>
        public static bool IndexNameExists(string tableName, string indexName)
        {
            if (DataConnection.DBtype == DatabaseType.Oracle)           //Oracle will not allow the same column to be indexed more than once
            {
                return(false);
            }
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod(), tableName, indexName));
            }
            string command = "SELECT COUNT(DISTINCT INDEX_NAME) "
                             + "FROM INFORMATION_SCHEMA.STATISTICS "
                             + "WHERE TABLE_SCHEMA=SCHEMA() "
                             + "AND LOWER(TABLE_NAME)='" + POut.String(tableName.ToLower()) + "' "
                             + "AND LOWER(INDEX_NAME)='" + POut.String(indexName.ToLower()) + "'";

            try {
                if (Db.GetScalar(command) == "0")
                {
                    return(false);
                }
            }
            catch (Exception ex) {
                ex.DoNothing();
                return(false);               //might happen if user does not have permission to query information schema tables.
            }
            return(true);
        }
Ejemplo n.º 16
0
 ///<summary>Will throw an exception if server cannot validate username and password.
 ///configPath will be empty from a workstation and filled from the server.  If Ecw, odpass will actually be the hash.</summary>
 public static Userod LogInWeb(string oduser, string odpass, string configPath, string clientVersionStr, bool usingEcw)
 {
     //Unusual remoting role check designed for first time logging in via middle tier.
     if (RemotingClient.RemotingRole == RemotingRole.ServerWeb)
     {
         Userod user = Userods.CheckUserAndPassword(oduser, odpass, usingEcw);
         if (string.IsNullOrEmpty(odpass))                 //All middle tier connections must pass in a password.
         {
             throw new Exception("Invalid username or password.");
         }
         string command          = "SELECT ValueString FROM preference WHERE PrefName='ProgramVersion'";
         string dbVersionStr     = Db.GetScalar(command);
         string serverVersionStr = Assembly.GetAssembly(typeof(Db)).GetName().Version.ToString(4);
                         #if DEBUG
         if (Assembly.GetAssembly(typeof(Db)).GetName().Version.Build == 0)
         {
             command      = "SELECT ValueString FROM preference WHERE PrefName='DataBaseVersion'";                     //Using this during debug in the head makes it open fast with less fiddling.
             dbVersionStr = Db.GetScalar(command);
         }
                         #endif
         if (dbVersionStr != serverVersionStr)
         {
             throw new Exception("Version mismatch.  Server:" + serverVersionStr + "  Database:" + dbVersionStr);
         }
         if (!string.IsNullOrEmpty(clientVersionStr))
         {
             Version clientVersion = new Version(clientVersionStr);
             Version serverVersion = new Version(serverVersionStr);
             if (clientVersion > serverVersion)
             {
                 throw new Exception("Version mismatch.  Client:" + clientVersionStr + "  Server:" + serverVersionStr);
             }
         }
         //if clientVersion == serverVersion, than we need do nothing.
         //if clientVersion < serverVersion, than an update will later be triggered.
         //Security.CurUser=user;//we're on the server, so this is meaningless
         return(user);
         //return 0;//meaningless
     }
     else
     {
         //Because RemotingRole has not been set, and because CurUser has not been set,
         //this particular method is more verbose than most and does not use Meth.
         //It's not a good example of the standard way of doing things.
         DtoGetObject dto = new DtoGetObject();
         dto.Credentials          = new Credentials();
         dto.Credentials.Username = oduser;
         dto.Credentials.Password = odpass;              //Userods.EncryptPassword(password);
         dto.ComputerName         = Security.CurComputerName;
         dto.MethodName           = "OpenDentBusiness.Security.LogInWeb";
         dto.ObjectType           = typeof(Userod).FullName;
         object[] parameters = new object[] { oduser, odpass, configPath, clientVersionStr, usingEcw };
         dto.Params = DtoObject.ConstructArray(MethodBase.GetCurrentMethod(), parameters);
         //Purposefully throws exceptions.
         //If hasConnectionLost was set to true then the user would be stuck in an infinite loop of trying to connect to a potentially invalid Middle Tier URI.
         //Therefore, set hasConnectionLost false so that the user gets an error message immediately in the event that Middle Tier cannot be reached.
         return(RemotingClient.ProcessGetObject <Userod>(dto, false));
     }
 }
Ejemplo n.º 17
0
        /// <summary>Will throw an exception if this InsSub is being used anywhere. Set strict true to test against every check.</summary>
        public static void ValidateNoKeys(long subNum, bool strict)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), subNum, strict);
                return;
            }
            string command;
            string result;

            //claim.InsSubNum/2
            command = "SELECT COUNT(*) FROM claim WHERE InsSubNum = " + POut.Long(subNum);
            result  = Db.GetScalar(command);
            if (result != "0")
            {
                throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing claims."));
            }
            command = "SELECT COUNT(*) FROM claim WHERE InsSubNum2 = " + POut.Long(subNum);
            result  = Db.GetScalar(command);
            if (result != "0")
            {
                throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing claims."));
            }
            //claimproc.InsSubNum
            if (strict)
            {
                command = "SELECT COUNT(*) FROM claimproc WHERE InsSubNum = " + POut.Long(subNum);
                result  = Db.GetScalar(command);
                if (result != "0")
                {
                    throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing claimprocs."));
                }
            }
            //etrans.InsSubNum
            command = "SELECT COUNT(*) FROM etrans WHERE InsSubNum = " + POut.Long(subNum);
            result  = Db.GetScalar(command);
            if (result != "0")
            {
                throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing etrans entry."));
            }
            //patplan.InsSubNum
            if (strict)
            {
                command = "SELECT COUNT(*) FROM patplan WHERE InsSubNum = " + POut.Long(subNum);
                result  = Db.GetScalar(command);
                if (result != "0")
                {
                    throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing patplan entry."));
                }
            }
            //payplan.InsSubNum
            command = "SELECT COUNT(*) FROM payplan WHERE InsSubNum = " + POut.Long(subNum);
            result  = Db.GetScalar(command);
            if (result != "0")
            {
                throw new ApplicationException(Lans.g("FormInsPlan", "Subscriber has existing payplans."));
            }
        }
Ejemplo n.º 18
0
        ///<summary>Checks the database to see if the patient is a reseller.</summary>
        public static bool IsResellerFamily(long guarantor)
        {
            string command = "SELECT COUNT(*) FROM reseller WHERE PatNum=" + POut.Long(guarantor);

            if (PIn.Int(Db.GetScalar(command)) > 0)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 19
0
        ///<summary>Used when saving a page to check and fix the capitalization on each internal link. So the returned pagetitle might have different capitalization than the supplied pagetitle</summary>
        public static string GetTitle(string pageTitle)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), pageTitle));
            }
            string command = "SELECT PageTitle FROM wikipage WHERE PageTitle = '" + POut.String(pageTitle) + "'";

            return(Db.GetScalar(command));
        }
Ejemplo n.º 20
0
        ///<summary></summary>
        public static byte GetBiggestShowInTerminal(long patNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <byte>(MethodBase.GetCurrentMethod(), patNum));
            }
            string command = "SELECT MAX(ShowInTerminal) FROM sheet WHERE IsDeleted=0 AND PatNum=" + POut.Long(patNum);

            return(PIn.Byte(Db.GetScalar(command)));
        }
Ejemplo n.º 21
0
        ///<summary>Returns the number of patients associated with the passed-in medicationNum.</summary>
        public static long CountPats(long medNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetLong(MethodBase.GetCurrentMethod(), medNum));
            }
            string command = "SELECT COUNT(DISTINCT medicationpat.PatNum) FROM medicationpat WHERE MedicationNum=" + POut.Long(medNum);

            return(PIn.Long(Db.GetScalar(command)));
        }
Ejemplo n.º 22
0
        ///<summary>True if the ehrprovkey table has any rows, otherwise false.</summary>
        public static bool HasEhrKeys()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod()));
            }
            string command = "SELECT COUNT(*) FROM ehrprovkey";

            return(PIn.Bool(Db.GetScalar(command)));
        }
Ejemplo n.º 23
0
        ///<summary>Used to return the multum code based on RxCui.  If blank, use the Description instead.</summary>
        public static string GetMmslCodeByRxCui(string rxCui)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), rxCui));
            }
            string command = "SELECT MmslCode FROM rxnorm WHERE MmslCode!='' AND RxCui=" + rxCui;

            return(Db.GetScalar(command));
        }
Ejemplo n.º 24
0
        public static bool ValidateJobNum(long jobNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod(), jobNum));
            }
            string command = "SELECT COUNT(*) FROM job WHERE JobNum=" + POut.Long(jobNum);

            return(Db.GetScalar(command) != "0");
        }
Ejemplo n.º 25
0
		/// <summary>Or Canadian elig.</summary>
		public static DateTime GetLastDate270(long planNum) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetObject<DateTime>(MethodBase.GetCurrentMethod(),planNum);
			}
			string command="SELECT MAX(DateTimeTrans) FROM etrans "
				+"WHERE (Etype="+POut.Int((int)EtransType.BenefitInquiry270)+" "
				+"OR Etype="+POut.Int((int)EtransType.Eligibility_CA)+") "
				+" AND PlanNum="+POut.Long(planNum);
			return PIn.Date(Db.GetScalar(command));
		}
Ejemplo n.º 26
0
        ///<summary>Gets the FeeNum from the database, returns 0 if none found.</summary>
        public static long GetFeeNum(long codeNum, long feeSchedNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetLong(MethodBase.GetCurrentMethod(), codeNum, feeSchedNum));
            }
            string command = "SELECT FeeNum FROM fee WHERE CodeNum=" + POut.Long(codeNum) + " AND FeeSched=" + POut.Long(feeSchedNum);

            return(PIn.Long(Db.GetScalar(command)));
        }
Ejemplo n.º 27
0
        ///<summary>Checks the database to see if the user name is already in use.</summary>
        public static bool IsUserNameInUse(long patNum, string userName)
        {
            string command = "SELECT COUNT(*) FROM reseller WHERE PatNum!=" + POut.Long(patNum) + " AND UserName='******'";

            if (PIn.Int(Db.GetScalar(command)) > 0)
            {
                return(true);               //User name in use.
            }
            return(false);
        }
Ejemplo n.º 28
0
        ///<summary></summary>
        public static string GetDescByRxCui(string rxCui)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetString(MethodBase.GetCurrentMethod(), rxCui));
            }
            string command = "SELECT Description FROM rxnorm WHERE MmslCode='' AND RxCui='" + rxCui + "'";

            return(Db.GetScalar(command));
        }
Ejemplo n.º 29
0
        ///<summary>Will return 0 if not anyone's inbox.</summary>
        public static long GetMailboxUserNum(long taskListNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetLong(MethodBase.GetCurrentMethod(), taskListNum));
            }
            string command = "SELECT UserNum FROM userod WHERE TaskListInBox=" + POut.Long(taskListNum);

            return(PIn.Long(Db.GetScalar(command)));
        }
Ejemplo n.º 30
0
        ///<summary>Returns true if there are any duplicate field names in the entire apptfielddef table.</summary>
        public static bool HasDuplicateFieldNames()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod()));
            }
            string command = "SELECT COUNT(*) FROM apptfielddef GROUP BY FieldName HAVING COUNT(FieldName) > 1";

            return(Db.GetScalar(command) != "");
        }