Пример #1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_DO_CLE_1414 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_DO_CLE_1414 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_DO_CLE_1414 functionReturn = new FR_DO_CLE_1414();

            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_Check_LoginEmail", ex);
            }
            return(functionReturn);
        }
Пример #2
0
        protected static FR_DO_CLE_1414 Execute(DbConnection Connection, DbTransaction Transaction, P_DO_CLE_1414 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_DO_CLE_1414();
            returnValue.Result = new DO_CLE_1414();

            IAccountServiceProvider accountService;
            var _providerFactory = ProviderFactory.Instance;
            accountService = _providerFactory.CreateAccountServiceProvider();

            List <Account> AllAccounts = accountService.GetAllAccountsForTenant(securityTicket.TenantID);

            var  account_id = Guid.Empty;
            bool ifExists   = false;

            if (Parameter.ID != Guid.Empty)
            {
                if (Parameter.Type.ToLower().Equals("doctor"))
                {
                    var account = cls_Get_Doctor_AccountID_for_DoctorID.Invoke(Connection, Transaction, new P_DO_GDAIDfDID_1549()
                    {
                        DoctorID = Parameter.ID
                    }, securityTicket).Result;
                    if (account != null)
                    {
                        account_id = account.accountID;
                    }
                    else
                    {
                        returnValue.Result.EMailExists = false;
                        return(returnValue);
                    }
                }

                if (Parameter.Type.ToLower().Equals("practice"))
                {
                    account_id = cls_Get_Practice_AccountID_for_PracticeID.Invoke(Connection, Transaction, new P_DO_GPAIDfPID_1351()
                    {
                        PracticeID = Parameter.ID
                    }, securityTicket).Result.accountID;
                }

                ifExists = AllAccounts.Exists(ac => ac.Email == Parameter.LoginEmail && ac.ID != account_id);
            }
            else
            {
                ifExists = AllAccounts.Exists(ac => ac.Email == Parameter.LoginEmail);
            }

            returnValue.Result.EMailExists = ifExists;
            return(returnValue);

            #endregion UserCode
        }