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

            FR_L5OD_GLDfT_1111_Array functionReturn = new FR_L5OD_GLDfT_1111_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_LightOphthalDoctors_For_Tenant", ex);
            }
            return(functionReturn);
        }
Exemple #2
0
        protected static FR_L5OD_GLDfT_1111_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5OD_GLDfT_1111_Array();

            var basicInfos = cls_Get_Doctor_BaseInfo_forTenant.Invoke(Connection, Transaction, securityTicket).Result;

            var customerQuery = new ORM_CMN_BPT_CTM_Customer.Query();
            customerQuery.Tenant_RefID = securityTicket.TenantID;
            var customers = ORM_CMN_BPT_CTM_Customer.Query.Search(Connection, Transaction, customerQuery);

            var customer2SRQuery = new ORM_CMN_BPT_CTM_Customer_2_SalesRepresentative.Query();
            customer2SRQuery.Tenant_RefID = securityTicket.TenantID;
            var customer2SRs = ORM_CMN_BPT_CTM_Customer_2_SalesRepresentative.Query.Search(Connection, Transaction, customer2SRQuery);

            List <L5OD_GLDfT_1111> retVal = new List <L5OD_GLDfT_1111>();
            foreach (var item in basicInfos)
            {
                var doc = new L5OD_GLDfT_1111();
                doc.BaseInfo     = item;
                doc.FirstName    = item.FirstName;
                doc.LastName     = item.LastName;
                doc.HEC_DoctorID = item.HEC_DoctorID;
                doc.Title        = item.Title;

                var customer = customers.FirstOrDefault(c => c.Ext_BusinessParticipant_RefID == item.Doctor_CMN_BPT_BusinessParticipantID);
                if (customer != null)
                {
                    var c2sr = customer2SRs.FirstOrDefault(c => c.Customer_RefID == customer.CMN_BPT_CTM_CustomerID);
                    if (c2sr != null)
                    {
                        doc.SalesRepresentative = new L5OD_GLDfT_1111_SalesRepresentative();
                        doc.SalesRepresentative.SalesRepresentative_RefID = c2sr.SalesRepresentative_RefID;
                    }
                }

                retVal.Add(doc);
            }
            returnValue.Result = retVal.ToArray();

            return(returnValue);

            #endregion UserCode
        }