def get_last_login_day(mobile_number): con = DBConnectivity.create_connection() db_cursor = DBConnectivity.create_cursor(con) try: if Validations.is_user_present(mobile_number): sql_statement = "select case when to_char(last_login ,'yyyy-mm-dd')=to_char(systimestamp,'yyyy-mm-dd') then 'today' when to_char(last_login ,'yyyy-mm-dd')=to_char(systimestamp-1,'yyyy-mm-dd') then 'yesterday' else to_char(last_login,'Dy, dd Mon') end from login where mob_no=" + str( mobile_number) db_cursor.execute(sql_statement) for row in db_cursor: return row[0] except CustomExceptions.MobileNumberNotPresent as e: print(e) finally: db_cursor.close() con.close()
def get_password(mobile_number): con = DBConnectivity.create_connection() db_cursor = DBConnectivity.create_cursor(con) try: if Validations.is_user_present(mobile_number): sql_statement = "select pwd from usr where MOB_NO=" + str( mobile_number) db_cursor.execute(sql_statement) for row in db_cursor: return row[0] except CustomExceptions.MobileNumberNotPresent as e: print(e) return None finally: db_cursor.close() con.close()
def get_blocked_status(mobile_number): sql_statements = "select blocked_status from login where mob_no =" + str( mobile_number) con = DBConnectivity.create_connection() db_cursor = DBConnectivity.create_cursor(con) try: if Validations.is_user_present(mobile_number): db_cursor.execute(sql_statements) for row in db_cursor: return row[0] except CustomExceptions.MobileNumberNotPresent as e: print(e) finally: db_cursor.close() con.close()
def get_last_login_time(mobile_number): con = DBConnectivity.create_connection() db_cursor = DBConnectivity.create_cursor(con) try: if Validations.is_user_present(mobile_number): sql_statement = "select last_login from login where mob_no=" + str( mobile_number) db_cursor.execute(sql_statement) for row in db_cursor: db_cursor.close() con.close() return row[0] except CustomExceptions.MobileNumberNotPresent as e: print(e) db_cursor.close() con.close() return None
def get_display_name(mobile_number): con = DBConnectivity.create_connection() db_cursor = DBConnectivity.create_cursor(con) try: if Validations.is_user_present(mobile_number): sql_statement = "select disp_name,mob_no from login where mob_no=" + str( mobile_number) db_cursor.execute(sql_statement) for row in db_cursor: if row[0] != None: return row[0] else: return row[1] except CustomExceptions.MobileNumberNotPresent as e: print(e) return None finally: db_cursor.close() con.close()