def updateNotification(notificationId, mobileNo, message, time, repeat, enable): sql = """UPDATE [dbo].[Notification] SET [Message] = '{0}', [Time] = '{1}', [Repeat] = '{2}', [Enable] = '{3}' where [Id] = '{4}' and [mobileNo] = '{5}'""".format(message, time, repeat, enable, notificationId, mobileNo) print("---------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def updateNotificationStatus(mobileNo, notificationId, enable): sql = """UPDATE [dbo].[Notification] SET [enable] = '{0}' where [Mobile_Number] = '{1}' and [Id] = '{2}'""".format(enable, mobileNo, notificationId) print("---------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def updateNotification(notificationId, mobileNo, message, time, repeat, enable): sql = """UPDATE Notification SET Message = '{0}', Time = '{1}', Repeat = '{2}', Enable = '{3}' where Id = '{4}' and mobileNo = '{5}'""".format(message, time, repeat, enable, notificationId, mobileNo) print("---------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def updatePassword(mobileNo, newPassword): sql = """UPDATE [dbo].[User_Info] SET [Password] = '{0}' where [Mobile_Number] = '{1}'""".format(newPassword, mobileNo) print("---------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def updateNotificationStatus(mobileNo, notificationId, enable): sql = """UPDATE Notification SET enable = '{0}' where Mobile_Number = '{1}' and Id = '{2}'""".format(enable, mobileNo, notificationId) print("---------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def updateMsg(mobileNo, message, notificationId): sql = """UPDATE Notification SET message = '{0}' where Mobile_Number = '{1}' and Id = '{2}'""".format(message, mobileNo, notificationId) print("---------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def updateMsg(mobileNo, message, notificationId): sql = """UPDATE [dbo].[Notification] SET [message] = '{0}' where [Mobile_Number] = '{1}' and [Id] = '{2}'""".format(message, mobileNo, notificationId) print("---------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def selectAllUsers(): sql = "select * from User_Info" db, cursor = dbConnect.connectDB() cursor.execute(sql) userDetails = [] for userDetail in cursor: userDetails.append(userDetail) return userDetails
def selectAllNotifications(): sql = "select * from Notification" db, cursor = dbConnect.connectDB() cursor.execute(sql) allNotifations = [] for userNotification in cursor: allNotifations.append(userNotification) return allNotifations
def selectNotificationsWhereMobileNo(mobileNo): sql = "select * from Notification where Mobile_No_FK = '{0}'".format(mobileNo) db, cursor = dbConnect.connectDB() cursor.execute(sql) userNotifications = [] for userNotification in cursor: userNotifications.append(userNotification) return userNotifications
def selectUserWhereMobileNo(mobileNo, password): sql = "select * from User_Info where Mobile_Number = '{0}' and password = '******'".format(mobileNo, password) print(";;;;;;;;;;;;;;;;;;;;;;;;;;") print(sql) db,cursor = dbConnect.connectDB() cursor.execute(sql) userDetails = [] for userDetail in cursor: userDetails.append(userDetail) return userDetails
def insertNotification(mobileNo, message, timeOfNotification, repeat, enable): sql = """INSERT INTO Notification (Mobile_No_FK ,Message ,Time ,IsRepeat ,IsEnable) VALUES ('{0}','{1}','{2}','{3}','{4}')""".format(mobileNo, message, timeOfNotification, repeat, enable) print("----------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def insertUsers(firstname, lastname, mobileno, dob, emailid, password): sql = """INSERT INTO User_Info (First_Name ,Last_Name ,Mobile_Number ,DOB ,EmailID ,Password) values ('{0}','{1}','{2}','{3}','{4}','{5}')""".format(firstname, lastname, mobileno, dob, emailid, password) print("----------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def insertUsers(firstname, lastname, mobileno, dob, emailid, password): sql = """INSERT INTO [dbo].[User_Info] ([First_Name] ,[Last_Name] ,[Mobile_Number] ,[DOB] ,[EmailID] ,[Password]) values ('{0}','{1}','{2}','{3}','{4}','{5}')""".format(firstname, lastname, mobileno, dob, emailid, password) print("----------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def insertNotification(mobileNo, message, timeOfNotification, repeat, enable): sql = """INSERT INTO [dbo].[Notification] ([Mobile_No_FK] ,[Message] ,[Time] ,[Repeat] ,[Enable]) VALUES ('{0}','{1}','{2}','{3}','{4}')""".format(mobileNo, message, timeOfNotification, repeat, enable) print("----------" + sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) db.commit()
def selectAllNotificationsWhereEnableAndTime(fromTime, toTime): sql = """SELECT [Id] ,[Mobile_No_FK] ,[Message] ,cast([Time] as time)[Time] ,cast([Time] as date)[Date] ,[Repeat] ,[Enable] FROM [PlanUrDay].[dbo].[Notification] where [Enable] = 'true' and cast([Time] as time) > cast('{0}' as time) and cast([Time] as time) < cast('{1}' as time)""".format(fromTime, toTime) print("-----------------") print(sql) # "select * from [dbo].[Notification] where [Enable] = 'true' and time > '{0}' and time < {1}".format(time,time) db, cursor = dbConnect.connectDB() allNotifations = cursor.execute(sql) return allNotifations
def selectAllNotificationsWhereEnableAndTime(fromTime, toTime): sql = """SELECT Id ,Mobile_No_FK ,Message ,date_format(Time, '%H:%i') as time ,date_format(Time, '%Y-%m-%d') as date ,IsRepeat ,IsEnable FROM Notification where IsEnable = 'true' and time > date_format('{0}', '%H:%i') and time < date_format('{0}', '%H:%i')""".format(fromTime, toTime) print("-----------------") print(sql) db, cursor = dbConnect.connectDB() cursor.execute(sql) allNotifations = [] for userNotification in cursor: allNotifations.append(userNotification) return allNotifations
def selectNotificationsWhereMobileNo(mobileNo): sql = "select * from [dbo].[Notification] where Mobile_No_FK = '{0}'".format(mobileNo) db, cursor = dbConnect.connectDB() userNotifications = cursor.execute(sql) return userNotifications
def selectAllUsers(): sql = "select * from [dbo].[User_Info]" db, cursor = dbConnect.connectDB() userDetails = cursor.execute(sql) return userDetails
def selectUserWhereMobileNo(mobileNo, password): sql = "select * from [dbo].[User_Info] where Mobile_Number = '{0}' and password = '******'".format(mobileNo, password) db, cursor = dbConnect.connectDB() userDetails = cursor.execute(sql) return userDetails
def selectAllNotifications(): sql = "select * from [dbo].[Notification]" db, cursor = dbConnect.connectDB() allNotifations = cursor.execute(sql) return allNotifations