コード例 #1
0
        ///<summary></summary>
        internal static void Insert(DocAttach attach)
        {
            if (PrefB.RandomKeys)
            {
                attach.DocAttachNum = MiscDataB.GetKey("docattach", "DocAttachNum");
            }
            string command = "INSERT INTO docattach (";

            if (PrefB.RandomKeys)
            {
                command += "DocAttachNum,";
            }
            command += "PatNum, DocNum) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(attach.DocAttachNum) + "', ";
            }
            command +=
                "'" + POut.PInt(attach.PatNum) + "', "
                + "'" + POut.PInt(attach.DocNum) + "')";
            DataConnection dcon = new DataConnection();

            if (PrefB.RandomKeys)
            {
                dcon.NonQ(command);
            }
            else
            {
                dcon.NonQ(command, true);
                attach.DocAttachNum = dcon.InsertID;
            }
        }
コード例 #2
0
        ///<summary></summary>
        public static int Insert(EmailMessage message)
        {
            if (PrefB.RandomKeys)
            {
                message.EmailMessageNum = MiscDataB.GetKey("emailmessage", "EmailMessageNum");
            }
            string command = "INSERT INTO emailmessage (";

            if (PrefB.RandomKeys)
            {
                command += "EmailMessageNum,";
            }
            command += "PatNum,ToAddress,FromAddress,Subject,BodyText,"
                       + "MsgDateTime,SentOrReceived) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(message.EmailMessageNum) + "', ";
            }
            command +=
                "'" + POut.PInt(message.PatNum) + "', "
                + "'" + POut.PString(message.ToAddress) + "', "
                + "'" + POut.PString(message.FromAddress) + "', "
                + "'" + POut.PString(message.Subject) + "', "
                + "'" + POut.PString(message.BodyText) + "', "
                + POut.PDateT(message.MsgDateTime) + ", "
                + "'" + POut.PInt((int)message.SentOrReceived) + "')";
            DataConnection dcon = new DataConnection();

            if (PrefB.RandomKeys)
            {
                dcon.NonQ(command);
            }
            else
            {
                dcon.NonQ(command, true);
                message.EmailMessageNum = dcon.InsertID;
            }
            //now, insert all the attaches.
            for (int i = 0; i < message.Attachments.Count; i++)
            {
                message.Attachments[i].EmailMessageNum = message.EmailMessageNum;
                EmailAttachB.Insert(message.Attachments[i]);
            }
            return(message.EmailMessageNum);
        }
コード例 #3
0
		internal static void Insert(EmailAttach attach){
			if(PrefB.RandomKeys) {
				attach.EmailAttachNum=MiscDataB.GetKey("emailattach","EmailAttachNum");
			}
			string command= "INSERT INTO emailattach (";
			if(PrefB.RandomKeys) {
				command+="EmailAttachNum,";
			}
			command+="EmailMessageNum, DisplayedFileName, ActualFileName) VALUES(";
			if(PrefB.RandomKeys) {
				command+="'"+POut.PInt(attach.EmailAttachNum)+"', ";
			}
			command+=
				 "'"+POut.PInt   (attach.EmailMessageNum)+"', "
				+"'"+POut.PString(attach.DisplayedFileName)+"', "
				+"'"+POut.PString(attach.ActualFileName)+"')";
			//MessageBox.Show(cmd.CommandText);
			DataConnection dcon=new DataConnection();
			dcon.NonQ(command);
		}
コード例 #4
0
ファイル: ProcNoteB.cs プロジェクト: luisurbinanet/apolloniax
        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());
        }
コード例 #5
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);
        }
コード例 #6
0
ファイル: DocumentB.cs プロジェクト: luisurbinanet/opendental
        ///<summary>Inserts a new document into db, creates a filename based on Cur.DocNum, and then updates the db with this filename.  Also attaches the document to the current patient.</summary>
        public static int Insert(Document doc, string patLF, int patNum)
        {
            if (PrefB.RandomKeys)
            {
                doc.DocNum = MiscDataB.GetKey("document", "DocNum");
            }
            string command = "INSERT INTO document (";

            if (PrefB.RandomKeys)
            {
                command += "DocNum,";
            }
            command += "Description,DateCreated,DocCategory,WithPat,FileName,ImgType,"
                       + "IsFlipped,DegreesRotated,ToothNumbers,Note,SigIsTopaz,Signature,CropX,CropY,CropW,CropH,"
                       + "WindowingMin,WindowingMax) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(doc.DocNum) + "', ";
            }
            command +=
                "'" + POut.PString(doc.Description) + "', "
                + POut.PDate(doc.DateCreated) + ", "
                + "'" + POut.PInt(doc.DocCategory) + "', "
                + "'" + POut.PInt(doc.WithPat) + "', "
                + "'" + POut.PString(doc.FileName) + "', "           //this may simply be the extension at this point, or it may be the full filename.
                + "'" + POut.PInt((int)doc.ImgType) + "', "
                + "'" + POut.PBool(doc.IsFlipped) + "', "
                + "'" + POut.PInt(doc.DegreesRotated) + "', "
                + "'" + POut.PString(doc.ToothNumbers) + "', "
                + "'" + POut.PString(doc.Note) + "', "
                + "'" + POut.PBool(doc.SigIsTopaz) + "', "
                + "'" + POut.PString(doc.Signature) + "',"
                + "'" + POut.PInt(doc.CropX) + "',"
                + "'" + POut.PInt(doc.CropY) + "',"
                + "'" + POut.PInt(doc.CropW) + "',"
                + "'" + POut.PInt(doc.CropH) + "',"
                + "'" + POut.PInt(doc.WindowingMin) + "',"
                + "'" + POut.PInt(doc.WindowingMax) + "')";

            /*+"'"+POut.PDate  (LastAltered)+"', "//will later be used in backups
             +"'"+POut.PBool  (IsDeleted)+"')";//ditto*/
            //MessageBox.Show(cmd.CommandText);
            DataConnection dcon = new DataConnection();

            if (PrefB.RandomKeys)
            {
                dcon.NonQ(command);
            }
            else
            {
                dcon.NonQ(command, true);
                doc.DocNum = dcon.InsertID;
            }
            //If the current filename is just an extension, then assign it a unique name.
            if (doc.FileName == Path.GetExtension(doc.FileName))
            {
                string extension = doc.FileName;
                doc.FileName = "";
                string s = patLF;              //pat.LName+pat.FName;
                for (int i = 0; i < s.Length; i++)
                {
                    if (Char.IsLetter(s, i))
                    {
                        doc.FileName += s.Substring(i, 1);
                    }
                }
                doc.FileName += doc.DocNum.ToString() + extension;            //ensures unique name
                //there is still a slight chance that someone manually added a file with this name, so quick fix:
                command = "SELECT FileName FROM document WHERE WithPat=" + POut.PInt(doc.WithPat);
                DataTable table     = dcon.GetTable(command);
                string[]  usedNames = new string[table.Rows.Count];
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    usedNames[i] = PIn.PString(table.Rows[i][0].ToString());
                }
                while (IsFileNameInList(doc.FileName, usedNames))
                {
                    doc.FileName = "x" + doc.FileName;
                }

                /*Document[] docList=GetAllWithPat(doc.WithPat);
                 * while(IsFileNameInList(doc.FileName,docList)) {
                 *      doc.FileName="x"+doc.FileName;
                 * }*/
                Update(doc);
            }
            DocAttach docAttach = new DocAttach();

            docAttach.DocNum = doc.DocNum;
            docAttach.PatNum = patNum;
            DocAttachB.Insert(docAttach);
            return(doc.DocNum);
        }