Ejemplo n.º 1
0
		///<summary>Updates only the changed columns.</summary>
		public static bool Update(Procedure procedure,Procedure oldProcedure) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetBool(MethodBase.GetCurrentMethod(),procedure,oldProcedure);
			}
			if(oldProcedure.ProcStatus!=ProcStat.C && procedure.ProcStatus==ProcStat.C && procedure.Discount!=0) {//Setting the procedure to complete
				Adjustments.CreateAdjustmentForDiscount(procedure);
			}
			if(oldProcedure.ProcStatus==ProcStat.C && procedure.ProcStatus!=ProcStat.C) {//Setting a completed procedure to TP
				Adjustments.DeleteForProcedure(procedure.ProcNum);
			}
			bool result=Crud.ProcedureCrud.Update(procedure,oldProcedure);
			if(procedure.Note!=oldProcedure.Note
				|| procedure.UserNum!=oldProcedure.UserNum
				|| procedure.SigIsTopaz!=oldProcedure.SigIsTopaz
				|| procedure.Signature!=oldProcedure.Signature) 
			{
				ProcNote note=new ProcNote();
				note.PatNum=procedure.PatNum;
				note.ProcNum=procedure.ProcNum;
				note.UserNum=procedure.UserNum;
				note.Note=procedure.Note;
				note.SigIsTopaz=procedure.SigIsTopaz;
				note.Signature=procedure.Signature;
				ProcNotes.Insert(note);
			}
			return result;
		}
Ejemplo n.º 2
0
		public static long Insert(ProcNote procNote){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				procNote.ProcNoteNum=Meth.GetLong(MethodBase.GetCurrentMethod(),procNote);
				return procNote.ProcNoteNum;
			}
			return Crud.ProcNoteCrud.Insert(procNote);
		}
Ejemplo n.º 3
0
 public static long Insert(ProcNote procNote)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         procNote.ProcNoteNum = Meth.GetLong(MethodBase.GetCurrentMethod(), procNote);
         return(procNote.ProcNoteNum);
     }
     return(Crud.ProcNoteCrud.Insert(procNote));
 }
Ejemplo n.º 4
0
		///<summary></summary>
		public static long Insert(Procedure procedure){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				procedure.ProcNum=Meth.GetLong(MethodBase.GetCurrentMethod(),procedure);
				return procedure.ProcNum;
			}
			Crud.ProcedureCrud.Insert(procedure);
			if(procedure.Note!="") {
				ProcNote note=new ProcNote();
				note.PatNum=procedure.PatNum;
				note.ProcNum=procedure.ProcNum;
				note.UserNum=procedure.UserNum;
				note.Note=procedure.Note;
				ProcNotes.Insert(note);
			}
			return procedure.ProcNum;
		}
Ejemplo n.º 5
0
		///<summary>Updates only the changed columns.</summary>
		public static void Update(Procedure procedure,Procedure oldProcedure) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),procedure,oldProcedure);
				return;
			}
			Crud.ProcedureCrud.Update(procedure,oldProcedure);
			if(procedure.Note!=oldProcedure.Note
				|| procedure.UserNum!=oldProcedure.UserNum
				|| procedure.SigIsTopaz!=oldProcedure.SigIsTopaz
				|| procedure.Signature!=oldProcedure.Signature) 
			{
				ProcNote note=new ProcNote();
				note.PatNum=procedure.PatNum;
				note.ProcNum=procedure.ProcNum;
				note.UserNum=procedure.UserNum;
				note.Note=procedure.Note;
				note.SigIsTopaz=procedure.SigIsTopaz;
				note.Signature=procedure.Signature;
				ProcNotes.Insert(note);
			}
		}
Ejemplo n.º 6
0
        internal static void Insert(ProcNote procNote)
        {
            if (PrefB.RandomKeys)
            {
                procNote.ProcNoteNum = MiscDataB.GetKey("procnote", "ProcNoteNum");
            }
            string command = "INSERT INTO procnote (";

            if (PrefB.RandomKeys)
            {
                command += "ProcNoteNum,";
            }
            command += "PatNum, ProcNum, EntryDateTime, UserNum, Note, SigIsTopaz, Signature) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(procNote.ProcNoteNum) + "', ";
            }
            command +=
                "'" + POut.PInt(procNote.PatNum) + "', "
                + "'" + POut.PInt(procNote.ProcNum) + "', ";
            if (DataConnection.DBtype == DatabaseType.Oracle)
            {
                command += POut.PDateT(MiscDataB.GetNowDateTime());
            }
            else              //Assume MySQL
            {
                command += "NOW()";
            }
            command += ", "          //EntryDateTime
                       + "'" + POut.PInt(procNote.UserNum) + "', "
                       + "'" + POut.PString(procNote.Note) + "', "
                       + "'" + POut.PBool(procNote.SigIsTopaz) + "', "
                       + "'" + POut.Base64(procNote.Signature) + "')";
            //MessageBox.Show(cmd.CommandText);
            DataConnection dcon = new DataConnection();

            dcon.NonQ(command);
            //Debug.WriteLine("Sig length: "+procNote.Signature.Length.ToString());
        }
Ejemplo n.º 7
0
        public static int Insert(Procedure proc)
        {
            if (PrefB.RandomKeys)
            {
                proc.ProcNum = MiscDataB.GetKey("procedurelog", "ProcNum");
            }
            string command = "INSERT INTO procedurelog (";

            if (PrefB.RandomKeys)
            {
                command += "ProcNum,";
            }
            command += "PatNum, AptNum, OldCode, ProcDate,ProcFee,Surf,"
                       + "ToothNum,ToothRange,Priority,ProcStatus,ProvNum,"
                       + "Dx,PlannedAptNum,PlaceService,Prosthesis,DateOriginalProsth,ClaimNote,"
                       + "DateEntryC,ClinicNum,MedicalCode,DiagnosticCode,IsPrincDiag,ProcNumLab,"
                       + "BillingTypeOne,BillingTypeTwo,CodeNum,CodeMod1,CodeMod2,CodeMod3,CodeMod4,RevCode,UnitCode,UnitQty,BaseUnits,StartTime,StopTime) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(proc.ProcNum) + "', ";
            }
            command +=
                "'" + POut.PInt(proc.PatNum) + "', "
                + "'" + POut.PInt(proc.AptNum) + "', "
                + "'" + POut.PString(proc.OldCode) + "', "
                + POut.PDate(proc.ProcDate) + ", "
                + "'" + POut.PDouble(proc.ProcFee) + "', "
                + "'" + POut.PString(proc.Surf) + "', "
                + "'" + POut.PString(proc.ToothNum) + "', "
                + "'" + POut.PString(proc.ToothRange) + "', "
                + "'" + POut.PInt(proc.Priority) + "', "
                + "'" + POut.PInt((int)proc.ProcStatus) + "', "
                + "'" + POut.PInt(proc.ProvNum) + "', "
                + "'" + POut.PInt(proc.Dx) + "', "
                + "'" + POut.PInt(proc.PlannedAptNum) + "', "
                + "'" + POut.PInt((int)proc.PlaceService) + "', "
                + "'" + POut.PString(proc.Prosthesis) + "', "
                + POut.PDate(proc.DateOriginalProsth) + ", "
                + "'" + POut.PString(proc.ClaimNote) + "', ";
            if (DataConnection.DBtype == DatabaseType.Oracle)
            {
                command += POut.PDateT(MiscDataB.GetNowDateTime());
            }
            else              //Assume MySQL
            {
                command += "NOW()";
            }
            command += ", "          //DateEntryC
                       + "'" + POut.PInt(proc.ClinicNum) + "', "
                       + "'" + POut.PString(proc.MedicalCode) + "', "
                       + "'" + POut.PString(proc.DiagnosticCode) + "', "
                       + "'" + POut.PBool(proc.IsPrincDiag) + "', "
                       + "'" + POut.PInt(proc.ProcNumLab) + "', "
                       + "'" + POut.PInt(proc.BillingTypeOne) + "', "
                       + "'" + POut.PInt(proc.BillingTypeTwo) + "', "
                       + "'" + POut.PInt(proc.CodeNum) + "', "
                       + "'" + POut.PString(proc.CodeMod1) + "', "
                       + "'" + POut.PString(proc.CodeMod2) + "', "
                       + "'" + POut.PString(proc.CodeMod3) + "', "
                       + "'" + POut.PString(proc.CodeMod4) + "', "
                       + "'" + POut.PString(proc.RevCode) + "', "
                       + "'" + POut.PString(proc.UnitCode) + "', "
                       + "'" + POut.PInt(proc.UnitQty) + "', "
                       + "'" + POut.PInt(proc.BaseUnits) + "', "
                       + "'" + POut.PInt(proc.StartTime) + "', "
                       + "'" + POut.PInt(proc.StopTime) + "')";
            //MessageBox.Show(cmd.CommandText);
            DataConnection dcon = new DataConnection();

            if (PrefB.RandomKeys)
            {
                dcon.NonQ(command);
            }
            else
            {
                dcon.NonQ(command, true);
                proc.ProcNum = dcon.InsertID;
            }
            if (proc.Note != "")
            {
                ProcNote note = new ProcNote();
                note.PatNum  = proc.PatNum;
                note.ProcNum = proc.ProcNum;
                note.UserNum = proc.UserNum;
                note.Note    = proc.Note;
                ProcNoteB.Insert(note);
            }
            return(proc.ProcNum);
        }
Ejemplo n.º 8
0
        ///<summary>Updates only the changed columns.</summary>
        public static int Update(Procedure proc, Procedure oldProc)
        {
            bool   comma = false;
            string c     = "UPDATE procedurelog SET ";

            if (proc.PatNum != oldProc.PatNum)
            {
                c    += "PatNum = '" + POut.PInt(proc.PatNum) + "'";
                comma = true;
            }
            if (proc.AptNum != oldProc.AptNum)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "AptNum = '" + POut.PInt(proc.AptNum) + "'";
                comma = true;
            }
            if (proc.OldCode != oldProc.OldCode)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "OldCode = '" + POut.PString(proc.OldCode) + "'";
                comma = true;
            }
            if (proc.ProcDate != oldProc.ProcDate)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ProcDate = " + POut.PDate(proc.ProcDate);
                comma = true;
            }
            if (proc.ProcFee != oldProc.ProcFee)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ProcFee = '" + POut.PDouble(proc.ProcFee) + "'";
                comma = true;
            }
            if (proc.Surf != oldProc.Surf)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "Surf = '" + POut.PString(proc.Surf) + "'";
                comma = true;
            }
            if (proc.ToothNum != oldProc.ToothNum)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ToothNum = '" + POut.PString(proc.ToothNum) + "'";
                comma = true;
            }
            if (proc.ToothRange != oldProc.ToothRange)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ToothRange = '" + POut.PString(proc.ToothRange) + "'";
                comma = true;
            }
            if (proc.Priority != oldProc.Priority)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "Priority = '" + POut.PInt(proc.Priority) + "'";
                comma = true;
            }
            if (proc.ProcStatus != oldProc.ProcStatus)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ProcStatus = '" + POut.PInt((int)proc.ProcStatus) + "'";
                comma = true;
            }
            if (proc.ProvNum != oldProc.ProvNum)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ProvNum = '" + POut.PInt(proc.ProvNum) + "'";
                comma = true;
            }
            if (proc.Dx != oldProc.Dx)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "Dx = '" + POut.PInt(proc.Dx) + "'";
                comma = true;
            }
            if (proc.PlannedAptNum != oldProc.PlannedAptNum)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "PlannedAptNum = '" + POut.PInt(proc.PlannedAptNum) + "'";
                comma = true;
            }
            if (proc.PlaceService != oldProc.PlaceService)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "PlaceService = '" + POut.PInt((int)proc.PlaceService) + "'";
                comma = true;
            }
            if (proc.Prosthesis != oldProc.Prosthesis)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "Prosthesis = '" + POut.PString(proc.Prosthesis) + "'";
                comma = true;
            }
            if (proc.DateOriginalProsth != oldProc.DateOriginalProsth)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "DateOriginalProsth = " + POut.PDate(proc.DateOriginalProsth);
                comma = true;
            }
            if (proc.ClaimNote != oldProc.ClaimNote)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ClaimNote = '" + POut.PString(proc.ClaimNote) + "'";
                comma = true;
            }
            if (proc.DateEntryC != oldProc.DateEntryC)
            {
                if (comma)
                {
                    c += ",";
                }
                c += "DateEntryC = ";
                if (DataConnection.DBtype == DatabaseType.Oracle)
                {
                    c += POut.PDateT(MiscDataB.GetNowDateTime());
                }
                else                  //Assume MySQL
                {
                    c += "NOW()";
                }
                comma = true;
            }
            if (proc.ClinicNum != oldProc.ClinicNum)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ClinicNum = '" + POut.PInt(proc.ClinicNum) + "'";
                comma = true;
            }
            if (proc.MedicalCode != oldProc.MedicalCode)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "MedicalCode = '" + POut.PString(proc.MedicalCode) + "'";
                comma = true;
            }
            if (proc.DiagnosticCode != oldProc.DiagnosticCode)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "DiagnosticCode = '" + POut.PString(proc.DiagnosticCode) + "'";
                comma = true;
            }
            if (proc.IsPrincDiag != oldProc.IsPrincDiag)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "IsPrincDiag = '" + POut.PBool(proc.IsPrincDiag) + "'";
                comma = true;
            }
            if (proc.ProcNumLab != oldProc.ProcNumLab)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "ProcNumLab = '" + POut.PInt(proc.ProcNumLab) + "'";
                comma = true;
            }
            if (proc.BillingTypeOne != oldProc.BillingTypeOne)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "BillingTypeOne = '" + POut.PInt(proc.BillingTypeOne) + "'";
                comma = true;
            }
            if (proc.BillingTypeTwo != oldProc.BillingTypeTwo)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "BillingTypeTwo = '" + POut.PInt(proc.BillingTypeTwo) + "'";
                comma = true;
            }
            if (proc.CodeNum != oldProc.CodeNum)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "CodeNum = '" + POut.PInt(proc.CodeNum) + "'";
                comma = true;
            }
            if (proc.CodeMod1 != oldProc.CodeMod1)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "CodeMod1 = '" + POut.PString(proc.CodeMod1) + "'";
                comma = true;
            }
            if (proc.CodeMod2 != oldProc.CodeMod2)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "CodeMod2 = '" + POut.PString(proc.CodeMod2) + "'";
                comma = true;
            }
            if (proc.CodeMod3 != oldProc.CodeMod3)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "CodeMod3 = '" + POut.PString(proc.CodeMod3) + "'";
                comma = true;
            }
            if (proc.CodeMod4 != oldProc.CodeMod4)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "CodeMod4 = '" + POut.PString(proc.CodeMod4) + "'";
                comma = true;
            }
            if (proc.RevCode != oldProc.RevCode)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "RevCode = '" + POut.PString(proc.RevCode) + "'";
                comma = true;
            }
            if (proc.UnitCode != oldProc.UnitCode)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "UnitCode = '" + POut.PString(proc.UnitCode) + "'";
                comma = true;
            }
            if (proc.UnitQty != oldProc.UnitQty)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "UnitQty = '" + POut.PInt(proc.UnitQty) + "'";
                comma = true;
            }
            if (proc.BaseUnits != oldProc.BaseUnits)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "BaseUnits = '" + POut.PInt(proc.BaseUnits) + "'";
                comma = true;
            }
            if (proc.StartTime != oldProc.StartTime)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "StartTime = '" + POut.PInt(proc.StartTime) + "'";
                comma = true;
            }
            if (proc.StopTime != oldProc.StopTime)
            {
                if (comma)
                {
                    c += ",";
                }
                c    += "StopTime = '" + POut.PInt(proc.StopTime) + "'";
                comma = true;
            }
            int rowsChanged = 0;

            if (comma)
            {
                c += " WHERE ProcNum = '" + POut.PInt(proc.ProcNum) + "'";
                DataConnection dcon = new DataConnection();
                rowsChanged = dcon.NonQ(c);
            }
            else
            {
                //rowsChanged=0;//this means no change is actually required.
            }
            if (proc.Note != oldProc.Note ||
                proc.UserNum != oldProc.UserNum ||
                proc.SigIsTopaz != oldProc.SigIsTopaz ||
                proc.Signature != oldProc.Signature)
            {
                ProcNote note = new ProcNote();
                note.PatNum     = proc.PatNum;
                note.ProcNum    = proc.ProcNum;
                note.UserNum    = proc.UserNum;
                note.Note       = proc.Note;
                note.SigIsTopaz = proc.SigIsTopaz;
                note.Signature  = proc.Signature;
                ProcNoteB.Insert(note);
            }
            return(rowsChanged);
        }