Ejemplo n.º 1
0
        ///<summary>Inserts one ProviderClinic into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(ProviderClinic providerClinic, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                providerClinic.ProviderClinicNum = ReplicationServers.GetKey("providerclinic", "ProviderClinicNum");
            }
            string command = "INSERT INTO providerclinic (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "ProviderClinicNum,";
            }
            command += "ProvNum,ClinicNum,DEANum) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(providerClinic.ProviderClinicNum) + ",";
            }
            command +=
                POut.Long(providerClinic.ProvNum) + ","
                + POut.Long(providerClinic.ClinicNum) + ","
                + "'" + POut.String(providerClinic.DEANum) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                providerClinic.ProviderClinicNum = Db.NonQ(command, true, "ProviderClinicNum", "providerClinic");
            }
            return(providerClinic.ProviderClinicNum);
        }
Ejemplo n.º 2
0
        private void gridProvProperties_CellLeave(object sender, ODGridClickEventArgs e)
        {
            string         newDEA   = PIn.String(gridProvProperties.Rows[e.Row].Cells[e.Col].Text);
            ProviderClinic provClin = (ProviderClinic)gridProvProperties.Rows[e.Row].Tag;

            provClin.DEANum = newDEA;
        }
Ejemplo n.º 3
0
 ///<summary>Returns true if provClinic is empty. ProvClinic is considered empty if the DEANum,StateLicense,StateRxID,and StateWereLicensed are
 ///empty.</summary>
 private bool IsEmpty(ProviderClinic provClinic)
 {
     return(provClinic != null && string.IsNullOrEmpty(provClinic.DEANum) &&
            string.IsNullOrEmpty(provClinic.StateLicense) &&
            string.IsNullOrEmpty(provClinic.StateRxID) &&
            string.IsNullOrEmpty(provClinic.StateWhereLicensed));
 }
Ejemplo n.º 4
0
 ///<summary>Inserts one ProviderClinic into the database.  Returns the new priKey.</summary>
 public static long Insert(ProviderClinic providerClinic)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         providerClinic.ProviderClinicNum = DbHelper.GetNextOracleKey("providerclinic", "ProviderClinicNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(providerClinic, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     providerClinic.ProviderClinicNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(providerClinic, false));
     }
 }
Ejemplo n.º 5
0
        private void gridProvProperties_CellLeave(object sender, ODGridClickEventArgs e)
        {
            GridRow selectedRow = gridProvProperties.SelectedGridRows.First();

            if (selectedRow == null)
            {
                return;
            }
            ProviderClinic provClin    = (ProviderClinic)selectedRow.Tag;
            string         strNewValue = PIn.String(selectedRow.Cells[e.Col].Text);

            if (e.Col == 1)
            {
                provClin.DEANum = strNewValue;
            }
            else if (e.Col == 2)
            {
                provClin.StateLicense = strNewValue;
            }
            else if (e.Col == 3)
            {
                provClin.StateRxID = strNewValue;
            }
            else if (e.Col == 4)
            {
                provClin.StateWhereLicensed = strNewValue;
            }
        }
Ejemplo n.º 6
0
 ///<summary>Returns true if Update(ProviderClinic,ProviderClinic) 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(ProviderClinic providerClinic, ProviderClinic oldProviderClinic)
 {
     if (providerClinic.ProvNum != oldProviderClinic.ProvNum)
     {
         return(true);
     }
     if (providerClinic.ClinicNum != oldProviderClinic.ClinicNum)
     {
         return(true);
     }
     if (providerClinic.DEANum != oldProviderClinic.DEANum)
     {
         return(true);
     }
     if (providerClinic.StateLicense != oldProviderClinic.StateLicense)
     {
         return(true);
     }
     if (providerClinic.StateRxID != oldProviderClinic.StateRxID)
     {
         return(true);
     }
     if (providerClinic.StateWhereLicensed != oldProviderClinic.StateWhereLicensed)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 7
0
        ///<summary>Inserts one ProviderClinic into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(ProviderClinic providerClinic, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO providerclinic (";

            if (!useExistingPK && isRandomKeys)
            {
                providerClinic.ProviderClinicNum = ReplicationServers.GetKeyNoCache("providerclinic", "ProviderClinicNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "ProviderClinicNum,";
            }
            command += "ProvNum,ClinicNum,DEANum) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(providerClinic.ProviderClinicNum) + ",";
            }
            command +=
                POut.Long(providerClinic.ProvNum) + ","
                + POut.Long(providerClinic.ClinicNum) + ","
                + "'" + POut.String(providerClinic.DEANum) + "')";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                providerClinic.ProviderClinicNum = Db.NonQ(command, true, "ProviderClinicNum", "providerClinic");
            }
            return(providerClinic.ProviderClinicNum);
        }
Ejemplo n.º 8
0
        public static void Update(ProviderClinic providerClinic)
        {
            List <ProviderClinic> curProvClinic = ProviderClinics.GetListForProvider(providerClinic.ProvNum);

            ProviderClinics.Sync(new List <ProviderClinic> {
                providerClinic
            }, curProvClinic);
        }
Ejemplo n.º 9
0
        ///<summary>Updates one ProviderClinic in the database.</summary>
        public static void Update(ProviderClinic providerClinic)
        {
            string command = "UPDATE providerclinic SET "
                             + "ProvNum          =  " + POut.Long(providerClinic.ProvNum) + ", "
                             + "ClinicNum        =  " + POut.Long(providerClinic.ClinicNum) + ", "
                             + "DEANum           = '" + POut.String(providerClinic.DEANum) + "' "
                             + "WHERE ProviderClinicNum = " + POut.Long(providerClinic.ProviderClinicNum);

            Db.NonQ(command);
        }
Ejemplo n.º 10
0
        ///<summary>Updates one ProviderClinic in the database.</summary>
        public static void Update(ProviderClinic providerClinic)
        {
            string command = "UPDATE providerclinic SET "
                             + "ProvNum           =  " + POut.Long(providerClinic.ProvNum) + ", "
                             + "ClinicNum         =  " + POut.Long(providerClinic.ClinicNum) + ", "
                             + "DEANum            = '" + POut.String(providerClinic.DEANum) + "', "
                             + "StateLicense      = '" + POut.String(providerClinic.StateLicense) + "', "
                             + "StateRxID         = '" + POut.String(providerClinic.StateRxID) + "', "
                             + "StateWhereLicensed= '" + POut.String(providerClinic.StateWhereLicensed) + "' "
                             + "WHERE ProviderClinicNum = " + POut.Long(providerClinic.ProviderClinicNum);

            Db.NonQ(command);
        }
Ejemplo n.º 11
0
 private void butOK_Click(object sender, EventArgs e)
 {
     ListProviderClinicOut = new List <ProviderClinic>();
     foreach (GridRow row in gridProvProperties.ListGridRows)
     {
         ProviderClinic provClinic = (ProviderClinic)row.Tag;
         //always add the default _provClinicDefault
         if (provClinic == null || (provClinic != _provClinicDefault && IsEmpty(provClinic)))
         {
             continue;                    //No overrided added/edited or override were removed
         }
         ListProviderClinicOut.Add(provClinic);
     }
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 12
0
 ///<summary>Inserts one ProviderClinic into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ProviderClinic providerClinic)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(providerClinic, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             providerClinic.ProviderClinicNum = DbHelper.GetNextOracleKey("providerclinic", "ProviderClinicNum");                  //Cacheless method
         }
         return(InsertNoCache(providerClinic, true));
     }
 }
Ejemplo n.º 13
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <ProviderClinic> TableToList(DataTable table)
        {
            List <ProviderClinic> retVal = new List <ProviderClinic>();
            ProviderClinic        providerClinic;

            foreach (DataRow row in table.Rows)
            {
                providerClinic = new ProviderClinic();
                providerClinic.ProviderClinicNum = PIn.Long(row["ProviderClinicNum"].ToString());
                providerClinic.ProvNum           = PIn.Long(row["ProvNum"].ToString());
                providerClinic.ClinicNum         = PIn.Long(row["ClinicNum"].ToString());
                providerClinic.DEANum            = PIn.String(row["DEANum"].ToString());
                retVal.Add(providerClinic);
            }
            return(retVal);
        }
Ejemplo n.º 14
0
 ///<summary>Returns true if Update(ProviderClinic,ProviderClinic) 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(ProviderClinic providerClinic, ProviderClinic oldProviderClinic)
 {
     if (providerClinic.ProvNum != oldProviderClinic.ProvNum)
     {
         return(true);
     }
     if (providerClinic.ClinicNum != oldProviderClinic.ClinicNum)
     {
         return(true);
     }
     if (providerClinic.DEANum != oldProviderClinic.DEANum)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 15
0
        ///<summary>Tests that, when creating Patient Characteristics for submission to NewCrop, the Patient's height, heightUnits, weight
        ///and weightUnits are _only_ included when specified. In the below case, only the height information is gvien and thus only the height
        ///information should be in the final results.</summary>
        public void NewCrop_AddingHeightOnly()
        {
            long    provNum = ProviderT.CreateProvider("DOC", "Beverly", "Crusher");                                                                        //Provider
            Patient pat     = PatientT.CreatePatient(priProvNum: provNum, email: "*****@*****.**",
                                                     phone: "1234567", lName: "Wayne", fName: "Bruce", preferredName: "Batman", setPortalAccessInfo: true); //Patient
            Employee       emp            = EmployeeT.CreateEmployee("");                                                                                   //Employee
            ProviderClinic providerClinic = ProviderClinicT.CreateProviderClinic(Providers.GetProv(provNum), dEANum: "93485", stateRxID: "439578");

            ProviderClinicT.Update(providerClinic);
            Vitalsign vitals = VitalsignT.CreateVitalsign(patNum: pat.PatNum, height: 6, heightExamCode: "3137-7", weightExamCode: "3141-9");   //Vitalsigns

            VitalsignT.Update(vitals: vitals, patNum: pat.PatNum);
            ErxXml.BuildNewCropClickThroughXml(Providers.GetProv(provNum), emp, pat, out NCScript nCScript);
            Assert.AreEqual("6", nCScript.Patient.PatientCharacteristics.height);
            Assert.AreEqual("inches", nCScript.Patient.PatientCharacteristics.heightUnits);
            Assert.AreEqual(null, nCScript.Patient.PatientCharacteristics.weight);
            Assert.AreEqual(WeightUnitType.Item, nCScript.Patient.PatientCharacteristics.weightUnits);           //WeightUnitType.Item is default for enum (0)
        }
Ejemplo n.º 16
0
        ///<summary>Updates one ProviderClinic 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(ProviderClinic providerClinic, ProviderClinic oldProviderClinic)
        {
            string command = "";

            if (providerClinic.ProvNum != oldProviderClinic.ProvNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ProvNum = " + POut.Long(providerClinic.ProvNum) + "";
            }
            if (providerClinic.ClinicNum != oldProviderClinic.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(providerClinic.ClinicNum) + "";
            }
            if (providerClinic.DEANum != oldProviderClinic.DEANum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DEANum = '" + POut.String(providerClinic.DEANum) + "'";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE providerclinic SET " + command
                      + " WHERE ProviderClinicNum = " + POut.Long(providerClinic.ProviderClinicNum);
            Db.NonQ(command);
            return(true);
        }
Ejemplo n.º 17
0
 ///<summary>Inserts one ProviderClinic into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(ProviderClinic providerClinic)
 {
     return(InsertNoCache(providerClinic, false));
 }
Ejemplo n.º 18
0
        ///<summary>Generates all the xml up to the point where the first statement would go.</summary>
        public static void GeneratePracticeInfo(XmlWriter writer, long clinicNum)
        {
            Clinic clinic       = Clinics.GetClinic(clinicNum);
            Ebill  eBillClinic  = Ebills.GetForClinic(clinicNum);
            Ebill  eBillDefault = Ebills.GetForClinic(0);

            writer.WriteProcessingInstruction("xml", "version = \"1.0\" standalone=\"yes\"");
            writer.WriteStartElement("EISStatementFile");
            writer.WriteAttributeString("VendorID", PrefC.GetString(PrefName.BillingElectVendorId));
            writer.WriteAttributeString("OutputFormat", "StmOut_Blue6Col");
            writer.WriteAttributeString("Version", "2");
            writer.WriteElementString("SubmitDate", DateTime.Today.ToString("yyyy-MM-dd"));
            writer.WriteElementString("PrimarySubmitter", PrefC.GetString(PrefName.BillingElectVendorPMSCode));
            writer.WriteElementString("Transmitter", "EHG");
            writer.WriteStartElement("Practice");
            string billingClientAccountNumber = eBillDefault.ClientAcctNumber;

            if (eBillClinic != null && eBillClinic.ClientAcctNumber != "")         //clinic eBill entry exists, check the fields for overrides
            {
                billingClientAccountNumber = eBillClinic.ClientAcctNumber;
            }
            writer.WriteAttributeString("AccountNumber", billingClientAccountNumber);
            //sender address----------------------------------------------------------
            writer.WriteStartElement("SenderAddress");
            if (clinic == null)
            {
                writer.WriteElementString("Name", PrefC.GetString(PrefName.PracticeTitle));
            }
            else
            {
                writer.WriteElementString("Name", clinic.Description);
            }
            if (eBillClinic == null)
            {
                WriteAddress(writer, eBillDefault.PracticeAddress, clinic);
            }
            else
            {
                WriteAddress(writer, eBillClinic.PracticeAddress, clinic);
            }
            writer.WriteEndElement();            //senderAddress
            //remit address----------------------------------------------------------
            writer.WriteStartElement("RemitAddress");
            if (clinic == null)
            {
                writer.WriteElementString("Name", PrefC.GetString(PrefName.PracticeTitle));
            }
            else
            {
                writer.WriteElementString("Name", clinic.Description);
            }
            if (eBillClinic == null)
            {
                WriteAddress(writer, eBillDefault.RemitAddress, clinic);
            }
            else
            {
                WriteAddress(writer, eBillClinic.RemitAddress, clinic);
            }
            writer.WriteEndElement();            //remitAddress
            //Rendering provider------------------------------------------------------
            Provider prov = Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));

            writer.WriteStartElement("RenderingProvider");
            writer.WriteElementString("Name", prov.GetFormalName());
            ProviderClinic provClinic = ProviderClinics.GetOneOrDefault(prov.ProvNum, clinicNum);

            writer.WriteElementString("LicenseNumber", (provClinic == null ? "" : provClinic.StateLicense));
            writer.WriteElementString("State", PrefC.GetString(PrefName.PracticeST));
            writer.WriteEndElement();            //Rendering provider
        }
Ejemplo n.º 19
0
        private void FillGrid()
        {
            Cursor = Cursors.WaitCursor;
            gridProvProperties.BeginUpdate();
            gridProvProperties.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("TableProviderProperties", "Clinic"), 120);

            gridProvProperties.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableProviderProperties", "DEA Num"), 120, true);
            gridProvProperties.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableProviderProperties", "State License Num"), 120, true);
            gridProvProperties.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableProviderProperties", "State Rx ID"), 120, true);
            gridProvProperties.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableProviderProperties", "State Where Licensed"), 120, true);
            gridProvProperties.ListGridColumns.Add(col);
            gridProvProperties.ListGridRows.Clear();
            GridRow row;

            _provClinicDefault = _listProvClinic.Find(x => x.ClinicNum == 0);
            //Didn't have an HQ row
            if (_provClinicDefault == null)           //Doesn't exist in list
            {
                _provClinicDefault = ProviderClinics.GetOne(_provCur.ProvNum, 0);
                if (_provClinicDefault == null)               //Doesn't exist in database
                {
                    _provClinicDefault = new ProviderClinic {
                        ProvNum            = _provCur.ProvNum,
                        ClinicNum          = 0,
                        DEANum             = _provCur.DEANum,
                        StateLicense       = _provCur.StateLicense,
                        StateRxID          = _provCur.StateRxID,
                        StateWhereLicensed = _provCur.StateWhereLicensed,
                    };
                }
                _listProvClinic.Add(_provClinicDefault);                //If not in list, add to list.
            }
            row = new GridRow();
            row.Cells.Add("Default");
            row.Cells.Add(_provClinicDefault.DEANum);
            row.Cells.Add(_provClinicDefault.StateLicense);
            row.Cells.Add(_provClinicDefault.StateRxID);
            row.Cells.Add(_provClinicDefault.StateWhereLicensed);
            row.Tag = _provClinicDefault;
            gridProvProperties.ListGridRows.Add(row);
            if (PrefC.HasClinicsEnabled)
            {
                foreach (Clinic clinicCur in Clinics.GetForUserod(Security.CurUser))
                {
                    row = new GridRow();
                    ProviderClinic provClinic = _listProvClinic.Find(x => x.ClinicNum == clinicCur.ClinicNum);
                    //Doesn't exist in Db, create a new one
                    if (provClinic == null)
                    {
                        provClinic = new ProviderClinic()
                        {
                            ProvNum   = _provCur.ProvNum,
                            ClinicNum = clinicCur.ClinicNum,
                        };
                        _listProvClinic.Add(provClinic);
                    }
                    row.Cells.Add(clinicCur.Abbr);
                    row.Cells.Add(provClinic.DEANum);
                    row.Cells.Add(provClinic.StateLicense);
                    row.Cells.Add(provClinic.StateRxID);
                    row.Cells.Add(provClinic.StateWhereLicensed);
                    row.Tag = provClinic;
                    gridProvProperties.ListGridRows.Add(row);
                }
            }
            gridProvProperties.EndUpdate();
            Cursor = Cursors.Default;
        }