コード例 #1
0
        protected static FR_PA_GDAPV_1629 Execute(DbConnection Connection, DbTransaction Transaction, P_PA_GDAPV_1629 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_PA_GDAPV_1629();
            returnValue.Result = new PA_GDAPV_1629();
            List <PA_GDAPV_1629_Contracts> ContractList = new List <PA_GDAPV_1629_Contracts>();


            if (Parameter.isPracticeLoggedIn)
            {
                var data = cls_Get_AllContracts_for_Practice_Doctors.Invoke(Connection, Transaction, new P_DO_GACfPD_1252 {
                    PracticeID = Parameter.ID
                }, securityTicket).Result;
                if (data.Length != 0)
                {
                    data = data.Where(d => d.ValidThrough == DateTime.MinValue || d.ValidThrough > DateTime.Now.Date).ToArray();
                }

                foreach (var item in data)
                {
                    PA_GDAPV_1629_Contracts contract = new PA_GDAPV_1629_Contracts();
                    contract.ID           = item.CMN_CTR_ContractID;
                    contract.Name         = item.ContractName;
                    contract.ValidFrom    = item.ValidFrom;
                    contract.ValidThrough = item.ValidThrough;
                    contract.participation_consent_valid_days = item.participation_consent_valid_days;
                    if (ContractList.Where(i => i.ID == contract.ID).FirstOrDefault() == null)
                    {
                        ContractList.Add(contract);
                    }
                }
            }
            else
            {
                var data = cls_Get_AllContracts_for_DoctorID.Invoke(Connection, Transaction, new P_DO_GACDID_1320 {
                    DoctorID = Parameter.ID
                }, securityTicket).Result;
                if (data.Length != 0)
                {
                    data = data.Where(d => d.ValidThrough == DateTime.MinValue || d.ValidThrough > DateTime.Now.Date).ToArray();
                }

                foreach (var item in data)
                {
                    PA_GDAPV_1629_Contracts contract = new PA_GDAPV_1629_Contracts();
                    contract.ID           = item.CMN_CTR_ContractID;
                    contract.Name         = item.ContractName;
                    contract.ValidFrom    = item.ValidFrom;
                    contract.ValidThrough = item.ValidThrough;
                    contract.participation_consent_valid_days = item.participation_consent_valid_days;
                    if (ContractList.Where(i => i.ID == contract.ID).FirstOrDefault() == null)
                    {
                        ContractList.Add(contract);
                    }
                }
            }

            if (ContractList.Count != 0)
            {
                returnValue.Result.HealthInsuranceProviders = cls_Get_AllHealthInsuranceProviders.Invoke(Connection, Transaction, new P_PA_GAHIP_1223()
                {
                    ContractIDs = ContractList.Select(ctr => ctr.ID).ToArray()
                }, securityTicket).Result;
            }
            else
            {
                returnValue.Result.HealthInsuranceProviders = new PA_GAHIP_1223[] { };
            }

            returnValue.Result.Contracts = ContractList.ToArray();
            return(returnValue);

            #endregion UserCode
        }
コード例 #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_PA_GDAPV_1629 Invoke(DbConnection Connection, DbTransaction Transaction, P_PA_GDAPV_1629 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
コード例 #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_PA_GDAPV_1629 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_PA_GDAPV_1629 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_PA_GDAPV_1629 functionReturn = new FR_PA_GDAPV_1629();

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

                functionReturn = Execute(Connection, Transaction, Parameter, 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_Data_for_AddPatientView", ex);
            }
            return(functionReturn);
        }
コード例 #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_PA_GDAPV_1629 Invoke(string ConnectionString, P_PA_GDAPV_1629 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }