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

            FR_L5OM_GMFT_1018_Array functionReturn = new FR_L5OM_GMFT_1018_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_Memos_for_Tenant", ex);
            }
            return(functionReturn);
        }
Ejemplo n.º 2
0
        protected static FR_L5OM_GMFT_1018_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5OM_GMFT_1018_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_OphthalMemos.Atomic.Retrieval.SQL.cls_Get_Memos_for_Tenant.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 <L5OM_GMFT_1018_raw> results = new List <L5OM_GMFT_1018_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[] { "CMN_BPT_MemoID", "CreatedBy_Account_RefID", "Memo_Title", "Memo_Abbreviation", "Memo_Text", "UpdatedOn", "UpdatedBy_Account_RefID", "Creation_Timestamp", "DocumentStructureHeader_RefID", "DOC_StructureID", "Practice_BusinessParticipantID", "Practice_CMN_BPT_Memo_RelatedParticipantID", "Doctor_CMN_BPT_BusinessParticipantID", "Doctor_CMN_BPT_Memo_RelatedParticipantID", "Field_Key", "CMN_BPT_Memo_AdditionalFieldID", "Field_Value" });
                while (reader.Read())
                {
                    L5OM_GMFT_1018_raw resultItem = new L5OM_GMFT_1018_raw();
                    //0:Parameter CMN_BPT_MemoID of type Guid
                    resultItem.CMN_BPT_MemoID = reader.GetGuid(0);
                    //1:Parameter CreatedBy_Account_RefID of type Guid
                    resultItem.CreatedBy_Account_RefID = reader.GetGuid(1);
                    //2:Parameter Memo_Title of type String
                    resultItem.Memo_Title = reader.GetString(2);
                    //3:Parameter Memo_Abbreviation of type String
                    resultItem.Memo_Abbreviation = reader.GetString(3);
                    //4:Parameter Memo_Text of type String
                    resultItem.Memo_Text = reader.GetString(4);
                    //5:Parameter UpdatedOn of type DateTime
                    resultItem.UpdatedOn = reader.GetDate(5);
                    //6:Parameter UpdatedBy_Account_RefID of type Guid
                    resultItem.UpdatedBy_Account_RefID = reader.GetGuid(6);
                    //7:Parameter Creation_Timestamp of type DateTime
                    resultItem.Creation_Timestamp = reader.GetDate(7);
                    //8:Parameter DocumentStructureHeader_RefID of type Guid
                    resultItem.DocumentStructureHeader_RefID = reader.GetGuid(8);
                    //9:Parameter DOC_StructureID of type Guid
                    resultItem.DOC_StructureID = reader.GetGuid(9);
                    //10:Parameter Practice_BusinessParticipantID of type Guid
                    resultItem.Practice_BusinessParticipantID = reader.GetGuid(10);
                    //11:Parameter Practice_CMN_BPT_Memo_RelatedParticipantID of type Guid
                    resultItem.Practice_CMN_BPT_Memo_RelatedParticipantID = reader.GetGuid(11);
                    //12:Parameter Doctor_CMN_BPT_BusinessParticipantID of type Guid
                    resultItem.Doctor_CMN_BPT_BusinessParticipantID = reader.GetGuid(12);
                    //13:Parameter Doctor_CMN_BPT_Memo_RelatedParticipantID of type Guid
                    resultItem.Doctor_CMN_BPT_Memo_RelatedParticipantID = reader.GetGuid(13);
                    //14:Parameter Field_Key of type String
                    resultItem.Field_Key = reader.GetString(14);
                    //15:Parameter CMN_BPT_Memo_AdditionalFieldID of type Guid
                    resultItem.CMN_BPT_Memo_AdditionalFieldID = reader.GetGuid(15);
                    //16:Parameter Field_Value of type String
                    resultItem.Field_Value = reader.GetString(16);

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

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