Sindbad~EG File Manager
from sqlalchemy import create_engine, MetaData, Table, insert, select,update,delete,text
from sqlalchemy.sql import and_, or_
from sqlalchemy import text
from core import app
import json
from .. import engine,engine_conf_db,engine_fk_db
# engine = create_engine(app.config['DATABASE_URI'])
# engine = create_engine(app.config['DATABASE_URI'],pool_size=5000,pool_pre_ping=True,pool_recycle=3600)
class VerifyPaymentModel():
def __init__(self):
try:
self.meta = MetaData()
self.users = Table("users", self.meta, autoload_with=engine)
self.states = Table("states", self.meta, autoload_with=engine)
self.conference = Table("conference", self.meta, autoload_with=engine)
self.user_payment = Table("user_payment", self.meta, autoload_with=engine)
self.user_types = Table("user_types", self.meta, autoload_with=engine)
self.m_payment_type = Table("m_payment_type", self.meta, autoload_with=engine)
self.logs = Table("logs", self.meta, autoload_with=engine)
self.delegates = Table("delegates", self.meta, autoload_with=engine)
self.delegates_addons = Table("delegates_addons", self.meta, autoload_with=engine)
self.admin_logs = Table("admin_logs", self.meta, autoload_with=engine)
self.trigger_daily_reports_mails = Table("trigger_daily_reports_mails", self.meta, autoload_with=engine)
self.export_filter_cols = Table("export_filter_cols", self.meta, autoload_with=engine)
self.badge_role = Table("badge_role", self.meta, autoload_with=engine)
self.society_applications = Table("society_applications", self.meta, autoload_with=engine)
self.delegate_user_logs = Table("delegate_user_logs", self.meta, autoload_with=engine)
self.delegate_attachments = Table("delegate_attachments", self.meta, autoload_with=engine)
self.reg_remark = Table("reg_remark", self.meta, autoload_with=engine)
self.mail_logs = Table("mail_logs", self.meta, autoload_with=engine)
except Exception as e:
print("table not found",e)
# Usage : Search Pending Delegate Record
# Date : 2023-07-03 12:00
# Created by : Ramya
def get_pending_delegate_record(self,conf_id,from_date,to_date,status,search):
connection = engine.raw_connection()
cursor = connection.cursor()
cursor.callproc("usp_del_inprogress_delegate_details",[conf_id,from_date,to_date,status,search])
if cursor.description :
columns = [column[0] for column in cursor.description]
results = []
for row in cursor.fetchall():
results.append(dict(zip(columns, row)))
cursor.close()
connection.commit()
if results :
return results
else :
return None
else :
cursor.close()
connection.commit()
return None
def getRegTranscationDetailsByitsIds(self,conf_id,transaction_ids):
with engine.connect() as conn:
stmt = text("select d.delegate_id,d.delegate_no,d.prefix,d.full_name,d.email,d.mobile,a.display_name,"
+" up.api_payment_id,up.utr_number,up.receipt_no,up.delegate_ids,up.unique_id "
+" from user_payment up "
+" inner join delegates_addons da on da.unique_id = up.unique_id "
+" inner join delegates d on d.delegate_id = da.delegate_id "
+" inner join addons a on a.addon_id = da.addon_id "
+" where d.conference_id = "+str(conf_id)+" and up.api_payment_id in ("+str(transaction_ids)+") and d.delegate_no is not null;")
result = conn.execute(stmt).all()
return [dict(r._mapping) for r in result] if result else None
def getNotTranscationDetailsByitsIds(self,conf_id,transaction_ids):
with engine.connect() as conn:
stmt = text("select d.delegate_id,d.delegate_no,d.prefix,d.full_name,d.email,d.mobile,a.display_name,"
+" up.api_payment_id,up.utr_number,up.receipt_no,up.delegate_ids,concat(das.attach_path,'/' , das.attach_file_name) as utr_number_screenshot,up.unique_id "
+" from user_payment up "
+" inner join delegates_addons da on da.unique_id = up.unique_id "
+" inner join delegates d on d.delegate_id = da.delegate_id "
+" inner join addons a on a.addon_id = da.addon_id "
+" left join delegate_attachments das on das.unique_id = da.unique_id"
+" where d.conference_id = "+str(conf_id)+" and up.api_payment_id in ("+str(transaction_ids)+") and d.delegate_no is null;")
result = conn.execute(stmt).all()
return [dict(r._mapping) for r in result] if result else None
def get_delegate_data_by_unique_id(self,conf_id,unique_id):
with engine.connect() as conn:
stmt = text("select * from user_payment where conf_id = "+str(conf_id)+" and unique_id = '"+str(unique_id)+"' ;")
result = conn.execute(stmt).one_or_none()
return dict(result._mapping) if result else None
def BoGetDataFromUserPayments(self,conf_id):
with engine.connect() as conn:
stmt = text("select * from user_payment where conf_id = "+str(conf_id)+" and (status != 'success' or status is null) order by payment_id desc ;")
result = conn.execute(stmt).all()
return [dict(r._mapping) for r in result] if result else None
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists