private void FullImport(object sql)
        {
            data_mapping_schema dms = data_mapping_schema.GetDefaultSchema;
            OleDbConnection     oConnect;
            DataTable           resultData = new DataTable();
            OleDbDataAdapter    oAdapter;

            try
            {
                oConnect = new OleDbConnection(dms.GetConnectionString(true));
                oConnect.Open();
            }
            catch (Exception err)
            {
                LoggingHelper.Log("Could not connect to DB in frmClaimSendHistory_Load", LogSeverity.Error, err, false);
                ImportTouchup();
                return;
            }



            oAdapter = new OleDbDataAdapter(sql.ToString(), oConnect);
            oAdapter.Fill(resultData);

            foreach (DataRow aRow in resultData.Rows)
            {
                CheckCreateEligibility(aRow);
            }

            system_options.LastEligibilityDate = DateTime.Now;

            ImportTouchup();
        }
예제 #2
0
        public static data_mapping_schema GetSchemaData()
        {
            data_mapping_schema aSchema    = new data_mapping_schema();
            DataTable           allSchemas = aSchema.Search(aSchema.SearchSQL + " ORDER BY schema_name");

            foreach (DataRow aRow in allSchemas.Rows)
            {
                aSchema = new data_mapping_schema();
                aSchema.Load(aRow);
            }
            return(aSchema);
        }
        private void frmClaimSendHistory_Load(object sender, EventArgs e)
        {
            data_mapping_schema dms = data_mapping_schema.GetDefaultSchema;

            dtpStart.Value = DateTime.Now.Subtract(new TimeSpan(365, 0, 0, 0));
            dtpEnd.Value   = DateTime.Now;

            try
            {
                oConnect = new OleDbConnection(dms.GetConnectionString(true));
                oConnect.Open();
            }
            catch (Exception err)
            {
                LoggingHelper.Log("Could not connect to DB in frmClaimSendHistory_Load", LogSeverity.Error, err, false);
                MessageBox.Show(this, "A connection to the database could not be established.");
                return;
            }
        }
예제 #4
0
        public static void createImport()
        {
            data_mapping_schema aSchema    = new data_mapping_schema();
            DataTable           allSchemas = aSchema.Search(aSchema.SearchSQL + " ORDER BY schema_name");
            int c = 0;

            foreach (DataRow aRow in allSchemas.Rows)
            {
                aSchema = new data_mapping_schema();
                aSchema.Load(aRow);
                if (c == 0)
                {
                    dms = aSchema;
                    c   = 1;
                }
            }



            //dms = GetSchemaData();
            GoImport();
            //ImportThread.RunWorkerAsync();
        }
        private void CheckEligibility()
        {
            data_mapping_schema dms = data_mapping_schema.GetDefaultSchema;
            OleDbConnection     oConnect;
            DataTable           resultData = new DataTable();
            OleDbDataAdapter    oAdapter;

            try
            {
                oConnect = new OleDbConnection(dms.GetConnectionString(true));
                oConnect.Open();
            }
            catch (Exception err)
            {
                LoggingHelper.Log("Could not connect to DB to send claims", LogSeverity.Error, err, false);
                return;
            }

            string sql = @"SELECT appt.patNAme as patient, 
payer.inscoName AS PAYER_NAME, payer.insID + '-' + payer.insDB AS Payer_ID, payer.STREET AS PAYER_ADDRESS1, payer.STREET2 AS PAYER_ADDRESS2, payer.CITY AS PAYER_CITY, payer.STATE AS PAYER_STATE,payer.ZIP AS PAYER_ZIP, 
appt.APPTDATE AS APPT_DATE, appt.time_hour AS APPT_HOUR, appt.time_minute AS APPT_MINUTE,
prov.NAME_FIRST AS Provider_FirstName, prov.NAME_LAST AS Provider_LastName, prov.ID1 AS Provider_NPI, prov.STATEID AS Provider_LicenseNo, 'CT' AS provider_state,
insured.idnum as Subscriber_ID, sub.lastname AS Subscriber_LastName, sub.firstname AS Subscriber_FirstName, sub.gender AS Subscriber_Gender, sub.birthdate AS Subscriber_DOB, payer.GroupNum as GroupNo, dep.patID + '-' + dep.patDB AS SubscriberDependentID,
dep.PRINSREL AS PatientRelation,
dep.patID + '-' + dep.PATDB as Dependent_ID, dep.LastName as Dependent_LastName, dep.FirstName as Dependent_FirstName, dep.gender AS Dependent_Gender, dep.BirthDate as Dependent_DOB

FROM DDB_APPT appt
INNER JOIN DDB_PAT_BASE dep ON (appt.PATID = dep.PATID AND appt.PATDB = dep.PATDB)
INNER JOIN DDB_INSURED insured ON (dep.PRINSUREDID = insured.INSUREDID AND dep.PRINSUREDDB = insured.insuredDB)
INNER JOIN DDB_INSURANCE_BASE payer ON (insured.insID = payer.insID AND insured.INSDB = payer.insDB)
INNER JOIN DDB_PAT_BASE sub ON (insured.insuredPartyID = sub.PATID AND insured.insuredPartyDB = sub.PATDB)
INNER JOIN DDB_RSC_BASE prov ON (prov.URSCID = appt.PRPROVID AND prov.RSCDB = appt.PRPROVDB)
WHERE (OPTYPE = 3) AND (";

            string whereClause = "";

            foreach (Control aControl in pnlResults.Controls)
            {
                if (aControl is ctlPatientEligibility)
                {
                    ctlPatientEligibility anAppointment = (ctlPatientEligibility)aControl;
                    if (anAppointment.CheckState)
                    {
                        if (whereClause != "")
                        {
                            whereClause += " OR";
                        }
                        whereClause += string.Format(" (APPTID = {0} AND APPTDB = {1})", anAppointment.EligibilityData.dentrix_id, anAppointment.EligibilityData.dentrix_db);
                    }
                }
            }

            sql += whereClause + ")";


            oAdapter = new OleDbDataAdapter(sql, oConnect);
            oAdapter.Fill(resultData);

            string fullDocAsList = EligibilityHelper.ConvertFromTable(resultData);

            ftpTransfer.Initialize();
            ftpTransfer.Show();

            ftpTransfer.UpdateMainLabel("Creating files to send to Mercury...", false);

            ParameterizedThreadStart ts = new ParameterizedThreadStart(UploadThreadSafe);
            Thread t = new Thread(ts);

            t.Start(fullDocAsList);
        }