Пример #1
0
        ///<summary>Inserts one ClaimValCodeLog into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(ClaimValCodeLog claimValCodeLog, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                claimValCodeLog.ClaimValCodeLogNum = ReplicationServers.GetKey("claimvalcodelog", "ClaimValCodeLogNum");
            }
            string command = "INSERT INTO claimvalcodelog (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ClaimValCodeLogNum,";
            }
            command += "ClaimNum,ClaimField,ValCode,ValAmount,Ordinal) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(claimValCodeLog.ClaimValCodeLogNum) + ",";
            }
            command +=
                POut.Long(claimValCodeLog.ClaimNum) + ","
                + "'" + POut.String(claimValCodeLog.ClaimField) + "',"
                + "'" + POut.String(claimValCodeLog.ValCode) + "',"
                + "'" + POut.Double(claimValCodeLog.ValAmount) + "',"
                + POut.Int(claimValCodeLog.Ordinal) + ")";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                claimValCodeLog.ClaimValCodeLogNum = Db.NonQ(command, true);
            }
            return(claimValCodeLog.ClaimValCodeLogNum);
        }
Пример #2
0
 ///<summary>Inserts one ClaimValCodeLog into the database.  Returns the new priKey.</summary>
 internal static long Insert(ClaimValCodeLog claimValCodeLog)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         claimValCodeLog.ClaimValCodeLogNum = DbHelper.GetNextOracleKey("claimvalcodelog", "ClaimValCodeLogNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(claimValCodeLog, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     claimValCodeLog.ClaimValCodeLogNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(claimValCodeLog, false));
     }
 }
Пример #3
0
 ///<summary>Inserts one ClaimValCodeLog into the database.  Returns the new priKey.</summary>
 internal static long Insert(ClaimValCodeLog claimValCodeLog)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         claimValCodeLog.ClaimValCodeLogNum=DbHelper.GetNextOracleKey("claimvalcodelog","ClaimValCodeLogNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(claimValCodeLog,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     claimValCodeLog.ClaimValCodeLogNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(claimValCodeLog,false);
     }
 }
Пример #4
0
 ///<summary>Inserts one ClaimValCodeLog into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(ClaimValCodeLog claimValCodeLog,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         claimValCodeLog.ClaimValCodeLogNum=ReplicationServers.GetKey("claimvalcodelog","ClaimValCodeLogNum");
     }
     string command="INSERT INTO claimvalcodelog (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="ClaimValCodeLogNum,";
     }
     command+="ClaimNum,ClaimField,ValCode,ValAmount,Ordinal) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(claimValCodeLog.ClaimValCodeLogNum)+",";
     }
     command+=
              POut.Long  (claimValCodeLog.ClaimNum)+","
         +"'"+POut.String(claimValCodeLog.ClaimField)+"',"
         +"'"+POut.String(claimValCodeLog.ValCode)+"',"
         +"'"+POut.Double(claimValCodeLog.ValAmount)+"',"
         +    POut.Int   (claimValCodeLog.Ordinal)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         claimValCodeLog.ClaimValCodeLogNum=Db.NonQ(command,true);
     }
     return claimValCodeLog.ClaimValCodeLogNum;
 }
Пример #5
0
        ///<summary>Inserts one ClaimValCodeLog into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ClaimValCodeLog claimValCodeLog, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO claimvalcodelog (";

            if (!useExistingPK && isRandomKeys)
            {
                claimValCodeLog.ClaimValCodeLogNum = ReplicationServers.GetKeyNoCache("claimvalcodelog", "ClaimValCodeLogNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ClaimValCodeLogNum,";
            }
            command += "ClaimNum,ClaimField,ValCode,ValAmount,Ordinal) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(claimValCodeLog.ClaimValCodeLogNum) + ",";
            }
            command +=
                POut.Long(claimValCodeLog.ClaimNum) + ","
                + "'" + POut.String(claimValCodeLog.ClaimField) + "',"
                + "'" + POut.String(claimValCodeLog.ValCode) + "',"
                + "'" + POut.Double(claimValCodeLog.ValAmount) + "',"
                + POut.Int(claimValCodeLog.Ordinal) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                claimValCodeLog.ClaimValCodeLogNum = Db.NonQ(command, true, "ClaimValCodeLogNum", "claimValCodeLog");
            }
            return(claimValCodeLog.ClaimValCodeLogNum);
        }
Пример #6
0
        ///<summary>Updates one ClaimValCodeLog in the database.</summary>
        internal static void Update(ClaimValCodeLog claimValCodeLog)
        {
            string command = "UPDATE claimvalcodelog SET "
                             + "ClaimNum          =  " + POut.Long(claimValCodeLog.ClaimNum) + ", "
                             + "ClaimField        = '" + POut.String(claimValCodeLog.ClaimField) + "', "
                             + "ValCode           = '" + POut.String(claimValCodeLog.ValCode) + "', "
                             + "ValAmount         = '" + POut.Double(claimValCodeLog.ValAmount) + "', "
                             + "Ordinal           =  " + POut.Int(claimValCodeLog.Ordinal) + " "
                             + "WHERE ClaimValCodeLogNum = " + POut.Long(claimValCodeLog.ClaimValCodeLogNum);

            Db.NonQ(command);
        }
Пример #7
0
        ///<summary>Updates one ClaimValCodeLog 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(ClaimValCodeLog claimValCodeLog, ClaimValCodeLog oldClaimValCodeLog)
        {
            string command = "";

            if (claimValCodeLog.ClaimNum != oldClaimValCodeLog.ClaimNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClaimNum = " + POut.Long(claimValCodeLog.ClaimNum) + "";
            }
            if (claimValCodeLog.ClaimField != oldClaimValCodeLog.ClaimField)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClaimField = '" + POut.String(claimValCodeLog.ClaimField) + "'";
            }
            if (claimValCodeLog.ValCode != oldClaimValCodeLog.ValCode)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ValCode = '" + POut.String(claimValCodeLog.ValCode) + "'";
            }
            if (claimValCodeLog.ValAmount != oldClaimValCodeLog.ValAmount)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ValAmount = '" + POut.Double(claimValCodeLog.ValAmount) + "'";
            }
            if (claimValCodeLog.Ordinal != oldClaimValCodeLog.Ordinal)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Ordinal = " + POut.Int(claimValCodeLog.Ordinal) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE claimvalcodelog SET " + command
                      + " WHERE ClaimValCodeLogNum = " + POut.Long(claimValCodeLog.ClaimValCodeLogNum);
            Db.NonQ(command);
            return(true);
        }
Пример #8
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<ClaimValCodeLog> TableToList(DataTable table){
			List<ClaimValCodeLog> retVal=new List<ClaimValCodeLog>();
			ClaimValCodeLog claimValCodeLog;
			for(int i=0;i<table.Rows.Count;i++) {
				claimValCodeLog=new ClaimValCodeLog();
				claimValCodeLog.ClaimValCodeLogNum= PIn.Long  (table.Rows[i]["ClaimValCodeLogNum"].ToString());
				claimValCodeLog.ClaimNum          = PIn.Long  (table.Rows[i]["ClaimNum"].ToString());
				claimValCodeLog.ClaimField        = PIn.String(table.Rows[i]["ClaimField"].ToString());
				claimValCodeLog.ValCode           = PIn.String(table.Rows[i]["ValCode"].ToString());
				claimValCodeLog.ValAmount         = PIn.Double(table.Rows[i]["ValAmount"].ToString());
				claimValCodeLog.Ordinal           = PIn.Int   (table.Rows[i]["Ordinal"].ToString());
				retVal.Add(claimValCodeLog);
			}
			return retVal;
		}
Пример #9
0
 ///<summary>Inserts one ClaimValCodeLog into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ClaimValCodeLog claimValCodeLog)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(claimValCodeLog, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             claimValCodeLog.ClaimValCodeLogNum = DbHelper.GetNextOracleKey("claimvalcodelog", "ClaimValCodeLogNum");                  //Cacheless method
         }
         return(InsertNoCache(claimValCodeLog, true));
     }
 }
Пример #10
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <ClaimValCodeLog> TableToList(DataTable table)
        {
            List <ClaimValCodeLog> retVal = new List <ClaimValCodeLog>();
            ClaimValCodeLog        claimValCodeLog;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                claimValCodeLog = new ClaimValCodeLog();
                claimValCodeLog.ClaimValCodeLogNum = PIn.Long(table.Rows[i]["ClaimValCodeLogNum"].ToString());
                claimValCodeLog.ClaimNum           = PIn.Long(table.Rows[i]["ClaimNum"].ToString());
                claimValCodeLog.ClaimField         = PIn.String(table.Rows[i]["ClaimField"].ToString());
                claimValCodeLog.ValCode            = PIn.String(table.Rows[i]["ValCode"].ToString());
                claimValCodeLog.ValAmount          = PIn.Double(table.Rows[i]["ValAmount"].ToString());
                claimValCodeLog.Ordinal            = PIn.Int(table.Rows[i]["Ordinal"].ToString());
                retVal.Add(claimValCodeLog);
            }
            return(retVal);
        }
Пример #11
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ClaimValCodeLog> TableToList(DataTable table)
        {
            List <ClaimValCodeLog> retVal = new List <ClaimValCodeLog>();
            ClaimValCodeLog        claimValCodeLog;

            foreach (DataRow row in table.Rows)
            {
                claimValCodeLog = new ClaimValCodeLog();
                claimValCodeLog.ClaimValCodeLogNum = PIn.Long(row["ClaimValCodeLogNum"].ToString());
                claimValCodeLog.ClaimNum           = PIn.Long(row["ClaimNum"].ToString());
                claimValCodeLog.ClaimField         = PIn.String(row["ClaimField"].ToString());
                claimValCodeLog.ValCode            = PIn.String(row["ValCode"].ToString());
                claimValCodeLog.ValAmount          = PIn.Double(row["ValAmount"].ToString());
                claimValCodeLog.Ordinal            = PIn.Int(row["Ordinal"].ToString());
                retVal.Add(claimValCodeLog);
            }
            return(retVal);
        }
Пример #12
0
 ///<summary>Returns true if Update(ClaimValCodeLog,ClaimValCodeLog) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(ClaimValCodeLog claimValCodeLog, ClaimValCodeLog oldClaimValCodeLog)
 {
     if (claimValCodeLog.ClaimNum != oldClaimValCodeLog.ClaimNum)
     {
         return(true);
     }
     if (claimValCodeLog.ClaimField != oldClaimValCodeLog.ClaimField)
     {
         return(true);
     }
     if (claimValCodeLog.ValCode != oldClaimValCodeLog.ValCode)
     {
         return(true);
     }
     if (claimValCodeLog.ValAmount != oldClaimValCodeLog.ValAmount)
     {
         return(true);
     }
     if (claimValCodeLog.Ordinal != oldClaimValCodeLog.Ordinal)
     {
         return(true);
     }
     return(false);
 }
Пример #13
0
 ///<summary>Updates one ClaimValCodeLog 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(ClaimValCodeLog claimValCodeLog,ClaimValCodeLog oldClaimValCodeLog)
 {
     string command="";
     if(claimValCodeLog.ClaimNum != oldClaimValCodeLog.ClaimNum) {
         if(command!=""){ command+=",";}
         command+="ClaimNum = "+POut.Long(claimValCodeLog.ClaimNum)+"";
     }
     if(claimValCodeLog.ClaimField != oldClaimValCodeLog.ClaimField) {
         if(command!=""){ command+=",";}
         command+="ClaimField = '"+POut.String(claimValCodeLog.ClaimField)+"'";
     }
     if(claimValCodeLog.ValCode != oldClaimValCodeLog.ValCode) {
         if(command!=""){ command+=",";}
         command+="ValCode = '"+POut.String(claimValCodeLog.ValCode)+"'";
     }
     if(claimValCodeLog.ValAmount != oldClaimValCodeLog.ValAmount) {
         if(command!=""){ command+=",";}
         command+="ValAmount = '"+POut.Double(claimValCodeLog.ValAmount)+"'";
     }
     if(claimValCodeLog.Ordinal != oldClaimValCodeLog.Ordinal) {
         if(command!=""){ command+=",";}
         command+="Ordinal = "+POut.Int(claimValCodeLog.Ordinal)+"";
     }
     if(command==""){
         return;
     }
     command="UPDATE claimvalcodelog SET "+command
         +" WHERE ClaimValCodeLogNum = "+POut.Long(claimValCodeLog.ClaimValCodeLogNum);
     Db.NonQ(command);
 }
Пример #14
0
 ///<summary>Updates one ClaimValCodeLog in the database.</summary>
 internal static void Update(ClaimValCodeLog claimValCodeLog)
 {
     string command="UPDATE claimvalcodelog SET "
         +"ClaimNum          =  "+POut.Long  (claimValCodeLog.ClaimNum)+", "
         +"ClaimField        = '"+POut.String(claimValCodeLog.ClaimField)+"', "
         +"ValCode           = '"+POut.String(claimValCodeLog.ValCode)+"', "
         +"ValAmount         = '"+POut.Double(claimValCodeLog.ValAmount)+"', "
         +"Ordinal           =  "+POut.Int   (claimValCodeLog.Ordinal)+" "
         +"WHERE ClaimValCodeLogNum = "+POut.Long(claimValCodeLog.ClaimValCodeLogNum);
     Db.NonQ(command);
 }
Пример #15
0
 ///<summary>Inserts one ClaimValCodeLog into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ClaimValCodeLog claimValCodeLog)
 {
     return(InsertNoCache(claimValCodeLog, false));
 }