Пример #1
0
        ///<summary>Updates one ProcTP in the database.</summary>
        public static void Update(ProcTP procTP)
        {
            string command = "UPDATE proctp SET "
                             + "TreatPlanNum   =  " + POut.Long(procTP.TreatPlanNum) + ", "
                             + "PatNum         =  " + POut.Long(procTP.PatNum) + ", "
                             + "ProcNumOrig    =  " + POut.Long(procTP.ProcNumOrig) + ", "
                             + "ItemOrder      =  " + POut.Int(procTP.ItemOrder) + ", "
                             + "Priority       =  " + POut.Long(procTP.Priority) + ", "
                             + "ToothNumTP     = '" + POut.String(procTP.ToothNumTP) + "', "
                             + "Surf           = '" + POut.String(procTP.Surf) + "', "
                             + "ProcCode       = '" + POut.String(procTP.ProcCode) + "', "
                             + "Descript       = '" + POut.String(procTP.Descript) + "', "
                             + "FeeAmt         = '" + POut.Double(procTP.FeeAmt) + "', "
                             + "PriInsAmt      = '" + POut.Double(procTP.PriInsAmt) + "', "
                             + "SecInsAmt      = '" + POut.Double(procTP.SecInsAmt) + "', "
                             + "PatAmt         = '" + POut.Double(procTP.PatAmt) + "', "
                             + "Discount       = '" + POut.Double(procTP.Discount) + "', "
                             + "Prognosis      = '" + POut.String(procTP.Prognosis) + "', "
                             + "Dx             = '" + POut.String(procTP.Dx) + "', "
                             + "ProcAbbr       = '" + POut.String(procTP.ProcAbbr) + "', "
                             //SecUserNumEntry excluded from update
                             //SecDateEntry not allowed to change
                             //SecDateTEdit can only be set by MySQL
                             + "FeeAllowed     = '" + POut.Double(procTP.FeeAllowed) + "' "
                             + "WHERE ProcTPNum = " + POut.Long(procTP.ProcTPNum);

            Db.NonQ(command);
        }
Пример #2
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ProcTP> TableToList(DataTable table)
        {
            List <ProcTP> retVal = new List <ProcTP>();
            ProcTP        procTP;

            foreach (DataRow row in table.Rows)
            {
                procTP                 = new ProcTP();
                procTP.ProcTPNum       = PIn.Long(row["ProcTPNum"].ToString());
                procTP.TreatPlanNum    = PIn.Long(row["TreatPlanNum"].ToString());
                procTP.PatNum          = PIn.Long(row["PatNum"].ToString());
                procTP.ProcNumOrig     = PIn.Long(row["ProcNumOrig"].ToString());
                procTP.ItemOrder       = PIn.Int(row["ItemOrder"].ToString());
                procTP.Priority        = PIn.Long(row["Priority"].ToString());
                procTP.ToothNumTP      = PIn.String(row["ToothNumTP"].ToString());
                procTP.Surf            = PIn.String(row["Surf"].ToString());
                procTP.ProcCode        = PIn.String(row["ProcCode"].ToString());
                procTP.Descript        = PIn.String(row["Descript"].ToString());
                procTP.FeeAmt          = PIn.Double(row["FeeAmt"].ToString());
                procTP.PriInsAmt       = PIn.Double(row["PriInsAmt"].ToString());
                procTP.SecInsAmt       = PIn.Double(row["SecInsAmt"].ToString());
                procTP.PatAmt          = PIn.Double(row["PatAmt"].ToString());
                procTP.Discount        = PIn.Double(row["Discount"].ToString());
                procTP.Prognosis       = PIn.String(row["Prognosis"].ToString());
                procTP.Dx              = PIn.String(row["Dx"].ToString());
                procTP.ProcAbbr        = PIn.String(row["ProcAbbr"].ToString());
                procTP.SecUserNumEntry = PIn.Long(row["SecUserNumEntry"].ToString());
                procTP.SecDateEntry    = PIn.Date(row["SecDateEntry"].ToString());
                procTP.SecDateTEdit    = PIn.DateT(row["SecDateTEdit"].ToString());
                procTP.FeeAllowed      = PIn.Double(row["FeeAllowed"].ToString());
                retVal.Add(procTP);
            }
            return(retVal);
        }
Пример #3
0
        ///<summary>Gets all ProcTPs for a given Patient ordered by ItemOrder.</summary>
        public static ProcTP[] Refresh(int patNum)
        {
            string command = "SELECT * FROM proctp "
                             + "WHERE PatNum=" + POut.PInt(patNum)
                             + " ORDER BY ItemOrder";
            DataTable table = General.GetTable(command);

            ProcTP[] List = new ProcTP[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]              = new ProcTP();
                List[i].ProcTPNum    = PIn.PInt(table.Rows[i][0].ToString());
                List[i].TreatPlanNum = PIn.PInt(table.Rows[i][1].ToString());
                List[i].PatNum       = PIn.PInt(table.Rows[i][2].ToString());
                List[i].ProcNumOrig  = PIn.PInt(table.Rows[i][3].ToString());
                List[i].ItemOrder    = PIn.PInt(table.Rows[i][4].ToString());
                List[i].Priority     = PIn.PInt(table.Rows[i][5].ToString());
                List[i].ToothNumTP   = PIn.PString(table.Rows[i][6].ToString());
                List[i].Surf         = PIn.PString(table.Rows[i][7].ToString());
                List[i].ADACode      = PIn.PString(table.Rows[i][8].ToString());
                List[i].Descript     = PIn.PString(table.Rows[i][9].ToString());
                List[i].FeeAmt       = PIn.PDouble(table.Rows[i][10].ToString());
                List[i].PriInsAmt    = PIn.PDouble(table.Rows[i][11].ToString());
                List[i].SecInsAmt    = PIn.PDouble(table.Rows[i][12].ToString());
                List[i].PatAmt       = PIn.PDouble(table.Rows[i][13].ToString());
            }
            return(List);
        }
Пример #4
0
 ///<summary>Inserts one ProcTP into the database.  Returns the new priKey.</summary>
 internal static long Insert(ProcTP procTP)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         procTP.ProcTPNum = DbHelper.GetNextOracleKey("proctp", "ProcTPNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(procTP, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     procTP.ProcTPNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(procTP, false));
     }
 }
Пример #5
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<ProcTP> TableToList(DataTable table){
			List<ProcTP> retVal=new List<ProcTP>();
			ProcTP procTP;
			for(int i=0;i<table.Rows.Count;i++) {
				procTP=new ProcTP();
				procTP.ProcTPNum   = PIn.Long  (table.Rows[i]["ProcTPNum"].ToString());
				procTP.TreatPlanNum= PIn.Long  (table.Rows[i]["TreatPlanNum"].ToString());
				procTP.PatNum      = PIn.Long  (table.Rows[i]["PatNum"].ToString());
				procTP.ProcNumOrig = PIn.Long  (table.Rows[i]["ProcNumOrig"].ToString());
				procTP.ItemOrder   = PIn.Int   (table.Rows[i]["ItemOrder"].ToString());
				procTP.Priority    = PIn.Long  (table.Rows[i]["Priority"].ToString());
				procTP.ToothNumTP  = PIn.String(table.Rows[i]["ToothNumTP"].ToString());
				procTP.Surf        = PIn.String(table.Rows[i]["Surf"].ToString());
				procTP.ProcCode    = PIn.String(table.Rows[i]["ProcCode"].ToString());
				procTP.Descript    = PIn.String(table.Rows[i]["Descript"].ToString());
				procTP.FeeAmt      = PIn.Double(table.Rows[i]["FeeAmt"].ToString());
				procTP.PriInsAmt   = PIn.Double(table.Rows[i]["PriInsAmt"].ToString());
				procTP.SecInsAmt   = PIn.Double(table.Rows[i]["SecInsAmt"].ToString());
				procTP.PatAmt      = PIn.Double(table.Rows[i]["PatAmt"].ToString());
				procTP.Discount    = PIn.Double(table.Rows[i]["Discount"].ToString());
				procTP.Prognosis   = PIn.String(table.Rows[i]["Prognosis"].ToString());
				procTP.Dx          = PIn.String(table.Rows[i]["Dx"].ToString());
				retVal.Add(procTP);
			}
			return retVal;
		}
Пример #6
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <ProcTP> TableToList(DataTable table)
        {
            List <ProcTP> retVal = new List <ProcTP>();
            ProcTP        procTP;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                procTP              = new ProcTP();
                procTP.ProcTPNum    = PIn.Long(table.Rows[i]["ProcTPNum"].ToString());
                procTP.TreatPlanNum = PIn.Long(table.Rows[i]["TreatPlanNum"].ToString());
                procTP.PatNum       = PIn.Long(table.Rows[i]["PatNum"].ToString());
                procTP.ProcNumOrig  = PIn.Long(table.Rows[i]["ProcNumOrig"].ToString());
                procTP.ItemOrder    = PIn.Int(table.Rows[i]["ItemOrder"].ToString());
                procTP.Priority     = PIn.Long(table.Rows[i]["Priority"].ToString());
                procTP.ToothNumTP   = PIn.String(table.Rows[i]["ToothNumTP"].ToString());
                procTP.Surf         = PIn.String(table.Rows[i]["Surf"].ToString());
                procTP.ProcCode     = PIn.String(table.Rows[i]["ProcCode"].ToString());
                procTP.Descript     = PIn.String(table.Rows[i]["Descript"].ToString());
                procTP.FeeAmt       = PIn.Double(table.Rows[i]["FeeAmt"].ToString());
                procTP.PriInsAmt    = PIn.Double(table.Rows[i]["PriInsAmt"].ToString());
                procTP.SecInsAmt    = PIn.Double(table.Rows[i]["SecInsAmt"].ToString());
                procTP.PatAmt       = PIn.Double(table.Rows[i]["PatAmt"].ToString());
                procTP.Discount     = PIn.Double(table.Rows[i]["Discount"].ToString());
                procTP.Prognosis    = PIn.String(table.Rows[i]["Prognosis"].ToString());
                procTP.Dx           = PIn.String(table.Rows[i]["Dx"].ToString());
                retVal.Add(procTP);
            }
            return(retVal);
        }
Пример #7
0
 ///<summary>Inserts one ProcTP into the database.  Returns the new priKey.</summary>
 internal static long Insert(ProcTP procTP)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         procTP.ProcTPNum=DbHelper.GetNextOracleKey("proctp","ProcTPNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(procTP,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     procTP.ProcTPNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(procTP,false);
     }
 }
Пример #8
0
 ///<summary></summary>
 public FormProcTPEdit(ProcTP procCur)
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     Lan.F(this);
     ProcCur = procCur.Copy();
 }
Пример #9
0
        ///<summary>Inserts one ProcTP into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ProcTP procTP, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO proctp (";

            if (!useExistingPK && isRandomKeys)
            {
                procTP.ProcTPNum = ReplicationServers.GetKeyNoCache("proctp", "ProcTPNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ProcTPNum,";
            }
            command += "TreatPlanNum,PatNum,ProcNumOrig,ItemOrder,Priority,ToothNumTP,Surf,ProcCode,Descript,FeeAmt,PriInsAmt,SecInsAmt,PatAmt,Discount,Prognosis,Dx,ProcAbbr,SecUserNumEntry,SecDateEntry,FeeAllowed,TaxAmt,ProvNum,DateTP,ClinicNum,CatPercUCR) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(procTP.ProcTPNum) + ",";
            }
            command +=
                POut.Long(procTP.TreatPlanNum) + ","
                + POut.Long(procTP.PatNum) + ","
                + POut.Long(procTP.ProcNumOrig) + ","
                + POut.Int(procTP.ItemOrder) + ","
                + POut.Long(procTP.Priority) + ","
                + "'" + POut.String(procTP.ToothNumTP) + "',"
                + "'" + POut.String(procTP.Surf) + "',"
                + "'" + POut.String(procTP.ProcCode) + "',"
                + "'" + POut.String(procTP.Descript) + "',"
                + "'" + POut.Double(procTP.FeeAmt) + "',"
                + "'" + POut.Double(procTP.PriInsAmt) + "',"
                + "'" + POut.Double(procTP.SecInsAmt) + "',"
                + "'" + POut.Double(procTP.PatAmt) + "',"
                + "'" + POut.Double(procTP.Discount) + "',"
                + "'" + POut.String(procTP.Prognosis) + "',"
                + "'" + POut.String(procTP.Dx) + "',"
                + "'" + POut.String(procTP.ProcAbbr) + "',"
                + POut.Long(procTP.SecUserNumEntry) + ","
                + DbHelper.Now() + ","
                //SecDateTEdit can only be set by MySQL
                + "'" + POut.Double(procTP.FeeAllowed) + "',"
                + "'" + POut.Double(procTP.TaxAmt) + "',"
                + POut.Long(procTP.ProvNum) + ","
                + POut.Date(procTP.DateTP) + ","
                + POut.Long(procTP.ClinicNum) + ","
                + "'" + POut.Double(procTP.CatPercUCR) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                procTP.ProcTPNum = Db.NonQ(command, true, "ProcTPNum", "procTP");
            }
            return(procTP.ProcTPNum);
        }
Пример #10
0
 ///<summary></summary>
 public static void InsertOrUpdate(ProcTP proc, bool isNew)
 {
     if (isNew)
     {
         Insert(proc);
     }
     else
     {
         Update(proc);
     }
 }
Пример #11
0
 ///<summary></summary>
 public FormProcTPEdit(ProcTP procCur, DateTime dateTP, bool isSigned)
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     Lan.F(this);
     ProcCur   = procCur.Copy();
     DateTP    = dateTP;
     _isSigned = isSigned;
 }
Пример #12
0
 ///<summary>Inserts one ProcTP into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ProcTP procTP)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(procTP, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             procTP.ProcTPNum = DbHelper.GetNextOracleKey("proctp", "ProcTPNum");                  //Cacheless method
         }
         return(InsertNoCache(procTP, true));
     }
 }
Пример #13
0
        ///<summary>Gets a list for just one tp.  Used in TP module.  Supply a list of all ProcTPs for pt.</summary>
        public static ProcTP[] GetListForTP(int treatPlanNum, ProcTP[] listAll)
        {
            ArrayList AL = new ArrayList();

            for (int i = 0; i < listAll.Length; i++)
            {
                if (listAll[i].TreatPlanNum != treatPlanNum)
                {
                    continue;
                }
                AL.Add(listAll[i]);
            }
            ProcTP[] retVal = new ProcTP[AL.Count];
            AL.CopyTo(retVal);
            return(retVal);
        }
Пример #14
0
        ///<summary>Inserts one ProcTP into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(ProcTP procTP, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                procTP.ProcTPNum = ReplicationServers.GetKey("proctp", "ProcTPNum");
            }
            string command = "INSERT INTO proctp (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ProcTPNum,";
            }
            command += "TreatPlanNum,PatNum,ProcNumOrig,ItemOrder,Priority,ToothNumTP,Surf,ProcCode,Descript,FeeAmt,PriInsAmt,SecInsAmt,PatAmt,Discount,Prognosis,Dx) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(procTP.ProcTPNum) + ",";
            }
            command +=
                POut.Long(procTP.TreatPlanNum) + ","
                + POut.Long(procTP.PatNum) + ","
                + POut.Long(procTP.ProcNumOrig) + ","
                + POut.Int(procTP.ItemOrder) + ","
                + POut.Long(procTP.Priority) + ","
                + "'" + POut.String(procTP.ToothNumTP) + "',"
                + "'" + POut.String(procTP.Surf) + "',"
                + "'" + POut.String(procTP.ProcCode) + "',"
                + "'" + POut.String(procTP.Descript) + "',"
                + "'" + POut.Double(procTP.FeeAmt) + "',"
                + "'" + POut.Double(procTP.PriInsAmt) + "',"
                + "'" + POut.Double(procTP.SecInsAmt) + "',"
                + "'" + POut.Double(procTP.PatAmt) + "',"
                + "'" + POut.Double(procTP.Discount) + "',"
                + "'" + POut.String(procTP.Prognosis) + "',"
                + "'" + POut.String(procTP.Dx) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                procTP.ProcTPNum = Db.NonQ(command, true);
            }
            return(procTP.ProcTPNum);
        }
Пример #15
0
        ///<summary></summary>
        private static void Insert(ProcTP proc)
        {
            if (PrefB.RandomKeys)
            {
                proc.ProcTPNum = MiscData.GetKey("proctp", "ProcTPNum");
            }
            string command = "INSERT INTO proctp (";

            if (PrefB.RandomKeys)
            {
                command += "ProcTPNum,";
            }
            command += "TreatPlanNum,PatNum,ProcNumOrig,ItemOrder,Priority,ToothNumTP,Surf,ProcCode,Descript,FeeAmt,"
                       + "PriInsAmt,SecInsAmt,PatAmt,Discount) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(proc.ProcTPNum) + "', ";
            }
            command +=
                "'" + POut.PInt(proc.TreatPlanNum) + "', "
                + "'" + POut.PInt(proc.PatNum) + "', "
                + "'" + POut.PInt(proc.ProcNumOrig) + "', "
                + "'" + POut.PInt(proc.ItemOrder) + "', "
                + "'" + POut.PInt(proc.Priority) + "', "
                + "'" + POut.PString(proc.ToothNumTP) + "', "
                + "'" + POut.PString(proc.Surf) + "', "
                + "'" + POut.PString(proc.ProcCode) + "', "
                + "'" + POut.PString(proc.Descript) + "', "
                + "'" + POut.PDouble(proc.FeeAmt) + "', "
                + "'" + POut.PDouble(proc.PriInsAmt) + "', "
                + "'" + POut.PDouble(proc.SecInsAmt) + "', "
                + "'" + POut.PDouble(proc.PatAmt) + "', "
                + "'" + POut.PDouble(proc.Discount) + "')";
            if (PrefB.RandomKeys)
            {
                General.NonQ(command);
            }
            else
            {
                proc.ProcTPNum = General.NonQ(command, true);
            }
        }
Пример #16
0
        ///<summary></summary>
        private static void Update(ProcTP proc)
        {
            string command = "UPDATE proctp SET "
                             + "TreatPlanNum = '" + POut.PInt(proc.TreatPlanNum) + "'"
                             + ",PatNum = '" + POut.PInt(proc.PatNum) + "'"
                             + ",ProcNumOrig = '" + POut.PInt(proc.ProcNumOrig) + "'"
                             + ",ItemOrder = '" + POut.PInt(proc.ItemOrder) + "'"
                             + ",Priority = '" + POut.PInt(proc.Priority) + "'"
                             + ",ToothNumTP = '" + POut.PString(proc.ToothNumTP) + "'"
                             + ",Surf = '" + POut.PString(proc.Surf) + "'"
                             + ",ADACode = '" + POut.PString(proc.ADACode) + "'"
                             + ",Descript = '" + POut.PString(proc.Descript) + "'"
                             + ",FeeAmt = '" + POut.PDouble(proc.FeeAmt) + "'"
                             + ",PriInsAmt = '" + POut.PDouble(proc.PriInsAmt) + "'"
                             + ",SecInsAmt = '" + POut.PDouble(proc.SecInsAmt) + "'"
                             + ",PatAmt = '" + POut.PDouble(proc.PatAmt) + "'"
                             + " WHERE ProcTPNum = '" + POut.PInt(proc.ProcTPNum) + "'";

            General.NonQ(command);
        }
Пример #17
0
 ///<summary>Inserts one ProcTP into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(ProcTP procTP,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         procTP.ProcTPNum=ReplicationServers.GetKey("proctp","ProcTPNum");
     }
     string command="INSERT INTO proctp (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="ProcTPNum,";
     }
     command+="TreatPlanNum,PatNum,ProcNumOrig,ItemOrder,Priority,ToothNumTP,Surf,ProcCode,Descript,FeeAmt,PriInsAmt,SecInsAmt,PatAmt,Discount,Prognosis,Dx) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(procTP.ProcTPNum)+",";
     }
     command+=
              POut.Long  (procTP.TreatPlanNum)+","
         +    POut.Long  (procTP.PatNum)+","
         +    POut.Long  (procTP.ProcNumOrig)+","
         +    POut.Int   (procTP.ItemOrder)+","
         +    POut.Long  (procTP.Priority)+","
         +"'"+POut.String(procTP.ToothNumTP)+"',"
         +"'"+POut.String(procTP.Surf)+"',"
         +"'"+POut.String(procTP.ProcCode)+"',"
         +"'"+POut.String(procTP.Descript)+"',"
         +"'"+POut.Double(procTP.FeeAmt)+"',"
         +"'"+POut.Double(procTP.PriInsAmt)+"',"
         +"'"+POut.Double(procTP.SecInsAmt)+"',"
         +"'"+POut.Double(procTP.PatAmt)+"',"
         +"'"+POut.Double(procTP.Discount)+"',"
         +"'"+POut.String(procTP.Prognosis)+"',"
         +"'"+POut.String(procTP.Dx)+"')";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         procTP.ProcTPNum=Db.NonQ(command,true);
     }
     return procTP.ProcTPNum;
 }
Пример #18
0
        ///<summary>Returns a list of limited versions of ProcTP corresponding to the Procedures in listProcs.  Intended to mimic the logic in
        ///ContrTreat.LoadActiveTP, on a limited data basis in order to extract the necessary data to create a ToothChart.</summary>
        private List <ProcTP> GetTreatProcTPs(List <Procedure> listProcsAll)
        {
            List <Procedure> listProcs   = listProcsAll.FindAll(x => x.ProcStatus.In(ProcStat.TP, ProcStat.TPi));
            List <ProcTP>    listProcTPs = new List <ProcTP>();

            foreach (Procedure proc in listProcs)
            {
                ProcTP procTP = new ProcTP();
                procTP.ProcNumOrig = proc.ProcNum;
                procTP.ToothNumTP  = Tooth.ToInternat(proc.ToothNum);
                procTP.ProcCode    = ProcedureCodes.GetStringProcCode(proc.CodeNum);
                if (ProcedureCodes.GetProcCode(proc.CodeNum).TreatArea == TreatmentArea.Surf)
                {
                    procTP.Surf = Tooth.SurfTidyFromDbToDisplay(proc.Surf, proc.ToothNum);
                }
                else
                {
                    procTP.Surf = proc.Surf;                  //for UR, L, etc.
                }
                listProcTPs.Add(procTP);
            }
            return(listProcTPs);
        }
Пример #19
0
        ///<summary>Updates one ProcTP in the database.</summary>
        internal static void Update(ProcTP procTP)
        {
            string command = "UPDATE proctp SET "
                             + "TreatPlanNum=  " + POut.Long(procTP.TreatPlanNum) + ", "
                             + "PatNum      =  " + POut.Long(procTP.PatNum) + ", "
                             + "ProcNumOrig =  " + POut.Long(procTP.ProcNumOrig) + ", "
                             + "ItemOrder   =  " + POut.Int(procTP.ItemOrder) + ", "
                             + "Priority    =  " + POut.Long(procTP.Priority) + ", "
                             + "ToothNumTP  = '" + POut.String(procTP.ToothNumTP) + "', "
                             + "Surf        = '" + POut.String(procTP.Surf) + "', "
                             + "ProcCode    = '" + POut.String(procTP.ProcCode) + "', "
                             + "Descript    = '" + POut.String(procTP.Descript) + "', "
                             + "FeeAmt      = '" + POut.Double(procTP.FeeAmt) + "', "
                             + "PriInsAmt   = '" + POut.Double(procTP.PriInsAmt) + "', "
                             + "SecInsAmt   = '" + POut.Double(procTP.SecInsAmt) + "', "
                             + "PatAmt      = '" + POut.Double(procTP.PatAmt) + "', "
                             + "Discount    = '" + POut.Double(procTP.Discount) + "', "
                             + "Prognosis   = '" + POut.String(procTP.Prognosis) + "', "
                             + "Dx          = '" + POut.String(procTP.Dx) + "' "
                             + "WHERE ProcTPNum = " + POut.Long(procTP.ProcTPNum);

            Db.NonQ(command);
        }
Пример #20
0
 ///<summary>Inserts one ProcTP into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ProcTP procTP)
 {
     return(InsertNoCache(procTP, false));
 }
Пример #21
0
		///<summary>Updates one ProcTP in the database.</summary>
		public static void Update(ProcTP procTP){
			string command="UPDATE proctp SET "
				+"TreatPlanNum=  "+POut.Long  (procTP.TreatPlanNum)+", "
				+"PatNum      =  "+POut.Long  (procTP.PatNum)+", "
				+"ProcNumOrig =  "+POut.Long  (procTP.ProcNumOrig)+", "
				+"ItemOrder   =  "+POut.Int   (procTP.ItemOrder)+", "
				+"Priority    =  "+POut.Long  (procTP.Priority)+", "
				+"ToothNumTP  = '"+POut.String(procTP.ToothNumTP)+"', "
				+"Surf        = '"+POut.String(procTP.Surf)+"', "
				+"ProcCode    = '"+POut.String(procTP.ProcCode)+"', "
				+"Descript    = '"+POut.String(procTP.Descript)+"', "
				+"FeeAmt      = '"+POut.Double(procTP.FeeAmt)+"', "
				+"PriInsAmt   = '"+POut.Double(procTP.PriInsAmt)+"', "
				+"SecInsAmt   = '"+POut.Double(procTP.SecInsAmt)+"', "
				+"PatAmt      = '"+POut.Double(procTP.PatAmt)+"', "
				+"Discount    = '"+POut.Double(procTP.Discount)+"', "
				+"Prognosis   = '"+POut.String(procTP.Prognosis)+"', "
				+"Dx          = '"+POut.String(procTP.Dx)+"' "
				+"WHERE ProcTPNum = "+POut.Long(procTP.ProcTPNum);
			Db.NonQ(command);
		}
Пример #22
0
        ///<summary>Updates one ProcTP 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(ProcTP procTP, ProcTP oldProcTP)
        {
            string command = "";

            if (procTP.TreatPlanNum != oldProcTP.TreatPlanNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TreatPlanNum = " + POut.Long(procTP.TreatPlanNum) + "";
            }
            if (procTP.PatNum != oldProcTP.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(procTP.PatNum) + "";
            }
            if (procTP.ProcNumOrig != oldProcTP.ProcNumOrig)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNumOrig = " + POut.Long(procTP.ProcNumOrig) + "";
            }
            if (procTP.ItemOrder != oldProcTP.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(procTP.ItemOrder) + "";
            }
            if (procTP.Priority != oldProcTP.Priority)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Priority = " + POut.Long(procTP.Priority) + "";
            }
            if (procTP.ToothNumTP != oldProcTP.ToothNumTP)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ToothNumTP = '" + POut.String(procTP.ToothNumTP) + "'";
            }
            if (procTP.Surf != oldProcTP.Surf)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Surf = '" + POut.String(procTP.Surf) + "'";
            }
            if (procTP.ProcCode != oldProcTP.ProcCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcCode = '" + POut.String(procTP.ProcCode) + "'";
            }
            if (procTP.Descript != oldProcTP.Descript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Descript = '" + POut.String(procTP.Descript) + "'";
            }
            if (procTP.FeeAmt != oldProcTP.FeeAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeAmt = '" + POut.Double(procTP.FeeAmt) + "'";
            }
            if (procTP.PriInsAmt != oldProcTP.PriInsAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PriInsAmt = '" + POut.Double(procTP.PriInsAmt) + "'";
            }
            if (procTP.SecInsAmt != oldProcTP.SecInsAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SecInsAmt = '" + POut.Double(procTP.SecInsAmt) + "'";
            }
            if (procTP.PatAmt != oldProcTP.PatAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatAmt = '" + POut.Double(procTP.PatAmt) + "'";
            }
            if (procTP.Discount != oldProcTP.Discount)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Discount = '" + POut.Double(procTP.Discount) + "'";
            }
            if (procTP.Prognosis != oldProcTP.Prognosis)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Prognosis = '" + POut.String(procTP.Prognosis) + "'";
            }
            if (procTP.Dx != oldProcTP.Dx)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Dx = '" + POut.String(procTP.Dx) + "'";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE proctp SET " + command
                      + " WHERE ProcTPNum = " + POut.Long(procTP.ProcTPNum);
            Db.NonQ(command);
        }
Пример #23
0
		///<summary>Updates one ProcTP 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(ProcTP procTP,ProcTP oldProcTP){
			string command="";
			if(procTP.TreatPlanNum != oldProcTP.TreatPlanNum) {
				if(command!=""){ command+=",";}
				command+="TreatPlanNum = "+POut.Long(procTP.TreatPlanNum)+"";
			}
			if(procTP.PatNum != oldProcTP.PatNum) {
				if(command!=""){ command+=",";}
				command+="PatNum = "+POut.Long(procTP.PatNum)+"";
			}
			if(procTP.ProcNumOrig != oldProcTP.ProcNumOrig) {
				if(command!=""){ command+=",";}
				command+="ProcNumOrig = "+POut.Long(procTP.ProcNumOrig)+"";
			}
			if(procTP.ItemOrder != oldProcTP.ItemOrder) {
				if(command!=""){ command+=",";}
				command+="ItemOrder = "+POut.Int(procTP.ItemOrder)+"";
			}
			if(procTP.Priority != oldProcTP.Priority) {
				if(command!=""){ command+=",";}
				command+="Priority = "+POut.Long(procTP.Priority)+"";
			}
			if(procTP.ToothNumTP != oldProcTP.ToothNumTP) {
				if(command!=""){ command+=",";}
				command+="ToothNumTP = '"+POut.String(procTP.ToothNumTP)+"'";
			}
			if(procTP.Surf != oldProcTP.Surf) {
				if(command!=""){ command+=",";}
				command+="Surf = '"+POut.String(procTP.Surf)+"'";
			}
			if(procTP.ProcCode != oldProcTP.ProcCode) {
				if(command!=""){ command+=",";}
				command+="ProcCode = '"+POut.String(procTP.ProcCode)+"'";
			}
			if(procTP.Descript != oldProcTP.Descript) {
				if(command!=""){ command+=",";}
				command+="Descript = '"+POut.String(procTP.Descript)+"'";
			}
			if(procTP.FeeAmt != oldProcTP.FeeAmt) {
				if(command!=""){ command+=",";}
				command+="FeeAmt = '"+POut.Double(procTP.FeeAmt)+"'";
			}
			if(procTP.PriInsAmt != oldProcTP.PriInsAmt) {
				if(command!=""){ command+=",";}
				command+="PriInsAmt = '"+POut.Double(procTP.PriInsAmt)+"'";
			}
			if(procTP.SecInsAmt != oldProcTP.SecInsAmt) {
				if(command!=""){ command+=",";}
				command+="SecInsAmt = '"+POut.Double(procTP.SecInsAmt)+"'";
			}
			if(procTP.PatAmt != oldProcTP.PatAmt) {
				if(command!=""){ command+=",";}
				command+="PatAmt = '"+POut.Double(procTP.PatAmt)+"'";
			}
			if(procTP.Discount != oldProcTP.Discount) {
				if(command!=""){ command+=",";}
				command+="Discount = '"+POut.Double(procTP.Discount)+"'";
			}
			if(procTP.Prognosis != oldProcTP.Prognosis) {
				if(command!=""){ command+=",";}
				command+="Prognosis = '"+POut.String(procTP.Prognosis)+"'";
			}
			if(procTP.Dx != oldProcTP.Dx) {
				if(command!=""){ command+=",";}
				command+="Dx = '"+POut.String(procTP.Dx)+"'";
			}
			if(command==""){
				return false;
			}
			command="UPDATE proctp SET "+command
				+" WHERE ProcTPNum = "+POut.Long(procTP.ProcTPNum);
			Db.NonQ(command);
			return true;
		}
Пример #24
0
        ///<summary>There are no dependencies.</summary>
        public static void Delete(ProcTP proc)
        {
            string command = "DELETE from proctp WHERE ProcTPNum = '" + POut.PInt(proc.ProcTPNum) + "'";

            General.NonQ(command);
        }
Пример #25
0
 ///<summary>Returns true if Update(ProcTP,ProcTP) 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(ProcTP procTP, ProcTP oldProcTP)
 {
     if (procTP.TreatPlanNum != oldProcTP.TreatPlanNum)
     {
         return(true);
     }
     if (procTP.PatNum != oldProcTP.PatNum)
     {
         return(true);
     }
     if (procTP.ProcNumOrig != oldProcTP.ProcNumOrig)
     {
         return(true);
     }
     if (procTP.ItemOrder != oldProcTP.ItemOrder)
     {
         return(true);
     }
     if (procTP.Priority != oldProcTP.Priority)
     {
         return(true);
     }
     if (procTP.ToothNumTP != oldProcTP.ToothNumTP)
     {
         return(true);
     }
     if (procTP.Surf != oldProcTP.Surf)
     {
         return(true);
     }
     if (procTP.ProcCode != oldProcTP.ProcCode)
     {
         return(true);
     }
     if (procTP.Descript != oldProcTP.Descript)
     {
         return(true);
     }
     if (procTP.FeeAmt != oldProcTP.FeeAmt)
     {
         return(true);
     }
     if (procTP.PriInsAmt != oldProcTP.PriInsAmt)
     {
         return(true);
     }
     if (procTP.SecInsAmt != oldProcTP.SecInsAmt)
     {
         return(true);
     }
     if (procTP.PatAmt != oldProcTP.PatAmt)
     {
         return(true);
     }
     if (procTP.Discount != oldProcTP.Discount)
     {
         return(true);
     }
     if (procTP.Prognosis != oldProcTP.Prognosis)
     {
         return(true);
     }
     if (procTP.Dx != oldProcTP.Dx)
     {
         return(true);
     }
     if (procTP.ProcAbbr != oldProcTP.ProcAbbr)
     {
         return(true);
     }
     //SecUserNumEntry excluded from update
     //SecDateEntry not allowed to change
     //SecDateTEdit can only be set by MySQL
     if (procTP.FeeAllowed != oldProcTP.FeeAllowed)
     {
         return(true);
     }
     return(false);
 }
Пример #26
0
        ///<summary>Updates one ProcTP 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(ProcTP procTP, ProcTP oldProcTP)
        {
            string command = "";

            if (procTP.TreatPlanNum != oldProcTP.TreatPlanNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TreatPlanNum = " + POut.Long(procTP.TreatPlanNum) + "";
            }
            if (procTP.PatNum != oldProcTP.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(procTP.PatNum) + "";
            }
            if (procTP.ProcNumOrig != oldProcTP.ProcNumOrig)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNumOrig = " + POut.Long(procTP.ProcNumOrig) + "";
            }
            if (procTP.ItemOrder != oldProcTP.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(procTP.ItemOrder) + "";
            }
            if (procTP.Priority != oldProcTP.Priority)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Priority = " + POut.Long(procTP.Priority) + "";
            }
            if (procTP.ToothNumTP != oldProcTP.ToothNumTP)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ToothNumTP = '" + POut.String(procTP.ToothNumTP) + "'";
            }
            if (procTP.Surf != oldProcTP.Surf)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Surf = '" + POut.String(procTP.Surf) + "'";
            }
            if (procTP.ProcCode != oldProcTP.ProcCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcCode = '" + POut.String(procTP.ProcCode) + "'";
            }
            if (procTP.Descript != oldProcTP.Descript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Descript = '" + POut.String(procTP.Descript) + "'";
            }
            if (procTP.FeeAmt != oldProcTP.FeeAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeAmt = '" + POut.Double(procTP.FeeAmt) + "'";
            }
            if (procTP.PriInsAmt != oldProcTP.PriInsAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PriInsAmt = '" + POut.Double(procTP.PriInsAmt) + "'";
            }
            if (procTP.SecInsAmt != oldProcTP.SecInsAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SecInsAmt = '" + POut.Double(procTP.SecInsAmt) + "'";
            }
            if (procTP.PatAmt != oldProcTP.PatAmt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatAmt = '" + POut.Double(procTP.PatAmt) + "'";
            }
            if (procTP.Discount != oldProcTP.Discount)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Discount = '" + POut.Double(procTP.Discount) + "'";
            }
            if (procTP.Prognosis != oldProcTP.Prognosis)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Prognosis = '" + POut.String(procTP.Prognosis) + "'";
            }
            if (procTP.Dx != oldProcTP.Dx)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Dx = '" + POut.String(procTP.Dx) + "'";
            }
            if (procTP.ProcAbbr != oldProcTP.ProcAbbr)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcAbbr = '" + POut.String(procTP.ProcAbbr) + "'";
            }
            //SecUserNumEntry excluded from update
            //SecDateEntry not allowed to change
            //SecDateTEdit can only be set by MySQL
            if (procTP.FeeAllowed != oldProcTP.FeeAllowed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeAllowed = '" + POut.Double(procTP.FeeAllowed) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE proctp SET " + command
                      + " WHERE ProcTPNum = " + POut.Long(procTP.ProcTPNum);
            Db.NonQ(command);
            return(true);
        }
Пример #27
0
 ///<summary>Inserts one ProcTP into the database.  Returns the new priKey.</summary>
 public static long Insert(ProcTP procTP)
 {
     return(Insert(procTP, false));
 }