コード例 #1
0
ファイル: ProviderErxCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Inserts one ProviderErx into the database.  Returns the new priKey.</summary>
 public static long Insert(ProviderErx providerErx)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         providerErx.ProviderErxNum = DbHelper.GetNextOracleKey("providererx", "ProviderErxNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(providerErx, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     providerErx.ProviderErxNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(providerErx, false));
     }
 }
コード例 #2
0
 public FormDoseSpotAssignUserId(long provErxNum)
 {
     InitializeComponent();
     //get providerErx from provErxNum that was passed in
     _providerErxCur = ProviderErxs.GetFirstOrDefault(x => x.ProviderErxNum == provErxNum);
     Lan.F(this);
 }
コード例 #3
0
ファイル: ProviderErxCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Inserts one ProviderErx into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ProviderErx providerErx)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(providerErx, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             providerErx.ProviderErxNum = DbHelper.GetNextOracleKey("providererx", "ProviderErxNum");                  //Cacheless method
         }
         return(InsertNoCache(providerErx, true));
     }
 }
コード例 #4
0
        ///<summary>Updates one ProviderErx in the database.</summary>
        public static void Update(ProviderErx providerErx)
        {
            string command = "UPDATE providererx SET "
                             + "PatNum            =  " + POut.Long(providerErx.PatNum) + ", "
                             + "NationalProviderID= '" + POut.String(providerErx.NationalProviderID) + "', "
                             + "IsEnabled         =  " + POut.Int((int)providerErx.IsEnabled) + ", "
                             + "IsIdentifyProofed =  " + POut.Bool(providerErx.IsIdentifyProofed) + ", "
                             + "IsSentToHq        =  " + POut.Bool(providerErx.IsSentToHq) + ", "
                             + "IsEpcs            =  " + POut.Bool(providerErx.IsEpcs) + ", "
                             + "ErxType           =  " + POut.Int((int)providerErx.ErxType) + ", "
                             + "UserId            = '" + POut.String(providerErx.UserId) + "', "
                             + "AccountId         = '" + POut.String(providerErx.AccountId) + "', "
                             + "RegistrationKeyNum=  " + POut.Long(providerErx.RegistrationKeyNum) + " "
                             + "WHERE ProviderErxNum = " + POut.Long(providerErx.ProviderErxNum);

            Db.NonQ(command);
        }
コード例 #5
0
ファイル: FormErxAccess.cs プロジェクト: kjb7749/testImport
 private void butEnable_Click(object sender, EventArgs e)
 {
     if (gridProviders.SelectedIndices.Length == 0)
     {
         MsgBox.Show(this, "At least one provider must be selected.");
         return;
     }
     gridProviders.BeginUpdate();
     for (int i = 0; i < gridProviders.SelectedIndices.Length; i++)
     {
         int          index = gridProviders.SelectedIndices[i];
         UI.ODGridRow row   = gridProviders.Rows[index];
         row.Cells[1].Text = "X";
         ProviderErx provErx = (ProviderErx)row.Tag;
         provErx.IsEnabled = ErxStatus.Enabled;
     }
     gridProviders.EndUpdate();
 }
コード例 #6
0
 private void butNotEPCS_Click(object sender, EventArgs e)
 {
     if (gridProviders.SelectedIndices.Length == 0)
     {
         MsgBox.Show(this, "At least one provider must be selected.");
         return;
     }
     gridProviders.BeginUpdate();
     for (int i = 0; i < gridProviders.SelectedIndices.Length; i++)
     {
         int        index = gridProviders.SelectedIndices[i];
         UI.GridRow row   = gridProviders.ListGridRows[index];
         row.Cells[3].Text = "";
         ProviderErx provErx = (ProviderErx)row.Tag;
         provErx.IsEpcs = false;
     }
     gridProviders.EndUpdate();
 }
コード例 #7
0
 ///<summary>Returns true if Update(ProviderErx,ProviderErx) 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(ProviderErx providerErx, ProviderErx oldProviderErx)
 {
     if (providerErx.PatNum != oldProviderErx.PatNum)
     {
         return(true);
     }
     if (providerErx.NationalProviderID != oldProviderErx.NationalProviderID)
     {
         return(true);
     }
     if (providerErx.IsEnabled != oldProviderErx.IsEnabled)
     {
         return(true);
     }
     if (providerErx.IsIdentifyProofed != oldProviderErx.IsIdentifyProofed)
     {
         return(true);
     }
     if (providerErx.IsSentToHq != oldProviderErx.IsSentToHq)
     {
         return(true);
     }
     if (providerErx.IsEpcs != oldProviderErx.IsEpcs)
     {
         return(true);
     }
     if (providerErx.ErxType != oldProviderErx.ErxType)
     {
         return(true);
     }
     if (providerErx.UserId != oldProviderErx.UserId)
     {
         return(true);
     }
     if (providerErx.AccountId != oldProviderErx.AccountId)
     {
         return(true);
     }
     if (providerErx.RegistrationKeyNum != oldProviderErx.RegistrationKeyNum)
     {
         return(true);
     }
     return(false);
 }
コード例 #8
0
ファイル: FormErxAccess.cs プロジェクト: kjb7749/testImport
 private void butNotIdpd_Click(object sender, EventArgs e)
 {
     if (gridProviders.SelectedIndices.Length == 0)
     {
         MsgBox.Show(this, "At least one provider must be selected.");
         return;
     }
     if (!MsgBox.Show(this, true, "Only use this button if the selected providers were set to IDP'd accidentally.  Continue?"))
     {
         return;
     }
     gridProviders.BeginUpdate();
     for (int i = 0; i < gridProviders.SelectedIndices.Length; i++)
     {
         int          index = gridProviders.SelectedIndices[i];
         UI.ODGridRow row   = gridProviders.Rows[index];
         row.Cells[2].Text = "";
         ProviderErx provErx = (ProviderErx)row.Tag;
         provErx.IsIdentifyProofed = false;
     }
     gridProviders.EndUpdate();
 }
コード例 #9
0
        ///<summary>Inserts one ProviderErx into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ProviderErx providerErx, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO providererx (";

            if (!useExistingPK && isRandomKeys)
            {
                providerErx.ProviderErxNum = ReplicationServers.GetKeyNoCache("providererx", "ProviderErxNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ProviderErxNum,";
            }
            command += "PatNum,NationalProviderID,IsEnabled,IsIdentifyProofed,IsSentToHq,IsEpcs,ErxType,UserId,AccountId,RegistrationKeyNum) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(providerErx.ProviderErxNum) + ",";
            }
            command +=
                POut.Long(providerErx.PatNum) + ","
                + "'" + POut.String(providerErx.NationalProviderID) + "',"
                + POut.Int((int)providerErx.IsEnabled) + ","
                + POut.Bool(providerErx.IsIdentifyProofed) + ","
                + POut.Bool(providerErx.IsSentToHq) + ","
                + POut.Bool(providerErx.IsEpcs) + ","
                + POut.Int((int)providerErx.ErxType) + ","
                + "'" + POut.String(providerErx.UserId) + "',"
                + "'" + POut.String(providerErx.AccountId) + "',"
                + POut.Long(providerErx.RegistrationKeyNum) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                providerErx.ProviderErxNum = Db.NonQ(command, true, "ProviderErxNum", "providerErx");
            }
            return(providerErx.ProviderErxNum);
        }
コード例 #10
0
ファイル: FormErxAccess.cs プロジェクト: kjb7749/testImport
 private void butDisable_Click(object sender, EventArgs e)
 {
     if (gridProviders.SelectedIndices.Length == 0)
     {
         MsgBox.Show(this, "At least one provider must be selected.");
         return;
     }
     if (!MsgBox.Show(this, true, "Only use this button if the selected providers were Enabled accidentally or if the provider has canceled eRx.  "
                      + "Continue?"))
     {
         return;
     }
     gridProviders.BeginUpdate();
     for (int i = 0; i < gridProviders.SelectedIndices.Length; i++)
     {
         int          index = gridProviders.SelectedIndices[i];
         UI.ODGridRow row   = gridProviders.Rows[index];
         row.Cells[1].Text = "";
         ProviderErx provErx = (ProviderErx)row.Tag;
         provErx.IsEnabled = ErxStatus.Disabled;
     }
     gridProviders.EndUpdate();
 }
コード例 #11
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ProviderErx> TableToList(DataTable table)
        {
            List <ProviderErx> retVal = new List <ProviderErx>();
            ProviderErx        providerErx;

            foreach (DataRow row in table.Rows)
            {
                providerErx = new ProviderErx();
                providerErx.ProviderErxNum     = PIn.Long(row["ProviderErxNum"].ToString());
                providerErx.PatNum             = PIn.Long(row["PatNum"].ToString());
                providerErx.NationalProviderID = PIn.String(row["NationalProviderID"].ToString());
                providerErx.IsEnabled          = (OpenDentBusiness.ErxStatus)PIn.Int(row["IsEnabled"].ToString());
                providerErx.IsIdentifyProofed  = PIn.Bool(row["IsIdentifyProofed"].ToString());
                providerErx.IsSentToHq         = PIn.Bool(row["IsSentToHq"].ToString());
                providerErx.IsEpcs             = PIn.Bool(row["IsEpcs"].ToString());
                providerErx.ErxType            = (OpenDentBusiness.ErxOption)PIn.Int(row["ErxType"].ToString());
                providerErx.UserId             = PIn.String(row["UserId"].ToString());
                providerErx.AccountId          = PIn.String(row["AccountId"].ToString());
                providerErx.RegistrationKeyNum = PIn.Long(row["RegistrationKeyNum"].ToString());
                retVal.Add(providerErx);
            }
            return(retVal);
        }
コード例 #12
0
        ///<summary>Updates one ProviderErx 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(ProviderErx providerErx, ProviderErx oldProviderErx)
        {
            string command = "";

            if (providerErx.PatNum != oldProviderErx.PatNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "PatNum = " + POut.Long(providerErx.PatNum) + "";
            }
            if (providerErx.NationalProviderID != oldProviderErx.NationalProviderID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "NationalProviderID = '" + POut.String(providerErx.NationalProviderID) + "'";
            }
            if (providerErx.IsEnabled != oldProviderErx.IsEnabled)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsEnabled = " + POut.Int((int)providerErx.IsEnabled) + "";
            }
            if (providerErx.IsIdentifyProofed != oldProviderErx.IsIdentifyProofed)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsIdentifyProofed = " + POut.Bool(providerErx.IsIdentifyProofed) + "";
            }
            if (providerErx.IsSentToHq != oldProviderErx.IsSentToHq)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsSentToHq = " + POut.Bool(providerErx.IsSentToHq) + "";
            }
            if (providerErx.IsEpcs != oldProviderErx.IsEpcs)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsEpcs = " + POut.Bool(providerErx.IsEpcs) + "";
            }
            if (providerErx.ErxType != oldProviderErx.ErxType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ErxType = " + POut.Int((int)providerErx.ErxType) + "";
            }
            if (providerErx.UserId != oldProviderErx.UserId)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "UserId = '" + POut.String(providerErx.UserId) + "'";
            }
            if (providerErx.AccountId != oldProviderErx.AccountId)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "AccountId = '" + POut.String(providerErx.AccountId) + "'";
            }
            if (providerErx.RegistrationKeyNum != oldProviderErx.RegistrationKeyNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "RegistrationKeyNum = " + POut.Long(providerErx.RegistrationKeyNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE providererx SET " + command
                      + " WHERE ProviderErxNum = " + POut.Long(providerErx.ProviderErxNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #13
0
 ///<summary>Inserts one ProviderErx into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ProviderErx providerErx)
 {
     return(InsertNoCache(providerErx, false));
 }