コード例 #1
0
        ///<summary>Updates one TimeCardRule 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>
        public static void Update(TimeCardRule timeCardRule, TimeCardRule oldTimeCardRule)
        {
            string command = "";

            if (timeCardRule.EmployeeNum != oldTimeCardRule.EmployeeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmployeeNum = " + POut.Long(timeCardRule.EmployeeNum) + "";
            }
            if (timeCardRule.OverHoursPerDay != oldTimeCardRule.OverHoursPerDay)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OverHoursPerDay = " + POut.Time(timeCardRule.OverHoursPerDay) + "";
            }
            if (timeCardRule.AfterTimeOfDay != oldTimeCardRule.AfterTimeOfDay)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AfterTimeOfDay = " + POut.Time(timeCardRule.AfterTimeOfDay) + "";
            }
            if (timeCardRule.BeforeTimeOfDay != oldTimeCardRule.BeforeTimeOfDay)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BeforeTimeOfDay = " + POut.Time(timeCardRule.BeforeTimeOfDay) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE timecardrule SET " + command
                      + " WHERE TimeCardRuleNum = " + POut.Long(timeCardRule.TimeCardRuleNum);
            Db.NonQ(command);
        }
コード例 #2
0
        ///<summary>Converts a list of ApptView into a DataTable.</summary>
        public static DataTable ListToTable(List <ApptView> listApptViews, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "ApptView";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("ApptViewNum");
            table.Columns.Add("Description");
            table.Columns.Add("ItemOrder");
            table.Columns.Add("RowsPerIncr");
            table.Columns.Add("OnlyScheduledProvs");
            table.Columns.Add("OnlySchedBeforeTime");
            table.Columns.Add("OnlySchedAfterTime");
            table.Columns.Add("StackBehavUR");
            table.Columns.Add("StackBehavLR");
            table.Columns.Add("ClinicNum");
            table.Columns.Add("ApptTimeScrollStart");
            table.Columns.Add("IsScrollStartDynamic");
            table.Columns.Add("IsApptBubblesDisabled");
            table.Columns.Add("WidthOpMinimum");
            foreach (ApptView apptView in listApptViews)
            {
                table.Rows.Add(new object[] {
                    POut.Long(apptView.ApptViewNum),
                    apptView.Description,
                    POut.Int(apptView.ItemOrder),
                    POut.Byte(apptView.RowsPerIncr),
                    POut.Bool(apptView.OnlyScheduledProvs),
                    POut.Time(apptView.OnlySchedBeforeTime, false),
                    POut.Time(apptView.OnlySchedAfterTime, false),
                    POut.Int((int)apptView.StackBehavUR),
                    POut.Int((int)apptView.StackBehavLR),
                    POut.Long(apptView.ClinicNum),
                    POut.Time(apptView.ApptTimeScrollStart, false),
                    POut.Bool(apptView.IsScrollStartDynamic),
                    POut.Bool(apptView.IsApptBubblesDisabled),
                    POut.Int(apptView.WidthOpMinimum),
                });
            }
            return(table);
        }
コード例 #3
0
        ///<summary>Updates one ApptView in the database.</summary>
        public static void Update(ApptView apptView)
        {
            string command = "UPDATE apptview SET "
                             + "Description          = '" + POut.String(apptView.Description) + "', "
                             + "ItemOrder            =  " + POut.Int(apptView.ItemOrder) + ", "
                             + "RowsPerIncr          =  " + POut.Byte(apptView.RowsPerIncr) + ", "
                             + "OnlyScheduledProvs   =  " + POut.Bool(apptView.OnlyScheduledProvs) + ", "
                             + "OnlySchedBeforeTime  =  " + POut.Time(apptView.OnlySchedBeforeTime) + ", "
                             + "OnlySchedAfterTime   =  " + POut.Time(apptView.OnlySchedAfterTime) + ", "
                             + "StackBehavUR         =  " + POut.Int((int)apptView.StackBehavUR) + ", "
                             + "StackBehavLR         =  " + POut.Int((int)apptView.StackBehavLR) + ", "
                             + "ClinicNum            =  " + POut.Long(apptView.ClinicNum) + ", "
                             + "ApptTimeScrollStart  =  " + POut.Time(apptView.ApptTimeScrollStart) + ", "
                             + "IsScrollStartDynamic =  " + POut.Bool(apptView.IsScrollStartDynamic) + ", "
                             + "IsApptBubblesDisabled=  " + POut.Bool(apptView.IsApptBubblesDisabled) + " "
                             + "WHERE ApptViewNum = " + POut.Long(apptView.ApptViewNum);

            Db.NonQ(command);
        }
コード例 #4
0
        ///<summary>Inserts one ApptView into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ApptView apptView, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO apptview (";

            if (!useExistingPK && isRandomKeys)
            {
                apptView.ApptViewNum = ReplicationServers.GetKeyNoCache("apptview", "ApptViewNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ApptViewNum,";
            }
            command += "Description,ItemOrder,RowsPerIncr,OnlyScheduledProvs,OnlySchedBeforeTime,OnlySchedAfterTime,StackBehavUR,StackBehavLR,ClinicNum,ApptTimeScrollStart,IsScrollStartDynamic,IsApptBubblesDisabled,WidthOpMinimum) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(apptView.ApptViewNum) + ",";
            }
            command +=
                "'" + POut.String(apptView.Description) + "',"
                + POut.Int(apptView.ItemOrder) + ","
                + POut.Byte(apptView.RowsPerIncr) + ","
                + POut.Bool(apptView.OnlyScheduledProvs) + ","
                + POut.Time(apptView.OnlySchedBeforeTime) + ","
                + POut.Time(apptView.OnlySchedAfterTime) + ","
                + POut.Int((int)apptView.StackBehavUR) + ","
                + POut.Int((int)apptView.StackBehavLR) + ","
                + POut.Long(apptView.ClinicNum) + ","
                + POut.Time(apptView.ApptTimeScrollStart) + ","
                + POut.Bool(apptView.IsScrollStartDynamic) + ","
                + POut.Bool(apptView.IsApptBubblesDisabled) + ","
                + POut.Int(apptView.WidthOpMinimum) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                apptView.ApptViewNum = Db.NonQ(command, true, "ApptViewNum", "apptView");
            }
            return(apptView.ApptViewNum);
        }
コード例 #5
0
ファイル: ScheduleCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Converts a list of Schedule into a DataTable.</summary>
        public static DataTable ListToTable(List <Schedule> listSchedules, string tableName = "")
        {
            if (string.IsNullOrEmpty(tableName))
            {
                tableName = "Schedule";
            }
            DataTable table = new DataTable(tableName);

            table.Columns.Add("ScheduleNum");
            table.Columns.Add("SchedDate");
            table.Columns.Add("StartTime");
            table.Columns.Add("StopTime");
            table.Columns.Add("SchedType");
            table.Columns.Add("ProvNum");
            table.Columns.Add("BlockoutType");
            table.Columns.Add("Note");
            table.Columns.Add("Status");
            table.Columns.Add("EmployeeNum");
            table.Columns.Add("DateTStamp");
            table.Columns.Add("ClinicNum");
            foreach (Schedule schedule in listSchedules)
            {
                table.Rows.Add(new object[] {
                    POut.Long(schedule.ScheduleNum),
                    POut.DateT(schedule.SchedDate, false),
                    POut.Time(schedule.StartTime),
                    POut.Time(schedule.StopTime),
                    POut.Int((int)schedule.SchedType),
                    POut.Long(schedule.ProvNum),
                    POut.Long(schedule.BlockoutType),
                    schedule.Note,
                    POut.Int((int)schedule.Status),
                    POut.Long(schedule.EmployeeNum),
                    POut.DateT(schedule.DateTStamp, false),
                    POut.Long(schedule.ClinicNum),
                });
            }
            return(table);
        }
コード例 #6
0
ファイル: ScheduleCrud.cs プロジェクト: nampn/ODental
        ///<summary>Inserts one Schedule into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(Schedule schedule, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                schedule.ScheduleNum = ReplicationServers.GetKey("schedule", "ScheduleNum");
            }
            string command = "INSERT INTO schedule (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ScheduleNum,";
            }
            command += "SchedDate,StartTime,StopTime,SchedType,ProvNum,BlockoutType,Note,Status,EmployeeNum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(schedule.ScheduleNum) + ",";
            }
            command +=
                POut.Date(schedule.SchedDate) + ","
                + POut.Time(schedule.StartTime) + ","
                + POut.Time(schedule.StopTime) + ","
                + POut.Int((int)schedule.SchedType) + ","
                + POut.Long(schedule.ProvNum) + ","
                + POut.Long(schedule.BlockoutType) + ","
                + "'" + POut.String(schedule.Note) + "',"
                + POut.Int((int)schedule.Status) + ","
                + POut.Long(schedule.EmployeeNum) + ")";
            //DateTStamp can only be set by MySQL
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                schedule.ScheduleNum = Db.NonQ(command, true);
            }
            return(schedule.ScheduleNum);
        }
コード例 #7
0
        ///<summary>Inserts one ApptView into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(ApptView apptView, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                apptView.ApptViewNum = ReplicationServers.GetKey("apptview", "ApptViewNum");
            }
            string command = "INSERT INTO apptview (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ApptViewNum,";
            }
            command += "Description,ItemOrder,RowsPerIncr,OnlyScheduledProvs,OnlySchedBeforeTime,OnlySchedAfterTime,StackBehavUR,StackBehavLR,ClinicNum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(apptView.ApptViewNum) + ",";
            }
            command +=
                "'" + POut.String(apptView.Description) + "',"
                + POut.Int(apptView.ItemOrder) + ","
                + POut.Byte(apptView.RowsPerIncr) + ","
                + POut.Bool(apptView.OnlyScheduledProvs) + ","
                + POut.Time(apptView.OnlySchedBeforeTime) + ","
                + POut.Time(apptView.OnlySchedAfterTime) + ","
                + POut.Int((int)apptView.StackBehavUR) + ","
                + POut.Int((int)apptView.StackBehavLR) + ","
                + POut.Long(apptView.ClinicNum) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                apptView.ApptViewNum = Db.NonQ(command, true);
            }
            return(apptView.ApptViewNum);
        }
コード例 #8
0
ファイル: ScheduleCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Updates one Schedule in the database.</summary>
        public static void Update(Schedule schedule)
        {
            string command = "UPDATE schedule SET "
                             + "SchedDate   =  " + POut.Date(schedule.SchedDate) + ", "
                             + "StartTime   =  " + POut.Time(schedule.StartTime) + ", "
                             + "StopTime    =  " + POut.Time(schedule.StopTime) + ", "
                             + "SchedType   =  " + POut.Int((int)schedule.SchedType) + ", "
                             + "ProvNum     =  " + POut.Long(schedule.ProvNum) + ", "
                             + "BlockoutType=  " + POut.Long(schedule.BlockoutType) + ", "
                             + "Note        =  " + DbHelper.ParamChar + "paramNote, "
                             + "Status      =  " + POut.Int((int)schedule.Status) + ", "
                             + "EmployeeNum =  " + POut.Long(schedule.EmployeeNum) + ", "
                             //DateTStamp can only be set by MySQL
                             + "ClinicNum   =  " + POut.Long(schedule.ClinicNum) + " "
                             + "WHERE ScheduleNum = " + POut.Long(schedule.ScheduleNum);

            if (schedule.Note == null)
            {
                schedule.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(schedule.Note));

            Db.NonQ(command, paramNote);
        }
コード例 #9
0
        ///<summary>Updates one Patient in the database.</summary>
        public static void Update(Patient patient)
        {
            string command = "UPDATE patient SET "
                             + "LName                    = '" + POut.String(patient.LName) + "', "
                             + "FName                    = '" + POut.String(patient.FName) + "', "
                             + "MiddleI                  = '" + POut.String(patient.MiddleI) + "', "
                             + "Preferred                = '" + POut.String(patient.Preferred) + "', "
                             + "PatStatus                =  " + POut.Int((int)patient.PatStatus) + ", "
                             + "Gender                   =  " + POut.Int((int)patient.Gender) + ", "
                             + "Position                 =  " + POut.Int((int)patient.Position) + ", "
                             + "Birthdate                =  " + POut.Date(patient.Birthdate) + ", "
                             + "SSN                      = '" + POut.String(patient.SSN) + "', "
                             + "Address                  = '" + POut.String(patient.Address) + "', "
                             + "Address2                 = '" + POut.String(patient.Address2) + "', "
                             + "City                     = '" + POut.String(patient.City) + "', "
                             + "State                    = '" + POut.String(patient.State) + "', "
                             + "Zip                      = '" + POut.String(patient.Zip) + "', "
                             + "HmPhone                  = '" + POut.String(patient.HmPhone) + "', "
                             + "WkPhone                  = '" + POut.String(patient.WkPhone) + "', "
                             + "WirelessPhone            = '" + POut.String(patient.WirelessPhone) + "', "
                             + "Guarantor                =  " + POut.Long(patient.Guarantor) + ", "
                             + "CreditType               = '" + POut.String(patient.CreditType) + "', "
                             + "Email                    = '" + POut.String(patient.Email) + "', "
                             + "Salutation               = '" + POut.String(patient.Salutation) + "', "
                             + "EstBalance               = '" + POut.Double(patient.EstBalance) + "', "
                             + "PriProv                  =  " + POut.Long(patient.PriProv) + ", "
                             + "SecProv                  =  " + POut.Long(patient.SecProv) + ", "
                             + "FeeSched                 =  " + POut.Long(patient.FeeSched) + ", "
                             + "BillingType              =  " + POut.Long(patient.BillingType) + ", "
                             + "ImageFolder              = '" + POut.String(patient.ImageFolder) + "', "
                             + "AddrNote                 = '" + POut.String(patient.AddrNote) + "', "
                             + "FamFinUrgNote            = '" + POut.String(patient.FamFinUrgNote) + "', "
                             + "MedUrgNote               = '" + POut.String(patient.MedUrgNote) + "', "
                             + "ApptModNote              = '" + POut.String(patient.ApptModNote) + "', "
                             + "StudentStatus            = '" + POut.String(patient.StudentStatus) + "', "
                             + "SchoolName               = '" + POut.String(patient.SchoolName) + "', "
                             + "ChartNumber              = '" + POut.String(patient.ChartNumber) + "', "
                             + "MedicaidID               = '" + POut.String(patient.MedicaidID) + "', "
                             + "Bal_0_30                 = '" + POut.Double(patient.Bal_0_30) + "', "
                             + "Bal_31_60                = '" + POut.Double(patient.Bal_31_60) + "', "
                             + "Bal_61_90                = '" + POut.Double(patient.Bal_61_90) + "', "
                             + "BalOver90                = '" + POut.Double(patient.BalOver90) + "', "
                             + "InsEst                   = '" + POut.Double(patient.InsEst) + "', "
                             + "BalTotal                 = '" + POut.Double(patient.BalTotal) + "', "
                             + "EmployerNum              =  " + POut.Long(patient.EmployerNum) + ", "
                             + "EmploymentNote           = '" + POut.String(patient.EmploymentNote) + "', "
                             + "Race                     =  " + POut.Int((int)patient.Race) + ", "
                             + "County                   = '" + POut.String(patient.County) + "', "
                             + "GradeLevel               =  " + POut.Int((int)patient.GradeLevel) + ", "
                             + "Urgency                  =  " + POut.Int((int)patient.Urgency) + ", "
                             + "DateFirstVisit           =  " + POut.Date(patient.DateFirstVisit) + ", "
                             + "ClinicNum                =  " + POut.Long(patient.ClinicNum) + ", "
                             + "HasIns                   = '" + POut.String(patient.HasIns) + "', "
                             + "TrophyFolder             = '" + POut.String(patient.TrophyFolder) + "', "
                             + "PlannedIsDone            =  " + POut.Bool(patient.PlannedIsDone) + ", "
                             + "Premed                   =  " + POut.Bool(patient.Premed) + ", "
                             + "Ward                     = '" + POut.String(patient.Ward) + "', "
                             + "PreferConfirmMethod      =  " + POut.Int((int)patient.PreferConfirmMethod) + ", "
                             + "PreferContactMethod      =  " + POut.Int((int)patient.PreferContactMethod) + ", "
                             + "PreferRecallMethod       =  " + POut.Int((int)patient.PreferRecallMethod) + ", "
                             + "SchedBeforeTime          =  " + POut.Time(patient.SchedBeforeTime) + ", "
                             + "SchedAfterTime           =  " + POut.Time(patient.SchedAfterTime) + ", "
                             + "SchedDayOfWeek           =  " + POut.Byte(patient.SchedDayOfWeek) + ", "
                             + "Language                 = '" + POut.String(patient.Language) + "', "
                             + "AdmitDate                =  " + POut.Date(patient.AdmitDate) + ", "
                             + "Title                    = '" + POut.String(patient.Title) + "', "
                             + "PayPlanDue               = '" + POut.Double(patient.PayPlanDue) + "', "
                             + "SiteNum                  =  " + POut.Long(patient.SiteNum) + ", "
                             //DateTStamp can only be set by MySQL
                             + "ResponsParty             =  " + POut.Long(patient.ResponsParty) + ", "
                             + "CanadianEligibilityCode  =  " + POut.Byte(patient.CanadianEligibilityCode) + ", "
                             + "AskToArriveEarly         =  " + POut.Int(patient.AskToArriveEarly) + ", "
                             + "OnlinePassword           = '******', "
                             + "PreferContactConfidential=  " + POut.Int((int)patient.PreferContactConfidential) + ", "
                             + "SuperFamily              =  " + POut.Long(patient.SuperFamily) + ", "
                             + "TxtMsgOk                 =  " + POut.Int((int)patient.TxtMsgOk) + ", "
                             + "SmokingSnoMed            = '" + POut.String(patient.SmokingSnoMed) + "', "
                             + "Country                  = '" + POut.String(patient.Country) + "', "
                             + "DateTimeDeceased         =  " + POut.DateT(patient.DateTimeDeceased) + " "
                             + "WHERE PatNum = " + POut.Long(patient.PatNum);

            Db.NonQ(command);
        }
コード例 #10
0
ファイル: CoreTypesT.cs プロジェクト: ChemBrain/OpenDental
        /// <summary></summary>
        public static string RunAll()
        {
            string retVal = "";
            //Things that we might later add to this series of tests:
            //Special column types such as timestamp
            //Computer set to other region, affecting string parsing of types such dates and decimals
            //Test types without casting back and forth to strings.
            //Retrieval using a variety of techniques, such as getting a table, scalar, and reading a row.
            //Blobs
            string    command = "";
            DataTable table;
            TimeSpan  timespan;
            TimeSpan  timespan2;
            string    varchar1;
            string    varchar2;

            //timespan(timeOfDay)----------------------------------------------------------------------------------------------
            timespan = new TimeSpan(1, 2, 3);        //1hr,2min,3sec
            command  = "INSERT INTO tempcore (TimeOfDayTest) VALUES (" + POut.Time(timespan) + ")";
            DataCore.NonQ(command);
            command   = "SELECT TimeOfDayTest FROM tempcore";
            table     = DataCore.GetTable(command);
            timespan2 = PIn.Time(table.Rows[0]["TimeOfDayTest"].ToString());
            if (timespan != timespan2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "TimeSpan (time of day): Passed.\r\n";
            //timespan, negative------------------------------------------------------------------------------------
            timespan = new TimeSpan(0, -36, 0);        //This particular timespan value was found to fail in mysql with the old connector.
            //Don't know what's so special about this one value.  There are probably other values failing as well, but it doesn't matter.
            //Oracle does not seem to like negative values.
            command = "INSERT INTO tempcore (TimeSpanTest) VALUES ('" + POut.TSpan(timespan) + "')";
            DataCore.NonQ(command);
            command = "SELECT TimeSpanTest FROM tempcore";
            table   = DataCore.GetTable(command);
            string tempVal = table.Rows[0]["TimeSpanTest"].ToString();

            timespan2 = PIn.TSpan(tempVal);
            if (timespan != timespan2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "TimeSpan, negative: Passed.\r\n";
            //timespan, over 24 hours-----------------------------------------------------------------------------
            timespan = new TimeSpan(432, 5, 17);
            command  = "INSERT INTO tempcore (TimeSpanTest) VALUES ('" + POut.TSpan(timespan) + "')";
            DataCore.NonQ(command);
            command   = "SELECT TimeSpanTest FROM tempcore";
            table     = DataCore.GetTable(command);
            timespan2 = PIn.TSpan(table.Rows[0]["TimeSpanTest"].ToString());
            if (timespan != timespan2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "TimeSpan, large: Passed.\r\n";
            //date----------------------------------------------------------------------------------------------
            DateTime date1;
            DateTime date2;

            date1   = new DateTime(2003, 5, 23);
            command = "INSERT INTO tempcore (DateTest) VALUES (" + POut.Date(date1) + ")";
            DataCore.NonQ(command);
            command = "SELECT DateTest FROM tempcore";
            table   = DataCore.GetTable(command);
            date2   = PIn.Date(table.Rows[0]["DateTest"].ToString());
            if (date1 != date2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Date: Passed.\r\n";
            //datetime------------------------------------------------------------------------------------------
            DateTime datet1;
            DateTime datet2;

            datet1  = new DateTime(2003, 5, 23, 10, 18, 0);
            command = "INSERT INTO tempcore (DateTimeTest) VALUES (" + POut.DateT(datet1) + ")";
            DataCore.NonQ(command);
            command = "SELECT DateTimeTest FROM tempcore";
            table   = DataCore.GetTable(command);
            datet2  = PIn.DateT(table.Rows[0]["DateTimeTest"].ToString());
            if (datet1 != datet2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Date/Time: Passed.\r\n";
            //currency------------------------------------------------------------------------------------------
            double double1;
            double double2;

            double1 = 12.34d;
            command = "INSERT INTO tempcore (CurrencyTest) VALUES (" + POut.Double(double1) + ")";
            DataCore.NonQ(command);
            command = "SELECT CurrencyTest FROM tempcore";
            table   = DataCore.GetTable(command);
            double2 = PIn.Double(table.Rows[0]["CurrencyTest"].ToString());
            if (double1 != double2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Currency: Passed.\r\n";
            //group_concat------------------------------------------------------------------------------------
            command = "INSERT INTO tempgroupconcat VALUES ('name1')";
            DataCore.NonQ(command);
            command = "INSERT INTO tempgroupconcat VALUES ('name2')";
            DataCore.NonQ(command);
            command = "SELECT " + DbHelper.GroupConcat("Names") + " allnames FROM tempgroupconcat";
            table   = DataCore.GetTable(command);
            string allnames = PIn.ByteArray(table.Rows[0]["allnames"].ToString());

            //if(DataConnection.DBtype==DatabaseType.Oracle) {
            //	allnames=allnames.TrimEnd(',');//known issue.  Should already be fixed:
            //Use RTRIM(REPLACE(REPLACE(XMLAgg(XMLElement("x",column_name)),'<x>'),'</x>',','))
            //}
            if (allnames != "name1,name2")
            {
                throw new Exception();
            }
            command = "DELETE FROM tempgroupconcat";
            DataCore.NonQ(command);
            retVal += "Group_concat: Passed.\r\n";
            //bool,pos------------------------------------------------------------------------------------
            bool bool1;
            bool bool2;

            bool1   = true;
            command = "INSERT INTO tempcore (BoolTest) VALUES (" + POut.Bool(bool1) + ")";
            DataCore.NonQ(command);
            command = "SELECT BoolTest FROM tempcore";
            table   = DataCore.GetTable(command);
            bool2   = PIn.Bool(table.Rows[0]["BoolTest"].ToString());
            if (bool1 != bool2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Bool, true: Passed.\r\n";
            //bool,neg------------------------------------------------------------------------------------
            bool1   = false;
            command = "INSERT INTO tempcore (BoolTest) VALUES (" + POut.Bool(bool1) + ")";
            DataCore.NonQ(command);
            command = "SELECT BoolTest FROM tempcore";
            table   = DataCore.GetTable(command);
            bool2   = PIn.Bool(table.Rows[0]["BoolTest"].ToString());
            if (bool1 != bool2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Bool, false: Passed.\r\n";
            //varchar255 Nonstandard Characters-----------------------------------------------------------
            varchar1 = @"'!@#$%^&*()-+[{]}\`~,<.>/?'"";:=_" + "\r\n\t";
            varchar2 = "";
            command  = "INSERT INTO tempcore (TextTinyTest) VALUES ('" + POut.String(varchar1) + "')";
            DataCore.NonQ(command);
            command  = "SELECT TextTinyTest FROM tempcore";
            table    = DataCore.GetTable(command);
            varchar2 = PIn.String(table.Rows[0]["TextTinyTest"].ToString());
            if (varchar1 != varchar2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "VarChar(255): Passed.\r\n";
            //VARCHAR2(4000)------------------------------------------------------------------------------
            varchar1 = CreateRandomAlphaNumericString(4000);           //Tested 4001 and it was too large as expected.
            command  = "INSERT INTO tempcore (TextSmallTest) VALUES ('" + POut.String(varchar1) + "')";
            DataCore.NonQ(command);
            command  = "SELECT TextSmallTest FROM tempcore";
            table    = DataCore.GetTable(command);
            varchar2 = PIn.String(table.Rows[0]["TextSmallTest"].ToString());
            if (varchar1 != varchar2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "VarChar2(4000): Passed.\r\n";
            //clob:-----------------------------------------------------------------------------------------
            //tested up to 20MB in oracle.  (50MB however was failing: Chunk size error)
            //mysql mediumtext maxes out at about 16MB.
            string         clobstring1 = CreateRandomAlphaNumericString(10485760);   //10MB should be larger than anything we store.
            string         clobstring2 = "";
            OdSqlParameter param       = new OdSqlParameter("param1", OdDbType.Text, clobstring1);

            command = "INSERT INTO tempcore (TextLargeTest) VALUES (" + DbHelper.ParamChar + "param1)";
            DataCore.NonQ(command, param);
            command     = "SELECT TextLargeTest FROM tempcore";
            table       = DataCore.GetTable(command);
            clobstring2 = PIn.String(table.Rows[0]["TextLargeTest"].ToString());
            if (clobstring1 != clobstring2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Clob, Alpha-Numeric 10MB: Passed.\r\n";
            //clob:non-standard----------------------------------------------------------------------------------
            clobstring1 = CreateRandomNonStandardString(8000000);           //8MB is the max because many chars takes 2 bytes, and mysql maxes out at 16MB
            clobstring2 = "";
            param       = new OdSqlParameter("param1", OdDbType.Text, clobstring1);
            command     = "INSERT INTO tempcore (TextLargeTest) VALUES (" + DbHelper.ParamChar + "param1)";
            DataCore.NonQ(command, param);
            command     = "SELECT TextLargeTest FROM tempcore";
            table       = DataCore.GetTable(command);
            clobstring2 = PIn.String(table.Rows[0]["TextLargeTest"].ToString());
            if (clobstring1 != clobstring2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Clob, Symbols and Chinese: Passed.\r\n";
            //clob:Rick Roller----------------------------------------------------------------------------------
            clobstring1 = RickRoller(10485760);           //10MB should be larger than anything we store.
            clobstring2 = "";
            param       = new OdSqlParameter("param1", OdDbType.Text, clobstring1);
            command     = "INSERT INTO tempcore (TextLargeTest) VALUES (" + DbHelper.ParamChar + "param1)";
            DataCore.NonQ(command, param);
            command     = "SELECT TextLargeTest FROM tempcore";
            table       = DataCore.GetTable(command);
            clobstring2 = PIn.String(table.Rows[0]["TextLargeTest"].ToString());
            if (clobstring1 != clobstring2)
            {
                throw new Exception();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Clob, Rick Roller: Passed.\r\n";
            //SHOW CREATE TABLE -----------------------------------------------------------------------
            //This command is needed in order to perform a backup.
            if (DataConnection.DBtype == DatabaseType.MySql)
            {
                command = "SHOW CREATE TABLE account";
                table   = DataCore.GetTable(command);
                string createResult = PIn.ByteArray(table.Rows[0][1]);
                if (!createResult.StartsWith("CREATE TABLE"))
                {
                    throw new Exception();
                }
                retVal += "SHOW CREATE TABLE: Passed.\r\n";
            }
            else
            {
                retVal += "SHOW CREATE TABLE: Not applicable to Oracle.\r\n";
            }
            //Single Command Split-------------------------------------------------------------------------
            varchar1 = "';\"";
            varchar2 = ";'';;;;\"\"\"\"'asdfsadsdaf'";
            command  = "INSERT INTO tempcore (TextTinyTest,TextSmallTest) VALUES ('" + POut.String(varchar1) + "','" + POut.String(varchar2) + "');";
            DataCore.NonQ(command);            //Test the split function.
            command = "SELECT TextTinyTest,TextSmallTest FROM tempcore";
            table   = DataCore.GetTable(command);
            if (PIn.String(table.Rows[0]["TextTinyTest"].ToString()) != varchar1 || PIn.String(table.Rows[0]["TextSmallTest"].ToString()) != varchar2)
            {
                throw new ApplicationException();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Single Command Split: Passed.";
            //Run multiple non-queries in one transaction--------------------------------------------------
            varchar1 = "A";
            varchar2 = "B";
            command  = "INSERT INTO tempcore (TextTinyTest) VALUES ('" + POut.String(varchar1) + "'); DELETE FROM tempcore; INSERT INTO tempcore (TextTinyTest) VALUES ('" + POut.String(varchar2) + "')";
            DataCore.NonQ(command);
            command = "SELECT TextTinyTest FROM tempcore";
            table   = DataCore.GetTable(command);
            if (PIn.String(table.Rows[0][0].ToString()) != varchar2)
            {
                throw new ApplicationException();
            }
            command = "DELETE FROM tempcore";
            DataCore.NonQ(command);
            retVal += "Multi-Non-Queries: Passed.\r\n";
            //Cleanup---------------------------------------------------------------------------------------
            if (DataConnection.DBtype == DatabaseType.MySql)
            {
                command = "DROP TABLE IF EXISTS tempcore";
                DataCore.NonQ(command);
                command = "DROP TABLE IF EXISTS tempgroupconcat";
                DataCore.NonQ(command);
            }
            else
            {
                command = "BEGIN EXECUTE IMMEDIATE 'DROP TABLE tempcore'; EXCEPTION WHEN OTHERS THEN NULL; END;";
                DataCore.NonQ(command);
                command = "BEGIN EXECUTE IMMEDIATE 'DROP TABLE tempgroupconcat'; EXCEPTION WHEN OTHERS THEN NULL; END;";
                DataCore.NonQ(command);
            }
            retVal += "CoreTypes test done.\r\n";
            return(retVal);
        }
コード例 #11
0
 ///<summary>Inserts many TimeCardRules into the database.  Provides option to use the existing priKey.</summary>
 public static void InsertMany(List <TimeCardRule> listTimeCardRules, bool useExistingPK)
 {
     if (!useExistingPK && PrefC.RandomKeys)
     {
         foreach (TimeCardRule timeCardRule in listTimeCardRules)
         {
             Insert(timeCardRule);
         }
     }
     else
     {
         StringBuilder sbCommands = null;
         int           index      = 0;
         int           countRows  = 0;
         while (index < listTimeCardRules.Count)
         {
             TimeCardRule  timeCardRule = listTimeCardRules[index];
             StringBuilder sbRow        = new StringBuilder("(");
             bool          hasComma     = false;
             if (sbCommands == null)
             {
                 sbCommands = new StringBuilder();
                 sbCommands.Append("INSERT INTO timecardrule (");
                 if (useExistingPK)
                 {
                     sbCommands.Append("TimeCardRuleNum,");
                 }
                 sbCommands.Append("EmployeeNum,OverHoursPerDay,AfterTimeOfDay,BeforeTimeOfDay,IsOvertimeExempt,MinClockInTime) VALUES ");
                 countRows = 0;
             }
             else
             {
                 hasComma = true;
             }
             if (useExistingPK)
             {
                 sbRow.Append(POut.Long(timeCardRule.TimeCardRuleNum)); sbRow.Append(",");
             }
             sbRow.Append(POut.Long(timeCardRule.EmployeeNum)); sbRow.Append(",");
             sbRow.Append(POut.Time(timeCardRule.OverHoursPerDay)); sbRow.Append(",");
             sbRow.Append(POut.Time(timeCardRule.AfterTimeOfDay)); sbRow.Append(",");
             sbRow.Append(POut.Time(timeCardRule.BeforeTimeOfDay)); sbRow.Append(",");
             sbRow.Append(POut.Bool(timeCardRule.IsOvertimeExempt)); sbRow.Append(",");
             sbRow.Append(POut.Time(timeCardRule.MinClockInTime)); sbRow.Append(")");
             if (sbCommands.Length + sbRow.Length + 1 > TableBase.MaxAllowedPacketCount && countRows > 0)
             {
                 Db.NonQ(sbCommands.ToString());
                 sbCommands = null;
             }
             else
             {
                 if (hasComma)
                 {
                     sbCommands.Append(",");
                 }
                 sbCommands.Append(sbRow.ToString());
                 countRows++;
                 if (index == listTimeCardRules.Count - 1)
                 {
                     Db.NonQ(sbCommands.ToString());
                 }
                 index++;
             }
         }
     }
 }
コード例 #12
0
        ///<summary>Updates one TimeCardRule 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(TimeCardRule timeCardRule, TimeCardRule oldTimeCardRule)
        {
            string command = "";

            if (timeCardRule.EmployeeNum != oldTimeCardRule.EmployeeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmployeeNum = " + POut.Long(timeCardRule.EmployeeNum) + "";
            }
            if (timeCardRule.OverHoursPerDay != oldTimeCardRule.OverHoursPerDay)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OverHoursPerDay = " + POut.Time(timeCardRule.OverHoursPerDay) + "";
            }
            if (timeCardRule.AfterTimeOfDay != oldTimeCardRule.AfterTimeOfDay)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AfterTimeOfDay = " + POut.Time(timeCardRule.AfterTimeOfDay) + "";
            }
            if (timeCardRule.BeforeTimeOfDay != oldTimeCardRule.BeforeTimeOfDay)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BeforeTimeOfDay = " + POut.Time(timeCardRule.BeforeTimeOfDay) + "";
            }
            if (timeCardRule.IsOvertimeExempt != oldTimeCardRule.IsOvertimeExempt)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsOvertimeExempt = " + POut.Bool(timeCardRule.IsOvertimeExempt) + "";
            }
            if (timeCardRule.MinClockInTime != oldTimeCardRule.MinClockInTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MinClockInTime = " + POut.Time(timeCardRule.MinClockInTime) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE timecardrule SET " + command
                      + " WHERE TimeCardRuleNum = " + POut.Long(timeCardRule.TimeCardRuleNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #13
0
        ///<summary>Updates one ApptView 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(ApptView apptView, ApptView oldApptView)
        {
            string command = "";

            if (apptView.Description != oldApptView.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(apptView.Description) + "'";
            }
            if (apptView.ItemOrder != oldApptView.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(apptView.ItemOrder) + "";
            }
            if (apptView.RowsPerIncr != oldApptView.RowsPerIncr)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RowsPerIncr = " + POut.Byte(apptView.RowsPerIncr) + "";
            }
            if (apptView.OnlyScheduledProvs != oldApptView.OnlyScheduledProvs)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlyScheduledProvs = " + POut.Bool(apptView.OnlyScheduledProvs) + "";
            }
            if (apptView.OnlySchedBeforeTime != oldApptView.OnlySchedBeforeTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlySchedBeforeTime = " + POut.Time(apptView.OnlySchedBeforeTime) + "";
            }
            if (apptView.OnlySchedAfterTime != oldApptView.OnlySchedAfterTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlySchedAfterTime = " + POut.Time(apptView.OnlySchedAfterTime) + "";
            }
            if (apptView.StackBehavUR != oldApptView.StackBehavUR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StackBehavUR = " + POut.Int((int)apptView.StackBehavUR) + "";
            }
            if (apptView.StackBehavLR != oldApptView.StackBehavLR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StackBehavLR = " + POut.Int((int)apptView.StackBehavLR) + "";
            }
            if (apptView.ClinicNum != oldApptView.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(apptView.ClinicNum) + "";
            }
            if (apptView.ApptTimeScrollStart != oldApptView.ApptTimeScrollStart)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ApptTimeScrollStart = " + POut.Time(apptView.ApptTimeScrollStart) + "";
            }
            if (apptView.IsScrollStartDynamic != oldApptView.IsScrollStartDynamic)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsScrollStartDynamic = " + POut.Bool(apptView.IsScrollStartDynamic) + "";
            }
            if (apptView.IsApptBubblesDisabled != oldApptView.IsApptBubblesDisabled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsApptBubblesDisabled = " + POut.Bool(apptView.IsApptBubblesDisabled) + "";
            }
            if (apptView.WidthOpMinimum != oldApptView.WidthOpMinimum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "WidthOpMinimum = " + POut.Int(apptView.WidthOpMinimum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE apptview SET " + command
                      + " WHERE ApptViewNum = " + POut.Long(apptView.ApptViewNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #14
0
ファイル: ProcedureCrud.cs プロジェクト: nampn/ODental
        ///<summary>Inserts one Procedure into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(Procedure procedure, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                procedure.ProcNum = ReplicationServers.GetKey("procedurelog", "ProcNum");
            }
            string command = "INSERT INTO procedurelog (";

            if (useExistingPK || PrefC.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,UnitQty,BaseUnits,StartTime,StopTime,DateTP,SiteNum,HideGraphics,CanadianTypeCodes,ProcTime,ProcTimeEnd,Prognosis,DrugUnit,DrugQty) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(procedure.ProcNum) + ",";
            }
            command +=
                POut.Long(procedure.PatNum) + ","
                + POut.Long(procedure.AptNum) + ","
                + "'" + POut.String(procedure.OldCode) + "',"
                + POut.Date(procedure.ProcDate) + ","
                + "'" + POut.Double(procedure.ProcFee) + "',"
                + "'" + POut.String(procedure.Surf) + "',"
                + "'" + POut.String(procedure.ToothNum) + "',"
                + "'" + POut.String(procedure.ToothRange) + "',"
                + POut.Long(procedure.Priority) + ","
                + POut.Int((int)procedure.ProcStatus) + ","
                + POut.Long(procedure.ProvNum) + ","
                + POut.Long(procedure.Dx) + ","
                + POut.Long(procedure.PlannedAptNum) + ","
                + POut.Int((int)procedure.PlaceService) + ","
                + "'" + POut.String(procedure.Prosthesis) + "',"
                + POut.Date(procedure.DateOriginalProsth) + ","
                + "'" + POut.String(procedure.ClaimNote) + "',"
                + DbHelper.Now() + ","
                + POut.Long(procedure.ClinicNum) + ","
                + "'" + POut.String(procedure.MedicalCode) + "',"
                + "'" + POut.String(procedure.DiagnosticCode) + "',"
                + POut.Bool(procedure.IsPrincDiag) + ","
                + POut.Long(procedure.ProcNumLab) + ","
                + POut.Long(procedure.BillingTypeOne) + ","
                + POut.Long(procedure.BillingTypeTwo) + ","
                + POut.Long(procedure.CodeNum) + ","
                + "'" + POut.String(procedure.CodeMod1) + "',"
                + "'" + POut.String(procedure.CodeMod2) + "',"
                + "'" + POut.String(procedure.CodeMod3) + "',"
                + "'" + POut.String(procedure.CodeMod4) + "',"
                + "'" + POut.String(procedure.RevCode) + "',"
                + POut.Int(procedure.UnitQty) + ","
                + POut.Int(procedure.BaseUnits) + ","
                + POut.Int(procedure.StartTime) + ","
                + POut.Int(procedure.StopTime) + ","
                + POut.Date(procedure.DateTP) + ","
                + POut.Long(procedure.SiteNum) + ","
                + POut.Bool(procedure.HideGraphics) + ","
                + "'" + POut.String(procedure.CanadianTypeCodes) + "',"
                + POut.Time(procedure.ProcTime) + ","
                + POut.Time(procedure.ProcTimeEnd) + ","
                //DateTStamp can only be set by MySQL
                + POut.Long(procedure.Prognosis) + ","
                + POut.Int((int)procedure.DrugUnit) + ","
                + POut.Float(procedure.DrugQty) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                procedure.ProcNum = Db.NonQ(command, true);
            }
            return(procedure.ProcNum);
        }
コード例 #15
0
ファイル: ProcedureCrud.cs プロジェクト: nampn/ODental
        ///<summary>Updates one Procedure 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(Procedure procedure, Procedure oldProcedure)
        {
            string command = "";

            if (procedure.PatNum != oldProcedure.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(procedure.PatNum) + "";
            }
            if (procedure.AptNum != oldProcedure.AptNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AptNum = " + POut.Long(procedure.AptNum) + "";
            }
            if (procedure.OldCode != oldProcedure.OldCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OldCode = '" + POut.String(procedure.OldCode) + "'";
            }
            if (procedure.ProcDate != oldProcedure.ProcDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcDate = " + POut.Date(procedure.ProcDate) + "";
            }
            if (procedure.ProcFee != oldProcedure.ProcFee)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcFee = '" + POut.Double(procedure.ProcFee) + "'";
            }
            if (procedure.Surf != oldProcedure.Surf)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Surf = '" + POut.String(procedure.Surf) + "'";
            }
            if (procedure.ToothNum != oldProcedure.ToothNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ToothNum = '" + POut.String(procedure.ToothNum) + "'";
            }
            if (procedure.ToothRange != oldProcedure.ToothRange)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ToothRange = '" + POut.String(procedure.ToothRange) + "'";
            }
            if (procedure.Priority != oldProcedure.Priority)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Priority = " + POut.Long(procedure.Priority) + "";
            }
            if (procedure.ProcStatus != oldProcedure.ProcStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcStatus = " + POut.Int((int)procedure.ProcStatus) + "";
            }
            if (procedure.ProvNum != oldProcedure.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(procedure.ProvNum) + "";
            }
            if (procedure.Dx != oldProcedure.Dx)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Dx = " + POut.Long(procedure.Dx) + "";
            }
            if (procedure.PlannedAptNum != oldProcedure.PlannedAptNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PlannedAptNum = " + POut.Long(procedure.PlannedAptNum) + "";
            }
            if (procedure.PlaceService != oldProcedure.PlaceService)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PlaceService = " + POut.Int((int)procedure.PlaceService) + "";
            }
            if (procedure.Prosthesis != oldProcedure.Prosthesis)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Prosthesis = '" + POut.String(procedure.Prosthesis) + "'";
            }
            if (procedure.DateOriginalProsth != oldProcedure.DateOriginalProsth)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateOriginalProsth = " + POut.Date(procedure.DateOriginalProsth) + "";
            }
            if (procedure.ClaimNote != oldProcedure.ClaimNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClaimNote = '" + POut.String(procedure.ClaimNote) + "'";
            }
            if (procedure.DateEntryC != oldProcedure.DateEntryC)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateEntryC = " + POut.Date(procedure.DateEntryC) + "";
            }
            if (procedure.ClinicNum != oldProcedure.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(procedure.ClinicNum) + "";
            }
            if (procedure.MedicalCode != oldProcedure.MedicalCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicalCode = '" + POut.String(procedure.MedicalCode) + "'";
            }
            if (procedure.DiagnosticCode != oldProcedure.DiagnosticCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DiagnosticCode = '" + POut.String(procedure.DiagnosticCode) + "'";
            }
            if (procedure.IsPrincDiag != oldProcedure.IsPrincDiag)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsPrincDiag = " + POut.Bool(procedure.IsPrincDiag) + "";
            }
            if (procedure.ProcNumLab != oldProcedure.ProcNumLab)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcNumLab = " + POut.Long(procedure.ProcNumLab) + "";
            }
            if (procedure.BillingTypeOne != oldProcedure.BillingTypeOne)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BillingTypeOne = " + POut.Long(procedure.BillingTypeOne) + "";
            }
            if (procedure.BillingTypeTwo != oldProcedure.BillingTypeTwo)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BillingTypeTwo = " + POut.Long(procedure.BillingTypeTwo) + "";
            }
            if (procedure.CodeNum != oldProcedure.CodeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CodeNum = " + POut.Long(procedure.CodeNum) + "";
            }
            if (procedure.CodeMod1 != oldProcedure.CodeMod1)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CodeMod1 = '" + POut.String(procedure.CodeMod1) + "'";
            }
            if (procedure.CodeMod2 != oldProcedure.CodeMod2)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CodeMod2 = '" + POut.String(procedure.CodeMod2) + "'";
            }
            if (procedure.CodeMod3 != oldProcedure.CodeMod3)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CodeMod3 = '" + POut.String(procedure.CodeMod3) + "'";
            }
            if (procedure.CodeMod4 != oldProcedure.CodeMod4)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CodeMod4 = '" + POut.String(procedure.CodeMod4) + "'";
            }
            if (procedure.RevCode != oldProcedure.RevCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RevCode = '" + POut.String(procedure.RevCode) + "'";
            }
            if (procedure.UnitQty != oldProcedure.UnitQty)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UnitQty = " + POut.Int(procedure.UnitQty) + "";
            }
            if (procedure.BaseUnits != oldProcedure.BaseUnits)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BaseUnits = " + POut.Int(procedure.BaseUnits) + "";
            }
            if (procedure.StartTime != oldProcedure.StartTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StartTime = " + POut.Int(procedure.StartTime) + "";
            }
            if (procedure.StopTime != oldProcedure.StopTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StopTime = " + POut.Int(procedure.StopTime) + "";
            }
            if (procedure.DateTP != oldProcedure.DateTP)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateTP = " + POut.Date(procedure.DateTP) + "";
            }
            if (procedure.SiteNum != oldProcedure.SiteNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SiteNum = " + POut.Long(procedure.SiteNum) + "";
            }
            if (procedure.HideGraphics != oldProcedure.HideGraphics)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HideGraphics = " + POut.Bool(procedure.HideGraphics) + "";
            }
            if (procedure.CanadianTypeCodes != oldProcedure.CanadianTypeCodes)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CanadianTypeCodes = '" + POut.String(procedure.CanadianTypeCodes) + "'";
            }
            if (procedure.ProcTime != oldProcedure.ProcTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcTime = " + POut.Time(procedure.ProcTime) + "";
            }
            if (procedure.ProcTimeEnd != oldProcedure.ProcTimeEnd)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProcTimeEnd = " + POut.Time(procedure.ProcTimeEnd) + "";
            }
            //DateTStamp can only be set by MySQL
            if (procedure.Prognosis != oldProcedure.Prognosis)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Prognosis = " + POut.Long(procedure.Prognosis) + "";
            }
            if (procedure.DrugUnit != oldProcedure.DrugUnit)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DrugUnit = " + POut.Int((int)procedure.DrugUnit) + "";
            }
            if (procedure.DrugQty != oldProcedure.DrugQty)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DrugQty = " + POut.Float(procedure.DrugQty) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE procedurelog SET " + command
                      + " WHERE ProcNum = " + POut.Long(procedure.ProcNum);
            Db.NonQ(command);
        }
コード例 #16
0
        ///<summary>Updates one ApptView 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>
        public static void Update(ApptView apptView, ApptView oldApptView)
        {
            string command = "";

            if (apptView.Description != oldApptView.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(apptView.Description) + "'";
            }
            if (apptView.ItemOrder != oldApptView.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(apptView.ItemOrder) + "";
            }
            if (apptView.RowsPerIncr != oldApptView.RowsPerIncr)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RowsPerIncr = " + POut.Byte(apptView.RowsPerIncr) + "";
            }
            if (apptView.OnlyScheduledProvs != oldApptView.OnlyScheduledProvs)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlyScheduledProvs = " + POut.Bool(apptView.OnlyScheduledProvs) + "";
            }
            if (apptView.OnlySchedBeforeTime != oldApptView.OnlySchedBeforeTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlySchedBeforeTime = " + POut.Time(apptView.OnlySchedBeforeTime) + "";
            }
            if (apptView.OnlySchedAfterTime != oldApptView.OnlySchedAfterTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlySchedAfterTime = " + POut.Time(apptView.OnlySchedAfterTime) + "";
            }
            if (apptView.StackBehavUR != oldApptView.StackBehavUR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StackBehavUR = " + POut.Int((int)apptView.StackBehavUR) + "";
            }
            if (apptView.StackBehavLR != oldApptView.StackBehavLR)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StackBehavLR = " + POut.Int((int)apptView.StackBehavLR) + "";
            }
            if (apptView.ClinicNum != oldApptView.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(apptView.ClinicNum) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE apptview SET " + command
                      + " WHERE ApptViewNum = " + POut.Long(apptView.ApptViewNum);
            Db.NonQ(command);
        }
コード例 #17
0
 ///<summary>Inserts many Schedules into the database.  Provides option to use the existing priKey.</summary>
 public static void InsertMany(List <Schedule> listSchedules, bool useExistingPK)
 {
     if (!useExistingPK && PrefC.RandomKeys)
     {
         foreach (Schedule schedule in listSchedules)
         {
             Insert(schedule);
         }
     }
     else
     {
         StringBuilder sbCommands = null;
         int           index      = 0;
         int           countRows  = 0;
         while (index < listSchedules.Count)
         {
             Schedule      schedule = listSchedules[index];
             StringBuilder sbRow    = new StringBuilder("(");
             bool          hasComma = false;
             if (sbCommands == null)
             {
                 sbCommands = new StringBuilder();
                 sbCommands.Append("INSERT INTO schedule (");
                 if (useExistingPK)
                 {
                     sbCommands.Append("ScheduleNum,");
                 }
                 sbCommands.Append("SchedDate,StartTime,StopTime,SchedType,ProvNum,BlockoutType,Note,Status,EmployeeNum,ClinicNum) VALUES ");
                 countRows = 0;
             }
             else
             {
                 hasComma = true;
             }
             if (useExistingPK)
             {
                 sbRow.Append(POut.Long(schedule.ScheduleNum)); sbRow.Append(",");
             }
             sbRow.Append(POut.Date(schedule.SchedDate)); sbRow.Append(",");
             sbRow.Append(POut.Time(schedule.StartTime)); sbRow.Append(",");
             sbRow.Append(POut.Time(schedule.StopTime)); sbRow.Append(",");
             sbRow.Append(POut.Int((int)schedule.SchedType)); sbRow.Append(",");
             sbRow.Append(POut.Long(schedule.ProvNum)); sbRow.Append(",");
             sbRow.Append(POut.Long(schedule.BlockoutType)); sbRow.Append(",");
             sbRow.Append("'" + POut.String(schedule.Note) + "'"); sbRow.Append(",");
             sbRow.Append(POut.Int((int)schedule.Status)); sbRow.Append(",");
             sbRow.Append(POut.Long(schedule.EmployeeNum)); sbRow.Append(",");
             //DateTStamp can only be set by MySQL
             sbRow.Append(POut.Long(schedule.ClinicNum)); sbRow.Append(")");
             if (sbCommands.Length + sbRow.Length + 1 > TableBase.MaxAllowedPacketCount && countRows > 0)
             {
                 Db.NonQ(sbCommands.ToString());
                 sbCommands = null;
             }
             else
             {
                 if (hasComma)
                 {
                     sbCommands.Append(",");
                 }
                 sbCommands.Append(sbRow.ToString());
                 countRows++;
                 if (index == listSchedules.Count - 1)
                 {
                     Db.NonQ(sbCommands.ToString());
                 }
                 index++;
             }
         }
     }
 }
コード例 #18
0
ファイル: PatientCrud.cs プロジェクト: nampn/ODental
        ///<summary>Inserts one Patient into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(Patient patient, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                patient.PatNum = ReplicationServers.GetKey("patient", "PatNum");
            }
            string command = "INSERT INTO patient (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "PatNum,";
            }
            command += "LName,FName,MiddleI,Preferred,PatStatus,Gender,Position,Birthdate,SSN,Address,Address2,City,State,Zip,HmPhone,WkPhone,WirelessPhone,Guarantor,CreditType,Email,Salutation,EstBalance,PriProv,SecProv,FeeSched,BillingType,ImageFolder,AddrNote,FamFinUrgNote,MedUrgNote,ApptModNote,StudentStatus,SchoolName,ChartNumber,MedicaidID,Bal_0_30,Bal_31_60,Bal_61_90,BalOver90,InsEst,BalTotal,EmployerNum,EmploymentNote,Race,County,GradeLevel,Urgency,DateFirstVisit,ClinicNum,HasIns,TrophyFolder,PlannedIsDone,Premed,Ward,PreferConfirmMethod,PreferContactMethod,PreferRecallMethod,SchedBeforeTime,SchedAfterTime,SchedDayOfWeek,Language,AdmitDate,Title,PayPlanDue,SiteNum,ResponsParty,CanadianEligibilityCode,AskToArriveEarly,OnlinePassword,SmokeStatus,PreferContactConfidential,SuperFamily) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(patient.PatNum) + ",";
            }
            command +=
                "'" + POut.String(patient.LName) + "',"
                + "'" + POut.String(patient.FName) + "',"
                + "'" + POut.String(patient.MiddleI) + "',"
                + "'" + POut.String(patient.Preferred) + "',"
                + POut.Int((int)patient.PatStatus) + ","
                + POut.Int((int)patient.Gender) + ","
                + POut.Int((int)patient.Position) + ","
                + POut.Date(patient.Birthdate) + ","
                + "'" + POut.String(patient.SSN) + "',"
                + "'" + POut.String(patient.Address) + "',"
                + "'" + POut.String(patient.Address2) + "',"
                + "'" + POut.String(patient.City) + "',"
                + "'" + POut.String(patient.State) + "',"
                + "'" + POut.String(patient.Zip) + "',"
                + "'" + POut.String(patient.HmPhone) + "',"
                + "'" + POut.String(patient.WkPhone) + "',"
                + "'" + POut.String(patient.WirelessPhone) + "',"
                + POut.Long(patient.Guarantor) + ","
                + "'" + POut.String(patient.CreditType) + "',"
                + "'" + POut.String(patient.Email) + "',"
                + "'" + POut.String(patient.Salutation) + "',"
                + "'" + POut.Double(patient.EstBalance) + "',"
                + POut.Long(patient.PriProv) + ","
                + POut.Long(patient.SecProv) + ","
                + POut.Long(patient.FeeSched) + ","
                + POut.Long(patient.BillingType) + ","
                + "'" + POut.String(patient.ImageFolder) + "',"
                + "'" + POut.String(patient.AddrNote) + "',"
                + "'" + POut.String(patient.FamFinUrgNote) + "',"
                + "'" + POut.String(patient.MedUrgNote) + "',"
                + "'" + POut.String(patient.ApptModNote) + "',"
                + "'" + POut.String(patient.StudentStatus) + "',"
                + "'" + POut.String(patient.SchoolName) + "',"
                + "'" + POut.String(patient.ChartNumber) + "',"
                + "'" + POut.String(patient.MedicaidID) + "',"
                + "'" + POut.Double(patient.Bal_0_30) + "',"
                + "'" + POut.Double(patient.Bal_31_60) + "',"
                + "'" + POut.Double(patient.Bal_61_90) + "',"
                + "'" + POut.Double(patient.BalOver90) + "',"
                + "'" + POut.Double(patient.InsEst) + "',"
                + "'" + POut.Double(patient.BalTotal) + "',"
                + POut.Long(patient.EmployerNum) + ","
                + "'" + POut.String(patient.EmploymentNote) + "',"
                + POut.Int((int)patient.Race) + ","
                + "'" + POut.String(patient.County) + "',"
                + POut.Int((int)patient.GradeLevel) + ","
                + POut.Int((int)patient.Urgency) + ","
                + POut.Date(patient.DateFirstVisit) + ","
                + POut.Long(patient.ClinicNum) + ","
                + "'" + POut.String(patient.HasIns) + "',"
                + "'" + POut.String(patient.TrophyFolder) + "',"
                + POut.Bool(patient.PlannedIsDone) + ","
                + POut.Bool(patient.Premed) + ","
                + "'" + POut.String(patient.Ward) + "',"
                + POut.Int((int)patient.PreferConfirmMethod) + ","
                + POut.Int((int)patient.PreferContactMethod) + ","
                + POut.Int((int)patient.PreferRecallMethod) + ","
                + POut.Time(patient.SchedBeforeTime) + ","
                + POut.Time(patient.SchedAfterTime) + ","
                + POut.Byte(patient.SchedDayOfWeek) + ","
                + "'" + POut.String(patient.Language) + "',"
                + POut.Date(patient.AdmitDate) + ","
                + "'" + POut.String(patient.Title) + "',"
                + "'" + POut.Double(patient.PayPlanDue) + "',"
                + POut.Long(patient.SiteNum) + ","
                //DateTStamp can only be set by MySQL
                + POut.Long(patient.ResponsParty) + ","
                + POut.Byte(patient.CanadianEligibilityCode) + ","
                + POut.Int(patient.AskToArriveEarly) + ","
                + "'" + POut.String(patient.OnlinePassword) + "',"
                + POut.Int((int)patient.SmokeStatus) + ","
                + POut.Int((int)patient.PreferContactConfidential) + ","
                + POut.Long(patient.SuperFamily) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                patient.PatNum = Db.NonQ(command, true);
            }
            return(patient.PatNum);
        }
コード例 #19
0
ファイル: ScheduleCrud.cs プロジェクト: nampn/ODental
        ///<summary>Updates one Schedule 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(Schedule schedule, Schedule oldSchedule)
        {
            string command = "";

            if (schedule.SchedDate != oldSchedule.SchedDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchedDate = " + POut.Date(schedule.SchedDate) + "";
            }
            if (schedule.StartTime != oldSchedule.StartTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StartTime = " + POut.Time(schedule.StartTime) + "";
            }
            if (schedule.StopTime != oldSchedule.StopTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StopTime = " + POut.Time(schedule.StopTime) + "";
            }
            if (schedule.SchedType != oldSchedule.SchedType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchedType = " + POut.Int((int)schedule.SchedType) + "";
            }
            if (schedule.ProvNum != oldSchedule.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(schedule.ProvNum) + "";
            }
            if (schedule.BlockoutType != oldSchedule.BlockoutType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BlockoutType = " + POut.Long(schedule.BlockoutType) + "";
            }
            if (schedule.Note != oldSchedule.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = '" + POut.String(schedule.Note) + "'";
            }
            if (schedule.Status != oldSchedule.Status)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Status = " + POut.Int((int)schedule.Status) + "";
            }
            if (schedule.EmployeeNum != oldSchedule.EmployeeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmployeeNum = " + POut.Long(schedule.EmployeeNum) + "";
            }
            //DateTStamp can only be set by MySQL
            if (command == "")
            {
                return;
            }
            command = "UPDATE schedule SET " + command
                      + " WHERE ScheduleNum = " + POut.Long(schedule.ScheduleNum);
            Db.NonQ(command);
        }
コード例 #20
0
ファイル: PatientCrud.cs プロジェクト: nampn/ODental
        ///<summary>Updates one Patient 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(Patient patient, Patient oldPatient)
        {
            string command = "";

            if (patient.LName != oldPatient.LName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "LName = '" + POut.String(patient.LName) + "'";
            }
            if (patient.FName != oldPatient.FName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FName = '" + POut.String(patient.FName) + "'";
            }
            if (patient.MiddleI != oldPatient.MiddleI)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MiddleI = '" + POut.String(patient.MiddleI) + "'";
            }
            if (patient.Preferred != oldPatient.Preferred)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Preferred = '" + POut.String(patient.Preferred) + "'";
            }
            if (patient.PatStatus != oldPatient.PatStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatStatus = " + POut.Int((int)patient.PatStatus) + "";
            }
            if (patient.Gender != oldPatient.Gender)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Gender = " + POut.Int((int)patient.Gender) + "";
            }
            if (patient.Position != oldPatient.Position)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Position = " + POut.Int((int)patient.Position) + "";
            }
            if (patient.Birthdate != oldPatient.Birthdate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Birthdate = " + POut.Date(patient.Birthdate) + "";
            }
            if (patient.SSN != oldPatient.SSN)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SSN = '" + POut.String(patient.SSN) + "'";
            }
            if (patient.Address != oldPatient.Address)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Address = '" + POut.String(patient.Address) + "'";
            }
            if (patient.Address2 != oldPatient.Address2)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Address2 = '" + POut.String(patient.Address2) + "'";
            }
            if (patient.City != oldPatient.City)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "City = '" + POut.String(patient.City) + "'";
            }
            if (patient.State != oldPatient.State)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "State = '" + POut.String(patient.State) + "'";
            }
            if (patient.Zip != oldPatient.Zip)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Zip = '" + POut.String(patient.Zip) + "'";
            }
            if (patient.HmPhone != oldPatient.HmPhone)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HmPhone = '" + POut.String(patient.HmPhone) + "'";
            }
            if (patient.WkPhone != oldPatient.WkPhone)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "WkPhone = '" + POut.String(patient.WkPhone) + "'";
            }
            if (patient.WirelessPhone != oldPatient.WirelessPhone)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "WirelessPhone = '" + POut.String(patient.WirelessPhone) + "'";
            }
            if (patient.Guarantor != oldPatient.Guarantor)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Guarantor = " + POut.Long(patient.Guarantor) + "";
            }
            if (patient.CreditType != oldPatient.CreditType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CreditType = '" + POut.String(patient.CreditType) + "'";
            }
            if (patient.Email != oldPatient.Email)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Email = '" + POut.String(patient.Email) + "'";
            }
            if (patient.Salutation != oldPatient.Salutation)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Salutation = '" + POut.String(patient.Salutation) + "'";
            }
            if (patient.EstBalance != oldPatient.EstBalance)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EstBalance = '" + POut.Double(patient.EstBalance) + "'";
            }
            if (patient.PriProv != oldPatient.PriProv)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PriProv = " + POut.Long(patient.PriProv) + "";
            }
            if (patient.SecProv != oldPatient.SecProv)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SecProv = " + POut.Long(patient.SecProv) + "";
            }
            if (patient.FeeSched != oldPatient.FeeSched)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeSched = " + POut.Long(patient.FeeSched) + "";
            }
            if (patient.BillingType != oldPatient.BillingType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BillingType = " + POut.Long(patient.BillingType) + "";
            }
            if (patient.ImageFolder != oldPatient.ImageFolder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ImageFolder = '" + POut.String(patient.ImageFolder) + "'";
            }
            if (patient.AddrNote != oldPatient.AddrNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AddrNote = '" + POut.String(patient.AddrNote) + "'";
            }
            if (patient.FamFinUrgNote != oldPatient.FamFinUrgNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FamFinUrgNote = '" + POut.String(patient.FamFinUrgNote) + "'";
            }
            if (patient.MedUrgNote != oldPatient.MedUrgNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedUrgNote = '" + POut.String(patient.MedUrgNote) + "'";
            }
            if (patient.ApptModNote != oldPatient.ApptModNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ApptModNote = '" + POut.String(patient.ApptModNote) + "'";
            }
            if (patient.StudentStatus != oldPatient.StudentStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StudentStatus = '" + POut.String(patient.StudentStatus) + "'";
            }
            if (patient.SchoolName != oldPatient.SchoolName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchoolName = '" + POut.String(patient.SchoolName) + "'";
            }
            if (patient.ChartNumber != oldPatient.ChartNumber)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ChartNumber = '" + POut.String(patient.ChartNumber) + "'";
            }
            if (patient.MedicaidID != oldPatient.MedicaidID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "MedicaidID = '" + POut.String(patient.MedicaidID) + "'";
            }
            if (patient.Bal_0_30 != oldPatient.Bal_0_30)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Bal_0_30 = '" + POut.Double(patient.Bal_0_30) + "'";
            }
            if (patient.Bal_31_60 != oldPatient.Bal_31_60)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Bal_31_60 = '" + POut.Double(patient.Bal_31_60) + "'";
            }
            if (patient.Bal_61_90 != oldPatient.Bal_61_90)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Bal_61_90 = '" + POut.Double(patient.Bal_61_90) + "'";
            }
            if (patient.BalOver90 != oldPatient.BalOver90)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BalOver90 = '" + POut.Double(patient.BalOver90) + "'";
            }
            if (patient.InsEst != oldPatient.InsEst)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "InsEst = '" + POut.Double(patient.InsEst) + "'";
            }
            if (patient.BalTotal != oldPatient.BalTotal)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BalTotal = '" + POut.Double(patient.BalTotal) + "'";
            }
            if (patient.EmployerNum != oldPatient.EmployerNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmployerNum = " + POut.Long(patient.EmployerNum) + "";
            }
            if (patient.EmploymentNote != oldPatient.EmploymentNote)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmploymentNote = '" + POut.String(patient.EmploymentNote) + "'";
            }
            if (patient.Race != oldPatient.Race)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Race = " + POut.Int((int)patient.Race) + "";
            }
            if (patient.County != oldPatient.County)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "County = '" + POut.String(patient.County) + "'";
            }
            if (patient.GradeLevel != oldPatient.GradeLevel)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "GradeLevel = " + POut.Int((int)patient.GradeLevel) + "";
            }
            if (patient.Urgency != oldPatient.Urgency)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Urgency = " + POut.Int((int)patient.Urgency) + "";
            }
            if (patient.DateFirstVisit != oldPatient.DateFirstVisit)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DateFirstVisit = " + POut.Date(patient.DateFirstVisit) + "";
            }
            if (patient.ClinicNum != oldPatient.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(patient.ClinicNum) + "";
            }
            if (patient.HasIns != oldPatient.HasIns)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HasIns = '" + POut.String(patient.HasIns) + "'";
            }
            if (patient.TrophyFolder != oldPatient.TrophyFolder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "TrophyFolder = '" + POut.String(patient.TrophyFolder) + "'";
            }
            if (patient.PlannedIsDone != oldPatient.PlannedIsDone)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PlannedIsDone = " + POut.Bool(patient.PlannedIsDone) + "";
            }
            if (patient.Premed != oldPatient.Premed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Premed = " + POut.Bool(patient.Premed) + "";
            }
            if (patient.Ward != oldPatient.Ward)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Ward = '" + POut.String(patient.Ward) + "'";
            }
            if (patient.PreferConfirmMethod != oldPatient.PreferConfirmMethod)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PreferConfirmMethod = " + POut.Int((int)patient.PreferConfirmMethod) + "";
            }
            if (patient.PreferContactMethod != oldPatient.PreferContactMethod)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PreferContactMethod = " + POut.Int((int)patient.PreferContactMethod) + "";
            }
            if (patient.PreferRecallMethod != oldPatient.PreferRecallMethod)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PreferRecallMethod = " + POut.Int((int)patient.PreferRecallMethod) + "";
            }
            if (patient.SchedBeforeTime != oldPatient.SchedBeforeTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchedBeforeTime = " + POut.Time(patient.SchedBeforeTime) + "";
            }
            if (patient.SchedAfterTime != oldPatient.SchedAfterTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchedAfterTime = " + POut.Time(patient.SchedAfterTime) + "";
            }
            if (patient.SchedDayOfWeek != oldPatient.SchedDayOfWeek)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchedDayOfWeek = " + POut.Byte(patient.SchedDayOfWeek) + "";
            }
            if (patient.Language != oldPatient.Language)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Language = '" + POut.String(patient.Language) + "'";
            }
            if (patient.AdmitDate != oldPatient.AdmitDate)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AdmitDate = " + POut.Date(patient.AdmitDate) + "";
            }
            if (patient.Title != oldPatient.Title)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Title = '" + POut.String(patient.Title) + "'";
            }
            if (patient.PayPlanDue != oldPatient.PayPlanDue)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PayPlanDue = '" + POut.Double(patient.PayPlanDue) + "'";
            }
            if (patient.SiteNum != oldPatient.SiteNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SiteNum = " + POut.Long(patient.SiteNum) + "";
            }
            //DateTStamp can only be set by MySQL
            if (patient.ResponsParty != oldPatient.ResponsParty)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ResponsParty = " + POut.Long(patient.ResponsParty) + "";
            }
            if (patient.CanadianEligibilityCode != oldPatient.CanadianEligibilityCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "CanadianEligibilityCode = " + POut.Byte(patient.CanadianEligibilityCode) + "";
            }
            if (patient.AskToArriveEarly != oldPatient.AskToArriveEarly)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AskToArriveEarly = " + POut.Int(patient.AskToArriveEarly) + "";
            }
            if (patient.OnlinePassword != oldPatient.OnlinePassword)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "OnlinePassword = '******'";
            }
            if (patient.SmokeStatus != oldPatient.SmokeStatus)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SmokeStatus = " + POut.Int((int)patient.SmokeStatus) + "";
            }
            if (patient.PreferContactConfidential != oldPatient.PreferContactConfidential)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PreferContactConfidential = " + POut.Int((int)patient.PreferContactConfidential) + "";
            }
            if (patient.SuperFamily != oldPatient.SuperFamily)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SuperFamily = " + POut.Long(patient.SuperFamily) + "";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE patient SET " + command
                      + " WHERE PatNum = " + POut.Long(patient.PatNum);
            Db.NonQ(command);
        }
コード例 #21
0
ファイル: ScheduleCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Updates one Schedule 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(Schedule schedule, Schedule oldSchedule)
        {
            string command = "";

            if (schedule.SchedDate.Date != oldSchedule.SchedDate.Date)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchedDate = " + POut.Date(schedule.SchedDate) + "";
            }
            if (schedule.StartTime != oldSchedule.StartTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StartTime = " + POut.Time(schedule.StartTime) + "";
            }
            if (schedule.StopTime != oldSchedule.StopTime)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "StopTime = " + POut.Time(schedule.StopTime) + "";
            }
            if (schedule.SchedType != oldSchedule.SchedType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SchedType = " + POut.Int((int)schedule.SchedType) + "";
            }
            if (schedule.ProvNum != oldSchedule.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(schedule.ProvNum) + "";
            }
            if (schedule.BlockoutType != oldSchedule.BlockoutType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "BlockoutType = " + POut.Long(schedule.BlockoutType) + "";
            }
            if (schedule.Note != oldSchedule.Note)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Note = " + DbHelper.ParamChar + "paramNote";
            }
            if (schedule.Status != oldSchedule.Status)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Status = " + POut.Int((int)schedule.Status) + "";
            }
            if (schedule.EmployeeNum != oldSchedule.EmployeeNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "EmployeeNum = " + POut.Long(schedule.EmployeeNum) + "";
            }
            //DateTStamp can only be set by MySQL
            if (schedule.ClinicNum != oldSchedule.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(schedule.ClinicNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            if (schedule.Note == null)
            {
                schedule.Note = "";
            }
            OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(schedule.Note));

            command = "UPDATE schedule SET " + command
                      + " WHERE ScheduleNum = " + POut.Long(schedule.ScheduleNum);
            Db.NonQ(command, paramNote);
            return(true);
        }