Пример #1
0
 ///<summary>Inserts one OrionProc into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(OrionProc orionProc,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         orionProc.OrionProcNum=ReplicationServers.GetKey("orionproc","OrionProcNum");
     }
     string command="INSERT INTO orionproc (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="OrionProcNum,";
     }
     command+="ProcNum,DPC,DPCpost,DateScheduleBy,DateStopClock,Status2,IsOnCall,IsEffectiveComm,IsRepair) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(orionProc.OrionProcNum)+",";
     }
     command+=
              POut.Long  (orionProc.ProcNum)+","
         +    POut.Int   ((int)orionProc.DPC)+","
         +    POut.Int   ((int)orionProc.DPCpost)+","
         +    POut.Date  (orionProc.DateScheduleBy)+","
         +    POut.Date  (orionProc.DateStopClock)+","
         +    POut.Int   ((int)orionProc.Status2)+","
         +    POut.Bool  (orionProc.IsOnCall)+","
         +    POut.Bool  (orionProc.IsEffectiveComm)+","
         +    POut.Bool  (orionProc.IsRepair)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         orionProc.OrionProcNum=Db.NonQ(command,true);
     }
     return orionProc.OrionProcNum;
 }
Пример #2
0
 ///<summary>Inserts one OrionProc into the database.  Returns the new priKey.</summary>
 public static long Insert(OrionProc orionProc)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         orionProc.OrionProcNum = DbHelper.GetNextOracleKey("orionproc", "OrionProcNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(orionProc, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     orionProc.OrionProcNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(orionProc, false));
     }
 }
Пример #3
0
 ///<summary>Inserts one OrionProc into the database.  Returns the new priKey.</summary>
 internal static long Insert(OrionProc orionProc)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         orionProc.OrionProcNum=DbHelper.GetNextOracleKey("orionproc","OrionProcNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(orionProc,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     orionProc.OrionProcNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(orionProc,false);
     }
 }
Пример #4
0
 ///<summary>Inserts one OrionProc into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(OrionProc orionProc)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(orionProc, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             orionProc.OrionProcNum = DbHelper.GetNextOracleKey("orionproc", "OrionProcNum");                  //Cacheless method
         }
         return(InsertNoCache(orionProc, true));
     }
 }
Пример #5
0
        ///<summary>Updates one OrionProc in the database.</summary>
        public static void Update(OrionProc orionProc)
        {
            string command = "UPDATE orionproc SET "
                             + "ProcNum        =  " + POut.Long(orionProc.ProcNum) + ", "
                             + "DPC            =  " + POut.Int((int)orionProc.DPC) + ", "
                             + "DPCpost        =  " + POut.Int((int)orionProc.DPCpost) + ", "
                             + "DateScheduleBy =  " + POut.Date(orionProc.DateScheduleBy) + ", "
                             + "DateStopClock  =  " + POut.Date(orionProc.DateStopClock) + ", "
                             + "Status2        =  " + POut.Int((int)orionProc.Status2) + ", "
                             + "IsOnCall       =  " + POut.Bool(orionProc.IsOnCall) + ", "
                             + "IsEffectiveComm=  " + POut.Bool(orionProc.IsEffectiveComm) + ", "
                             + "IsRepair       =  " + POut.Bool(orionProc.IsRepair) + " "
                             + "WHERE OrionProcNum = " + POut.Long(orionProc.OrionProcNum);

            Db.NonQ(command);
        }
Пример #6
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<OrionProc> TableToList(DataTable table){
			List<OrionProc> retVal=new List<OrionProc>();
			OrionProc orionProc;
			for(int i=0;i<table.Rows.Count;i++) {
				orionProc=new OrionProc();
				orionProc.OrionProcNum   = PIn.Long  (table.Rows[i]["OrionProcNum"].ToString());
				orionProc.ProcNum        = PIn.Long  (table.Rows[i]["ProcNum"].ToString());
				orionProc.DPC            = (OpenDentBusiness.OrionDPC)PIn.Int(table.Rows[i]["DPC"].ToString());
				orionProc.DPCpost        = (OpenDentBusiness.OrionDPC)PIn.Int(table.Rows[i]["DPCpost"].ToString());
				orionProc.DateScheduleBy = PIn.Date  (table.Rows[i]["DateScheduleBy"].ToString());
				orionProc.DateStopClock  = PIn.Date  (table.Rows[i]["DateStopClock"].ToString());
				orionProc.Status2        = (OpenDentBusiness.OrionStatus)PIn.Int(table.Rows[i]["Status2"].ToString());
				orionProc.IsOnCall       = PIn.Bool  (table.Rows[i]["IsOnCall"].ToString());
				orionProc.IsEffectiveComm= PIn.Bool  (table.Rows[i]["IsEffectiveComm"].ToString());
				orionProc.IsRepair       = PIn.Bool  (table.Rows[i]["IsRepair"].ToString());
				retVal.Add(orionProc);
			}
			return retVal;
		}
Пример #7
0
 ///<summary>Returns true if Update(OrionProc,OrionProc) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(OrionProc orionProc, OrionProc oldOrionProc)
 {
     if (orionProc.ProcNum != oldOrionProc.ProcNum)
     {
         return(true);
     }
     if (orionProc.DPC != oldOrionProc.DPC)
     {
         return(true);
     }
     if (orionProc.DPCpost != oldOrionProc.DPCpost)
     {
         return(true);
     }
     if (orionProc.DateScheduleBy.Date != oldOrionProc.DateScheduleBy.Date)
     {
         return(true);
     }
     if (orionProc.DateStopClock.Date != oldOrionProc.DateStopClock.Date)
     {
         return(true);
     }
     if (orionProc.Status2 != oldOrionProc.Status2)
     {
         return(true);
     }
     if (orionProc.IsOnCall != oldOrionProc.IsOnCall)
     {
         return(true);
     }
     if (orionProc.IsEffectiveComm != oldOrionProc.IsEffectiveComm)
     {
         return(true);
     }
     if (orionProc.IsRepair != oldOrionProc.IsRepair)
     {
         return(true);
     }
     return(false);
 }
Пример #8
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <OrionProc> TableToList(DataTable table)
        {
            List <OrionProc> retVal = new List <OrionProc>();
            OrionProc        orionProc;

            foreach (DataRow row in table.Rows)
            {
                orionProc = new OrionProc();
                orionProc.OrionProcNum    = PIn.Long(row["OrionProcNum"].ToString());
                orionProc.ProcNum         = PIn.Long(row["ProcNum"].ToString());
                orionProc.DPC             = (OpenDentBusiness.OrionDPC)PIn.Int(row["DPC"].ToString());
                orionProc.DPCpost         = (OpenDentBusiness.OrionDPC)PIn.Int(row["DPCpost"].ToString());
                orionProc.DateScheduleBy  = PIn.Date(row["DateScheduleBy"].ToString());
                orionProc.DateStopClock   = PIn.Date(row["DateStopClock"].ToString());
                orionProc.Status2         = (OpenDentBusiness.OrionStatus)PIn.Int(row["Status2"].ToString());
                orionProc.IsOnCall        = PIn.Bool(row["IsOnCall"].ToString());
                orionProc.IsEffectiveComm = PIn.Bool(row["IsEffectiveComm"].ToString());
                orionProc.IsRepair        = PIn.Bool(row["IsRepair"].ToString());
                retVal.Add(orionProc);
            }
            return(retVal);
        }
Пример #9
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <OrionProc> TableToList(DataTable table)
        {
            List <OrionProc> retVal = new List <OrionProc>();
            OrionProc        orionProc;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                orionProc = new OrionProc();
                orionProc.OrionProcNum    = PIn.Long(table.Rows[i]["OrionProcNum"].ToString());
                orionProc.ProcNum         = PIn.Long(table.Rows[i]["ProcNum"].ToString());
                orionProc.DPC             = (OrionDPC)PIn.Int(table.Rows[i]["DPC"].ToString());
                orionProc.DPCpost         = (OrionDPC)PIn.Int(table.Rows[i]["DPCpost"].ToString());
                orionProc.DateScheduleBy  = PIn.Date(table.Rows[i]["DateScheduleBy"].ToString());
                orionProc.DateStopClock   = PIn.Date(table.Rows[i]["DateStopClock"].ToString());
                orionProc.Status2         = (OrionStatus)PIn.Int(table.Rows[i]["Status2"].ToString());
                orionProc.IsOnCall        = PIn.Bool(table.Rows[i]["IsOnCall"].ToString());
                orionProc.IsEffectiveComm = PIn.Bool(table.Rows[i]["IsEffectiveComm"].ToString());
                orionProc.IsRepair        = PIn.Bool(table.Rows[i]["IsRepair"].ToString());
                retVal.Add(orionProc);
            }
            return(retVal);
        }
Пример #10
0
        ///<summary>Inserts one OrionProc into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(OrionProc orionProc, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO orionproc (";

            if (!useExistingPK && isRandomKeys)
            {
                orionProc.OrionProcNum = ReplicationServers.GetKeyNoCache("orionproc", "OrionProcNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "OrionProcNum,";
            }
            command += "ProcNum,DPC,DPCpost,DateScheduleBy,DateStopClock,Status2,IsOnCall,IsEffectiveComm,IsRepair) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(orionProc.OrionProcNum) + ",";
            }
            command +=
                POut.Long(orionProc.ProcNum) + ","
                + POut.Int((int)orionProc.DPC) + ","
                + POut.Int((int)orionProc.DPCpost) + ","
                + POut.Date(orionProc.DateScheduleBy) + ","
                + POut.Date(orionProc.DateStopClock) + ","
                + POut.Int((int)orionProc.Status2) + ","
                + POut.Bool(orionProc.IsOnCall) + ","
                + POut.Bool(orionProc.IsEffectiveComm) + ","
                + POut.Bool(orionProc.IsRepair) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                orionProc.OrionProcNum = Db.NonQ(command, true, "OrionProcNum", "orionProc");
            }
            return(orionProc.OrionProcNum);
        }
Пример #11
0
        ///<summary>Inserts one OrionProc into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(OrionProc orionProc, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                orionProc.OrionProcNum = ReplicationServers.GetKey("orionproc", "OrionProcNum");
            }
            string command = "INSERT INTO orionproc (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "OrionProcNum,";
            }
            command += "ProcNum,DPC,DPCpost,DateScheduleBy,DateStopClock,Status2,IsOnCall,IsEffectiveComm,IsRepair) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(orionProc.OrionProcNum) + ",";
            }
            command +=
                POut.Long(orionProc.ProcNum) + ","
                + POut.Int((int)orionProc.DPC) + ","
                + POut.Int((int)orionProc.DPCpost) + ","
                + POut.Date(orionProc.DateScheduleBy) + ","
                + POut.Date(orionProc.DateStopClock) + ","
                + POut.Int((int)orionProc.Status2) + ","
                + POut.Bool(orionProc.IsOnCall) + ","
                + POut.Bool(orionProc.IsEffectiveComm) + ","
                + POut.Bool(orionProc.IsRepair) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                orionProc.OrionProcNum = Db.NonQ(command, true);
            }
            return(orionProc.OrionProcNum);
        }
Пример #12
0
 ///<summary>Updates one OrionProc in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
 internal static void Update(OrionProc orionProc,OrionProc oldOrionProc)
 {
     string command="";
     if(orionProc.ProcNum != oldOrionProc.ProcNum) {
         if(command!=""){ command+=",";}
         command+="ProcNum = "+POut.Long(orionProc.ProcNum)+"";
     }
     if(orionProc.DPC != oldOrionProc.DPC) {
         if(command!=""){ command+=",";}
         command+="DPC = "+POut.Int   ((int)orionProc.DPC)+"";
     }
     if(orionProc.DPCpost != oldOrionProc.DPCpost) {
         if(command!=""){ command+=",";}
         command+="DPCpost = "+POut.Int   ((int)orionProc.DPCpost)+"";
     }
     if(orionProc.DateScheduleBy != oldOrionProc.DateScheduleBy) {
         if(command!=""){ command+=",";}
         command+="DateScheduleBy = "+POut.Date(orionProc.DateScheduleBy)+"";
     }
     if(orionProc.DateStopClock != oldOrionProc.DateStopClock) {
         if(command!=""){ command+=",";}
         command+="DateStopClock = "+POut.Date(orionProc.DateStopClock)+"";
     }
     if(orionProc.Status2 != oldOrionProc.Status2) {
         if(command!=""){ command+=",";}
         command+="Status2 = "+POut.Int   ((int)orionProc.Status2)+"";
     }
     if(orionProc.IsOnCall != oldOrionProc.IsOnCall) {
         if(command!=""){ command+=",";}
         command+="IsOnCall = "+POut.Bool(orionProc.IsOnCall)+"";
     }
     if(orionProc.IsEffectiveComm != oldOrionProc.IsEffectiveComm) {
         if(command!=""){ command+=",";}
         command+="IsEffectiveComm = "+POut.Bool(orionProc.IsEffectiveComm)+"";
     }
     if(orionProc.IsRepair != oldOrionProc.IsRepair) {
         if(command!=""){ command+=",";}
         command+="IsRepair = "+POut.Bool(orionProc.IsRepair)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE orionproc SET "+command
         +" WHERE OrionProcNum = "+POut.Long(orionProc.OrionProcNum);
     Db.NonQ(command);
 }
Пример #13
0
 ///<summary>Updates one OrionProc in the database.</summary>
 internal static void Update(OrionProc orionProc)
 {
     string command="UPDATE orionproc SET "
         +"ProcNum        =  "+POut.Long  (orionProc.ProcNum)+", "
         +"DPC            =  "+POut.Int   ((int)orionProc.DPC)+", "
         +"DPCpost        =  "+POut.Int   ((int)orionProc.DPCpost)+", "
         +"DateScheduleBy =  "+POut.Date  (orionProc.DateScheduleBy)+", "
         +"DateStopClock  =  "+POut.Date  (orionProc.DateStopClock)+", "
         +"Status2        =  "+POut.Int   ((int)orionProc.Status2)+", "
         +"IsOnCall       =  "+POut.Bool  (orionProc.IsOnCall)+", "
         +"IsEffectiveComm=  "+POut.Bool  (orionProc.IsEffectiveComm)+", "
         +"IsRepair       =  "+POut.Bool  (orionProc.IsRepair)+" "
         +"WHERE OrionProcNum = "+POut.Long(orionProc.OrionProcNum);
     Db.NonQ(command);
 }
Пример #14
0
        public static string GetChanges(Procedure procCur, Procedure procOld, OrionProc orionProcCur, OrionProc orionProcOld)
        {
            Changes = "";
            if (orionProcOld.DPC != orionProcCur.DPC)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "DPC changed from " + POut.String(orionProcOld.DPC.ToString()) + " to " + POut.String(orionProcCur.DPC.ToString()) + ".";
            }
            if (orionProcOld.DPCpost != orionProcCur.DPCpost)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "DPC Post Visit changed from " + POut.String(orionProcOld.DPCpost.ToString()) + " to " + POut.String(orionProcCur.DPCpost.ToString()) + ".";
            }
            //PatNum, AptNum, PlannedAptNum should never change---------------------------------------------------------------------------------------------
            if (procOld.PatNum != procCur.PatNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Patient Num changed from " + procOld.PatNum + " to " + procCur.PatNum + ".";
            }
            if (procOld.AptNum != procCur.AptNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Apt Num changed from " + procOld.AptNum + " to " + procCur.AptNum + ".";
            }
            if (procOld.PlannedAptNum != procCur.PlannedAptNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Planned Apt Num changed from " + procOld.PlannedAptNum + " to " + procCur.PlannedAptNum + ".";
            }
            //Date and time related fields------------------------------------------------------------------------------------------------------------------
            if (procOld.DateEntryC.Date != procCur.DateEntryC.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Entry changed from " + procOld.DateEntryC.ToShortDateString() + " to " + procCur.DateEntryC.ToShortDateString() + ".";
            }
            if (procOld.ProcDate.Date != procCur.ProcDate.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Date changed from " + procOld.ProcDate.ToShortDateString() + " to " + procCur.ProcDate.ToShortDateString() + ".";
            }
            //if(procOld.StartTime != procCur.StartTime) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Start Time changed from "+procOld.StartTime+" to "+procCur.StartTime+".";
            //}
            //if(procOld.StopTime != procCur.StopTime) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Stop Time changed from "+procOld.StopTime+" to "+procCur.StopTime+".";
            //}
            if (procOld.ProcTime != procCur.ProcTime)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure Time changed from "
                           + (PIn.DateT(procOld.ProcTime.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procOld.ProcTime.ToString()).ToShortTimeString())
                           + " to " + (PIn.DateT(procCur.ProcTime.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procCur.ProcTime.ToString()).ToShortTimeString()) + ".";
            }
            if (procOld.ProcTimeEnd != procCur.ProcTimeEnd)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure End Time changed from "
                           + (PIn.DateT(procOld.ProcTimeEnd.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procOld.ProcTimeEnd.ToString()).ToShortTimeString())
                           + " to " + (PIn.DateT(procCur.ProcTimeEnd.ToString()).ToShortTimeString() == "12:00 AM"?"none":PIn.DateT(procCur.ProcTimeEnd.ToString()).ToShortTimeString()) + ".";
            }
            //Procedure, related areas, amount, hide graphics, etc.-----------------------------------------------------------------------------------------
            if (procOld.CodeNum != procCur.CodeNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure changed from " + ProcedureCodes.GetLaymanTerm(procOld.CodeNum) + " to " + ProcedureCodes.GetLaymanTerm(procCur.CodeNum) + ".";
            }
            if (procOld.ProcFee != procCur.ProcFee)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Fee changed from $" + procOld.ProcFee.ToString("F") + " to $" + procCur.ProcFee.ToString("F") + ".";
            }
            if (procOld.ToothNum != procCur.ToothNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Tooth Num changed from " + procOld.ToothNum + " to " + procCur.ToothNum + ".";
            }
            if (procOld.Surf != procCur.Surf)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Surface changed from " + procOld.Surf + " to " + procCur.Surf + ".";
            }
            if (procOld.ToothRange != procCur.ToothRange)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Tooth Range changed from " + procOld.ToothRange + " to " + procCur.ToothRange + ".";
            }
            if (procOld.HideGraphics != procCur.HideGraphics)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Hide Graphics changed from " + (procOld.HideGraphics?"Hide Graphics":"Do Not Hide Graphics")
                           + " to " + (procCur.HideGraphics?"Hide Graphics":"Do Not Hide Graphics") + ".";
            }
            //Provider, Diagnosis, Priority, Place of Service, Clinic, Site---------------------------------------------------------------------------------
            if (procOld.ProvNum != procCur.ProvNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Provider changed from " + Providers.GetAbbr(procOld.ProvNum) + " to " + Providers.GetAbbr(procCur.ProvNum) + ".";
            }
            if (procOld.Dx != procCur.Dx)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Diagnosis changed from " + Defs.GetDef(DefCat.Diagnosis, procOld.Dx).ItemName
                           + " to " + Defs.GetDef(DefCat.Diagnosis, procCur.Dx).ItemName + ".";
            }
            if (procOld.Priority != procCur.Priority)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Priority changed from " + ((procOld.Priority != 0)?Defs.GetDef(DefCat.TxPriorities, procOld.Priority).ItemName:"no priority")
                           + " to " + ((procCur.Priority != 0)?Defs.GetDef(DefCat.TxPriorities, procCur.Priority).ItemName:"no priority") + ".";
            }
            if (procOld.PlaceService != procCur.PlaceService)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Place of Service changed from " + procOld.PlaceService.ToString() + " to " + procCur.PlaceService.ToString() + ".";
            }
            if (procOld.ClinicNum != procCur.ClinicNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Clinic changed from " + Clinics.GetAbbr(procOld.ClinicNum) + " to " + Clinics.GetAbbr(procCur.ClinicNum) + ".";
            }
            if (procOld.SiteNum != procCur.SiteNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Site changed from " + (procOld.SiteNum == 0?"none":Sites.GetDescription(procOld.SiteNum))
                           + " to " + (procCur.SiteNum == 0?"none":Sites.GetDescription(procCur.SiteNum)) + ".";
            }
            //Prosthesis reverse lookup---------------------------------------------------------------------------------------------------------------------
            if (procOld.Prosthesis != procCur.Prosthesis)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                string prosthesisOld;
                switch (procOld.Prosthesis.ToString())
                {
                case "": prosthesisOld = "no"; break;

                case "I":       prosthesisOld = "Initial"; break;

                case "R": prosthesisOld = "Replacement"; break;

                default: prosthesisOld = "error"; break;
                }
                string prosthesisCur;
                switch (procCur.Prosthesis.ToString())
                {
                case "": prosthesisCur = "no"; break;

                case "I": prosthesisCur = "Initial"; break;

                case "R": prosthesisCur = "Replacement"; break;

                default: prosthesisCur = "error"; break;
                }
                Changes += "Prosthesis changed from " + prosthesisOld + " to " + prosthesisCur + ".";
            }
            if (procOld.DateOriginalProsth.Date != procCur.DateOriginalProsth.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date of Original Prosthesis changed from " + procOld.DateOriginalProsth.ToShortDateString()
                           + " to " + procCur.DateOriginalProsth.ToShortDateString() + ".";
            }
            //Claim Note & Orion Proc Fields----------------------------------------------------------------------------------------------------------------
            if (procOld.ClaimNote != procCur.ClaimNote)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Claim Note changed from " + (procOld.ClaimNote == ""?"none":"'" + procOld.ClaimNote + "'")
                           + " to " + (procCur.ClaimNote == ""?"none":"'" + procCur.ClaimNote + "'");
            }
            if (orionProcOld.OrionProcNum != orionProcCur.OrionProcNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Orion Proc Num changed from " + POut.Long(orionProcOld.OrionProcNum) + " to " + POut.Long(orionProcCur.OrionProcNum) + ".";
            }
            if (orionProcOld.ProcNum != orionProcCur.ProcNum)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Num changed from " + POut.Long(orionProcOld.ProcNum) + " to " + POut.Long(orionProcCur.ProcNum) + ".";
            }
            //Orion Status Reverse Lookup for Description----------------------------------//None is equivalent to TP---------------------------------------
            if (orionProcOld.Status2 != orionProcCur.Status2 && !(orionProcOld.Status2 == OrionStatus.None && orionProcCur.Status2 == OrionStatus.TP))
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                string[] status2     = new string[2];
                string[] status2Desc = new string[2];
                status2[0] = orionProcOld.Status2.ToString();
                status2[1] = orionProcCur.Status2.ToString();
                for (int i = 0; i < 2; i++)
                {
                    switch (status2[i])
                    {
                    case "None":            status2Desc[i] = "TP-treatment planned"; break;

                    case "TP":                      status2Desc[i] = "TP-treatment planned"; break;

                    case "C":                               status2Desc[i] = "C-completed";   break;

                    case "E":                               status2Desc[i] = "E-existing prior to incarceration"; break;

                    case "R":                               status2Desc[i] = "R-refused treatment"; break;

                    case "RO":                      status2Desc[i] = "RO-referred out to specialist"; break;

                    case "CS":                      status2Desc[i] = "CS-completed by specialist"; break;

                    case "CR":                      status2Desc[i] = "CR-completed by registry"; break;

                    case "CA_Tx":           status2Desc[i] = "CA_Tx-cancelled, tx plan changed"; break;

                    case "CA_EPRD": status2Desc[i] = "CA_EPRD-cancelled, eligible parole"; break;

                    case "CA_P/D":  status2Desc[i] = "CA_P/D--cancelled, parole/discharge"; break;

                    case "S":                               status2Desc[i] = "S-suspended, unacceptable plaque"; break;

                    case "ST":                      status2Desc[i] = "ST-stop clock, multi visit"; break;

                    case "W":                               status2Desc[i] = "W-watch"; break;

                    case "A":                               status2Desc[i] = "A-alternative"; break;

                    default:                                status2Desc[i] = "error"; break;
                    }
                }
                Changes += "Orion Procedure Status changed from " + status2Desc[0] + " to " + status2Desc[1] + ".";
            }
            //Other orion fields----------------------------------------------------------------------------------------------------------------------------
            if (orionProcOld.DateScheduleBy.Date != orionProcCur.DateScheduleBy.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Schedule By changed from " + orionProcOld.DateScheduleBy.ToShortDateString()
                           + " to " + orionProcCur.DateScheduleBy.ToShortDateString() + ".";
            }
            if (orionProcOld.DateStopClock.Date != orionProcCur.DateStopClock.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date Stop Clock changed from " + orionProcOld.DateStopClock.ToShortDateString()
                           + " to " + orionProcCur.DateStopClock.ToShortDateString() + ".";
            }
            if (orionProcOld.IsOnCall != orionProcCur.IsOnCall)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is On Call changed from " + (orionProcOld.IsOnCall?"Is On Call":"Is Not On Call")
                           + " to " + (orionProcCur.IsOnCall?"Is On Call":"Is Not On Call") + ".";
            }
            if (orionProcOld.IsEffectiveComm != orionProcCur.IsEffectiveComm)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Effective Comm changed from " + (orionProcOld.IsEffectiveComm?"Is an Effective Communicator":"Is Not an Effective Communicator")
                           + " to " + (orionProcCur.IsEffectiveComm?"Is an Effective Communicator":"Is Not an Effective Communicator") + ".";
            }
            if (orionProcOld.IsRepair != orionProcCur.IsRepair)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Repair changed from " + (orionProcOld.IsRepair?"Is a Repair":"Is Not a Repair")
                           + " to " + (orionProcCur.IsRepair?"Is a Repair":"Is Not a Repair") + ".";
            }
            //Medical fields--------------------------------------------------------------------------------------------------------------------------------
            if (procOld.MedicalCode != procCur.MedicalCode)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Medical Code changed from " + (procOld.MedicalCode == ""?"none":procOld.MedicalCode)
                           + " to " + (procCur.MedicalCode == ""?"none":procCur.MedicalCode) + ".";
            }
            if (procOld.DiagnosticCode != procCur.DiagnosticCode)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Diagnostic Code changed from " + (procOld.DiagnosticCode == ""?"none":procOld.DiagnosticCode)
                           + " to " + (procCur.DiagnosticCode == ""?"none":procCur.DiagnosticCode) + ".";
            }
            if (procOld.IsPrincDiag != procCur.IsPrincDiag)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Is Princ Diag changed from " + (procOld.IsPrincDiag?"Principal Diagnosis":"Not Principal Diagnosis")
                           + " to " + (procCur.IsPrincDiag?"Principal Diagnosis":"Not Principal Diagnosis") + ".";
            }
            //if(procOld.RevCode != procCur.RevCode) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Rev Code changed from "+POut.String(procOld.RevCode)+"' to '"+POut.String(procCur.RevCode)+".";
            //}
            //Proc status and billing fields----------------------------------------------------------------------------------------------------------------
            if (procOld.ProcStatus != procCur.ProcStatus)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Procedure Status changed from " + procOld.ProcStatus.ToString() + " to " + procCur.ProcStatus.ToString() + ".";
            }
            if (procOld.DateTP.Date != procCur.DateTP.Date && procOld.DateTP.Date != DateTime.MinValue.Date)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Date TP changed from " + procOld.DateTP.ToShortDateString() + " to " + procCur.DateTP.ToShortDateString() + ".";
            }
            //if(procOld.BillingTypeOne != procCur.BillingTypeOne) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Billing Type One changed from "+(procOld.BillingTypeOne!=0?Defs.GetDef(DefCat.BillingTypes,procOld.BillingTypeOne).ItemName:"none")
            //		+" to "+(procCur.BillingTypeOne!=0?Defs.GetDef(DefCat.BillingTypes,procCur.BillingTypeOne).ItemName:"none")+".";
            //}
            //if(procOld.BillingTypeTwo != procCur.BillingTypeTwo) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Billing Type Two changed from "+(procOld.BillingTypeTwo!=0?Defs.GetDef(DefCat.BillingTypes,procOld.BillingTypeTwo).ItemName:"none")
            //		+" to "+(procCur.BillingTypeTwo!=0?Defs.GetDef(DefCat.BillingTypes,procCur.BillingTypeTwo).ItemName:"none")+".";
            //}
            if (procOld.ProcNumLab != procCur.ProcNumLab)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Proc Num Lab changed from " + POut.Long(procOld.ProcNumLab) + " to " + POut.Long(procCur.ProcNumLab) + ".";
            }
            //if(procOld.UnitCode != procCur.UnitCode) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Unit Code changed from "+POut.String(procOld.UnitCode)+" to "+POut.String(procCur.UnitCode)+".";
            //}
            //UnitQty, Canadian Type Codes, and Note--------------------------------------------------------------------------------------------------------
            if (procOld.UnitQty != procCur.UnitQty)
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Unit Quantity changed from " + POut.Int(procOld.UnitQty) + " to " + POut.Int(procCur.UnitQty) + ".";
            }
            //if(procOld.CanadianTypeCodes != procCur.CanadianTypeCodes) {
            //  if(Changes!=""){ Changes+="\r\n";}
            //  Changes+="Canadian Code Type changed from "+POut.String(procOld.CanadianTypeCodes)+" to "+POut.String(procCur.CanadianTypeCodes)+".";
            // }
            if (procOld.Note != procCur.Note && !(procOld.Note == null && procCur.Note == ""))         //Null note is equivalent to an empty note string.
            {
                if (Changes != "")
                {
                    Changes += "\r\n";
                }
                Changes += "Note changed from " + (procOld.Note == ""?"none":"'" + procOld.Note + "'")
                           + " to " + (procCur.Note == ""?"none":"'" + procCur.Note + "'");
            }
            return(Changes);
        }
Пример #15
0
        ///<summary>Updates one OrionProc in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(OrionProc orionProc, OrionProc oldOrionProc)
        {
            string command = "";

            if (orionProc.ProcNum != oldOrionProc.ProcNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNum = " + POut.Long(orionProc.ProcNum) + "";
            }
            if (orionProc.DPC != oldOrionProc.DPC)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DPC = " + POut.Int((int)orionProc.DPC) + "";
            }
            if (orionProc.DPCpost != oldOrionProc.DPCpost)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DPCpost = " + POut.Int((int)orionProc.DPCpost) + "";
            }
            if (orionProc.DateScheduleBy.Date != oldOrionProc.DateScheduleBy.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateScheduleBy = " + POut.Date(orionProc.DateScheduleBy) + "";
            }
            if (orionProc.DateStopClock.Date != oldOrionProc.DateStopClock.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateStopClock = " + POut.Date(orionProc.DateStopClock) + "";
            }
            if (orionProc.Status2 != oldOrionProc.Status2)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Status2 = " + POut.Int((int)orionProc.Status2) + "";
            }
            if (orionProc.IsOnCall != oldOrionProc.IsOnCall)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsOnCall = " + POut.Bool(orionProc.IsOnCall) + "";
            }
            if (orionProc.IsEffectiveComm != oldOrionProc.IsEffectiveComm)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsEffectiveComm = " + POut.Bool(orionProc.IsEffectiveComm) + "";
            }
            if (orionProc.IsRepair != oldOrionProc.IsRepair)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsRepair = " + POut.Bool(orionProc.IsRepair) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE orionproc SET " + command
                      + " WHERE OrionProcNum = " + POut.Long(orionProc.OrionProcNum);
            Db.NonQ(command);
            return(true);
        }
Пример #16
0
 ///<summary>Inserts one OrionProc into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(OrionProc orionProc)
 {
     return(InsertNoCache(orionProc, false));
 }