Esempio n. 1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_ED_GATOS_1212_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_ED_GATOS_1212_Array functionReturn = new FR_ED_GATOS_1212_Array();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_Get_All_Treatments_OLD_System", ex);
            }
            return(functionReturn);
        }
Esempio n. 2
0
        protected static FR_ED_GATOS_1212_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_ED_GATOS_1212_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "DataImporter.DBMethods.ExportData.Atomic.Retrieval.SQL.cls_Get_All_Treatments_OLD_System.sql";

            command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd();
            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket);
            command.CommandTimeout = QueryTimeout;

            List <ED_GATOS_1212_raw> results = new List <ED_GATOS_1212_raw>();
            var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
            var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new string[] { "HEC_Patient_TreatmentID", "isTreatmentScheduled", "isTreatmentBilled", "treatmentScheduledDate", "treatmentPerformedDate", "isTreatmentPerformed", "PatientFirstName", "PatientLastName", "HealthInsurance_Number", "OPperformedDoctorLANR", "OPperformedDoctorFirstName", "OPperformedDoctorLastName", "OPscheduledDoctorLANR", "OPScheduledDoctorFirstName", "OPScheduledDoctorLastName", "BSNR", "PracticeName", "IsTreatmentOfLeftEye", "IsTreatmentOfRightEye", "ICD10_Code", "diagnnoseID", "DiagnosedOnDate", "HEC_Patient_Treatment_RequiredProductID", "ArticleName", "PZN" });
                while (reader.Read())
                {
                    ED_GATOS_1212_raw resultItem = new ED_GATOS_1212_raw();
                    //0:Parameter HEC_Patient_TreatmentID of type Guid
                    resultItem.HEC_Patient_TreatmentID = reader.GetGuid(0);
                    //1:Parameter isTreatmentScheduled of type bool
                    resultItem.isTreatmentScheduled = reader.GetBoolean(1);
                    //2:Parameter isTreatmentBilled of type bool
                    resultItem.isTreatmentBilled = reader.GetBoolean(2);
                    //3:Parameter treatmentScheduledDate of type DateTime
                    resultItem.treatmentScheduledDate = reader.GetDate(3);
                    //4:Parameter treatmentPerformedDate of type DateTime
                    resultItem.treatmentPerformedDate = reader.GetDate(4);
                    //5:Parameter isTreatmentPerformed of type bool
                    resultItem.isTreatmentPerformed = reader.GetBoolean(5);
                    //6:Parameter PatientFirstName of type String
                    resultItem.PatientFirstName = reader.GetString(6);
                    //7:Parameter PatientLastName of type String
                    resultItem.PatientLastName = reader.GetString(7);
                    //8:Parameter HealthInsurance_Number of type String
                    resultItem.HealthInsurance_Number = reader.GetString(8);
                    //9:Parameter OPperformedDoctorLANR of type String
                    resultItem.OPperformedDoctorLANR = reader.GetString(9);
                    //10:Parameter OPperformedDoctorFirstName of type String
                    resultItem.OPperformedDoctorFirstName = reader.GetString(10);
                    //11:Parameter OPperformedDoctorLastName of type String
                    resultItem.OPperformedDoctorLastName = reader.GetString(11);
                    //12:Parameter OPscheduledDoctorLANR of type String
                    resultItem.OPscheduledDoctorLANR = reader.GetString(12);
                    //13:Parameter OPScheduledDoctorFirstName of type String
                    resultItem.OPScheduledDoctorFirstName = reader.GetString(13);
                    //14:Parameter OPScheduledDoctorLastName of type String
                    resultItem.OPScheduledDoctorLastName = reader.GetString(14);
                    //15:Parameter BSNR of type String
                    resultItem.BSNR = reader.GetString(15);
                    //16:Parameter PracticeName of type String
                    resultItem.PracticeName = reader.GetString(16);
                    //17:Parameter IsTreatmentOfLeftEye of type bool
                    resultItem.IsTreatmentOfLeftEye = reader.GetBoolean(17);
                    //18:Parameter IsTreatmentOfRightEye of type bool
                    resultItem.IsTreatmentOfRightEye = reader.GetBoolean(18);
                    //19:Parameter ICD10_Code of type String
                    resultItem.ICD10_Code = reader.GetString(19);
                    //20:Parameter diagnnoseID of type Guid
                    resultItem.diagnnoseID = reader.GetGuid(20);
                    //21:Parameter DiagnosedOnDate of type DateTime
                    resultItem.DiagnosedOnDate = reader.GetDate(21);
                    //22:Parameter HEC_Patient_Treatment_RequiredProductID of type Guid
                    resultItem.HEC_Patient_Treatment_RequiredProductID = reader.GetGuid(22);
                    //23:Parameter ArticleName of type String
                    resultItem.ArticleName = reader.GetString(23);
                    //24:Parameter PZN of type String
                    resultItem.PZN = reader.GetString(24);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_All_Treatments_OLD_System", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = ED_GATOS_1212_raw.Convert(results).ToArray();
            return(returnStatus);
        }