예제 #1
0
def change_customer_passcode(change_passcode, user):
    conn, cursor = config.connect_to_database()
    userid = get_any_value(user, "cid")
    sql = "update accounts SET passcode='%s' where c_id='%s'" % (
        change_passcode, userid)
    conn, cursor = config.connect_to_database()
    try:
        cursor.execute(sql)
        conn.commit()
        return "11"
    except:
        conn.rollback()
        return "0"
    finally:
        conn.close()
예제 #2
0
def add_visitor(visitor_id, profile_id):
    conn, cursor = config.connect_to_database()
    rownum, howmanytimes = count_visits(visitor_id, profile_id)
    rownum = int(rownum)
    howmanytimes = int(howmanytimes)
    if rownum == 0 and howmanytimes == 0:
        sql_visit = "Insert into profile_visit(ProfileID,PersonID) values('%s','%s')" % (
            profile_id, visitor_id)
    else:
        howmanytimes += 1
        sql_visit = "Update profile_visit SET HowManyTimes='%s' where ProfileID='%s' and PersonID='%s'" % (
            howmanytimes, profile_id, visitor_id)
    try:
        cursor.execute(sql_visit)
        conn.commit()
        obj_inst = institute_and_job.institute_and_job()
        obj_inst.institute_details(conn, cursor, profile_id)
        inst_impression = obj_inst.inst_impressions
        inst_impression = int(inst_impression)
        inst_impression += 1
        sql_inst = "Update Institutes SET Impression='%s' where ID='%s'" % (
            inst_impression, profile_id)
        try:
            cursor.execute(sql_inst)
            conn.commit()
            print("11")
        except:
            conn.rollback()
            print("Server is taking too load..")
    except:
        conn.rollback()
        print("Server is taking too load..")
예제 #3
0
def reload_chats(user_id, email_id):
    conn, cursor = config.connect_to_database()
    sql = "select * from chats where from_id='%s' or to_id='%s' ORDER BY created_time ASC" % (
        user_id, user_id)
    reload_mess = ""
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        for row in results:
            chat_id = "chat_%s" % row[0]
            from_id = row[1]
            to_id = row[2]
            text = row[3]
            datetime = row[4]
            time = datetime.strftime('%H : %M')
            name = customer_details.get_any_value(email_id, "username")
            profile_pic = customer_details.get_any_document(
                name, "profile_pic")
            if int(to_id) != 0 or from_id == 0:
                reload_mess += """<li id='%s' class="mess"><div><img src="images/jon-cart.jpg" alt="You" style="width:100%%;"><p class="text-left">%s</p><br/><span class="time-right">%s</span></div></li><br/>""" % (
                    chat_id, text, time)
            else:
                reload_mess += """<li id='%s' class='mess'><div><img src="%s" alt="Jon" class="right" style="height:50px;"><p class="text-right">%s</p><br/><span class="time-left">%s</span></div></li><br/>""" % (
                    chat_id, profile_pic, text, time)
        return reload_mess
    except:
        return "error"
예제 #4
0
def accept_offer(candid, instid, jobid, role):
    conn, cursor = config.connect_to_database()
    num = count_rows(instid, candid, jobid)
    num = int(num)
    if num == 1:
        sql = "update chat SET role='%s' where FromUser='******' and ToUserID='%s' and Text='%s'" % (
            role, instid, candid, jobid)
        try:
            cursor.execute(sql)
            conn.commit()
            mess = instid
            save_history.enter_history(conn, cursor, mess, candid, role)
            obj_job = institute_and_job.institute_and_job()
            obj_job.job_details(conn, cursor, jobid)
            job_impressions = obj_job.job_impressions
            job_impressions = int(job_impressions)
            job_impressions += 10
            sql_job = "UPDATE jobs set job_impressions='%s' where job_id='%s'" % (
                job_impressions, jobid)
            try:
                cursor.execute(sql_job)
                conn.commit()
                print("1")
            except:
                conn.rollback()
                print("-1")
        except:
            conn.rollback()
            print("-1")
    else:
        print("-1")
    conn.close()
예제 #5
0
def impressions_total_count(inst_id):
    conn, cursor = config.connect_to_database()
    obj_inst = institute_and_job.institute_and_job()
    obj_inst.institute_details(conn, cursor, inst_id)
    inst_impression = obj_inst.inst_impressions
    print("%s" % inst_impression)
    conn.close()
예제 #6
0
def remove_question(queid, testid):
    conn, cursor = config.connect_to_database()
    sql = "Delete from Questions where ID='%s'" % (queid)
    try:
        cursor.execute(sql)
        sql2 = "Select Total_num from Tests where ID='%s'" % (testid)
        try:
            cursor.execute(sql2)
            results = cursor.fetchone()
            num = results[0]
            n = int(num)
            n -= 1
            sql3 = "Update Tests SET Total_num='%s' where ID='%s'" % (n,
                                                                      testid)
            try:
                cursor.execute(sql3)
                conn.commit()
                print("1")
            except:
                conn.rollback()
                print("-1")
        except:
            conn.rollback()
            print("-1")
    except:
        conn.rollback()
        print("-1")
    conn.close()
예제 #7
0
def que_reload(testid, cu_id):
    conn, cursor = config.connect_to_database()
    sql = "Select ID,Time,Question,A1,A2,A3,A4 FROM Questions where TestID='%s'" % (
        testid)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        i = 0
        for row in results:
            divid = row[0]
            time = row[1]
            datetime = time.strftime('%H : %M')
            que = row[2]
            a1 = row[3]
            a2 = row[4]
            a3 = row[5]
            a4 = row[6]
            i += 1
            que_id = "question%s" % i
            error = "error%s" % i
            ans1 = "name='%s' value='1'" % (divid)
            ans2 = "name='%s' value='2'" % (divid)
            ans3 = "name='%s' value='3'" % (divid)
            ans4 = "name='%s' value='4'" % (divid)
            print(
                """<div id="%s" class="panel-body" style="line-height:30px;"><div id='question'>%s. <strong>%s</strong></div><div id='mcqs' class="form-group"><div><input type='radio' %s /> %s</div><div><input type='radio' %s /> %s</div><div><input type='radio' %s /> %s</div><div><input type='radio' %s /> %s</div><div id="%s"></div></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>"""
                % (que_id, i, que, ans1, a1, ans2, a2, ans3, a3, ans4, a4,
                   error))
        print(
            """<div id="controls"><button class="btn btn-sm btn-primary" type="button" onclick="check_answers()">Submit</button></div>"""
        )
    except:
        conn.rollback()
        print("-1")
    conn.close()
예제 #8
0
def change_customer_details(field,value,user):
	column_value=['postal_add','username','contact',"passcode","password"]
	conn,cursor=config.connect_to_database()
	if field=="username" or field=="contact":
		sql="select email from customers where %s='%s'"%(field,value)
		try:
			cursor.execute(sql)
			if cursor.rowcount!=0:
				row=cursor.fetchone()
				if user!=row[0]:
					return -11
		except:
			return -99
	if field=="passcode":
		cid=customer_details.get_any_value(user,"cid")
		table_name="accounts"
		condition="c_id='%s'"%cid
	else:
		table_name="customers"
		condition="email='%s'"%user
	sql="update %s SET %s='%s' where %s"%(table_name,field,value,condition)
	try:
		cursor.execute(sql)
		conn.commit()
		return 1
	except:
		conn.rollback()
		return -99
	finally:
		conn.close()
예제 #9
0
 def customer_details(self, userid):
     sql = "select * from customers where cid='%s'" % userid
     conn, cursor = config.connect_to_database()
     try:
         cursor.execute(sql)
         results = cursor.fetchall()
         for row in results:
             self.cid = row[0]
             self.username = row[1]
             self.fname = row[2]
             self.lname = row[3]
             self.email = row[4]
             self.password = row[5]
             self.contact = row[6]
             self.postal_add = row[7]
             self.perm_add = row[8]
             self.city = row[9]
             self.state = row[10]
             self.country = row[11]
             self.middle_name = row[12]
             self.pincode = row[13]
             self.dob = row[14]
             self.gender = row[15]
             self.created_time = row[17]
             self.jon = row[18]
             self.hasAcc = row[19]
     except:
         print("Error")
     conn.close()
예제 #10
0
def reload_visits(inst_id):
    conn, cursor = config.connect_to_database()
    sql_visits = "select VisitID,PersonID,VisitedTime,HowManyTimes from profile_visit where ProfileID='%s'" % (
        inst_id)
    try:
        cursor.execute(sql_visits)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("Profile visits(0)")
        else:
            for row in results:
                divid = row[0]
                personid = row[1]
                time = row[2]
                howmanytimes = row[3]
                obj_cand = candidate_details.candidate()
                obj_cand.candidate_details(conn, cursor, personid)
                cand_id = obj_cand.cand_id
                cand_name = obj_cand.cand_name
                cand_image = obj_cand.cand_image
                cand_email = obj_cand.cand_email
                cand_contact = obj_cand.cand_contact
                filename = obj_cand.filename
                print(
                    """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;">
					<div class="row" style=""><div class="col-md-9"></div><div class="col-md-3 pull-right">%s</div></div>
						<hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
							<div class="row"><div class="col-md-9"><div class="media"><div class="media-left"><img class="img-circle" style="height:60px;" src="%s" /></div><div class="media-body" style="line-height: 25px;"><div id='%s' class='cand_id'><strong>%s</strong> visited <span class="badge">%s</span> times</div></div></div></div><div class="col-md-3"><a href="#" onclick='delete_visit("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div></div><br/>"""
                    %
                    (time, filename, cand_id, cand_name, howmanytimes, divid))
    except:
        conn.rollback()
        print("Server is taking too load...")
    conn.close()
예제 #11
0
def make_transaction(from_acc_no, to_acc_no, amount):
    conn, cursor = config.connect_to_database()
    trans_id = 2179516709
    sql = "insert into transactions(from_acc,to_acc,amount) values('%s','%s','%s')" % (
        from_acc_no, to_acc_no, amount)
    try:
        cursor.execute(sql)
        flag = transaction_happened(cursor, from_acc_no, to_acc_no, amount)
        if flag != 11:
            return flag
        conn.commit()
        sql = "SELECT t_id FROM transactions ORDER BY t_id DESC LIMIT 1;"
        try:
            cursor.execute(sql)
            row = cursor.fetchone()
            t_id = row[0]
            t_id = int(t_id)
            trans_id += t_id
            return "11<table class='myTable'><tr><td><span style='color:rgba(32,78,148,1);'>Transactions id</span></td><td>#%s</td></tr><tr><td>From Account Number</td><td>%s</td></tr><tr><td>To Account Number</td><td>%s</td></tr><tr><td>Amount</td><td>Rs. %s</td></tr></table>" % (
                trans_id, from_acc_no, to_acc_no, amount)
        except:
            return -99
    except:
        conn.rollback()
        return -999
    finally:
        conn.close()
예제 #12
0
def get_last_transaction_without_html_tags(acc_no, n):
    conn, cursor = config.connect_to_database()
    trans_id = 2179516709
    sql = "SELECT t_id,from_acc,to_acc,amount FROM transactions where from_acc='%s' or to_acc='%s' ORDER BY t_id DESC LIMIT %s;" % (
        acc_no, acc_no, n)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        num = cursor.rowcount
        num_str = str(num).zfill(2)
        response = """Last %s Transactions""" % (num_str)
        i = int(n) + 1
        for row in results:
            t_id = row[0]
            t_id = int(t_id)
            from_acc_no = row[1]
            to_acc_no = row[2]
            trans_id += t_id
            amount = row[3]
            i -= 1
            response += """\n-----%s----\nTransactions id: #%s\nFrom Account Number: %s\nTo Account Number: %s\nAmount: Rs. %s""" % (
                i, trans_id, from_acc_no, to_acc_no, amount)
        return response
    except:
        return -99
    finally:
        conn.close()
예제 #13
0
def show_tests(postedby):
    conn, cursor = config.connect_to_database()
    sql = "Select ID,Time,Title,Total_num,Course,Subjects FROM Tests where Postedby='%s'" % (
        postedby)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        for row in results:
            divid = row[0]
            time = row[1]
            datetime = time.strftime('%H : %M')
            title = row[2]
            num = row[3]
            course = row[4]
            str_sub = row[5]
            subjects = str_sub.split("|")
            if len(subjects) == 1:
                sub_string = str_sub.strip()
            else:
                sub_string = "<ol>"
                for i in subjects:
                    sub_string += "<li>" + i.strip() + "</li>"
                sub_string += "</ol>"
            print(
                """<div id="%s" class='style_prevu_kit test_div' style="padding:10px;"><div class="row"><div class="col-sm-6"><button class="btn btn-link" onclick="show_questions(%s)" ><h3>%s</h3></button><span class="pull-right"><form action="edit_test.php" method="post" ><input type="hidden" name="test_id" value="%s" /><button class="btn btn-sm btn-primary" type="submit" >Edit <span class="glyphicon glyphicon-pencil"></span></button></form></span><span class="pull-right"><button class="btn btn-sm btn-danger" onclick="remove_test(%s)" >Delete <span class="glyphicon glyphicon-trash"></span></button></span></div><div class="col-sm-6"><span class="glyphicon glyphicon-time"></span> Posted on  %s</div></div><hr /><div class="row"><div class="col-sm-6">Total Questions</div><div class="col-sm-6">%s</div></div><div class="row"><div class="col-sm-6">Course</div><div class="col-sm-6">%s</div></div><div class="row"><div class="col-sm-6">Subjects</div><div class="col-sm-6">%s</div></div></div><hr/><hr/>"""
                % (divid, divid, title, divid, divid, time, num, course,
                   sub_string))
    except:
        conn.rollback()
        print("-1")
    conn.close()
예제 #14
0
def verify_card_request(r_id,acc_id,status):
	sql="update requests SET status_bit='%s' where r_id='%s'"%(status,r_id)
	user=customer_details.get_account_by_acc_id(acc_id,"email")
	if type(status)!=int:
		status=int(status)
	sub="Verification of your card request"
	if status==1:
		bit=create_card(acc_id)
		bit=str(bit)
		if bit=="-99":
			return "-99"
		elif bit=="-22":
			return "-22"
		cont="""<h1>Lennox</h1>,<br/><p>Your card request has been approved for banking and use of our services.</p>""";
	else:
		cont="""<h1>Lennox</h1>,<br/><p>We are sorry to hear that</p><br/></p><p>Your account is rejected.</p>""";
	conn,cursor=config.connect_to_database()
	try:
		cursor.execute(sql)
		m=send_mail.Mail()
		st=m.send_mail(user,sub,cont)
		conn.commit()
		return "11"
	except:
		conn.rollback()
		return "-99"
	finally:
		conn.close()
예제 #15
0
def verify_customer(userid,user,status):
	sql="update customers SET hasAcc='%s' where cid='%s'"%(status,userid)
	if type(status)!=int:
		status=int(status)
	sub="Verification of your Ryder account"
	if status==1:
		bit=create_bank_account_details(userid)
		bit=str(bit)
		if bit=="-99":
			return "-99"
		elif bit=="-22":
			return "-22"
		cont="""<h1>Lennox</h1>,<br/><p>Your account has been approved for banking and use of our services.</p>""";
	else:
		cont="""<h1>Lennox</h1>,<br/><p>We are sorry to hear that</p><br/></p><p>Your account is rejected.</p>""";
	conn,cursor=config.connect_to_database()
	try:
		cursor.execute(sql)
		m=send_mail.Mail()
		st=m.send_mail(user,sub,cont)
		st=str(st)
		if st=="11":
			conn.commit()
			return "11"
		else:
			conn.rollback()
			return "-99"
	except:
		conn.rollback()
		return "-99"
예제 #16
0
def reload_history(c_id1):
    conn, cursor = config.connect_to_database()
    sql = "SELECT ID,`Time`,Field FROM History where UserID='%s' and role='Institute' ORDER BY Time DESC" % (
        c_id1)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("History(0)")
        else:
            for row in results:
                divid = row[0]
                time = row[1]
                datetime = time.strftime('%H : %M')
                field = row[2]
                fdiv = "You have updated <strong> %s</strong> at %s" % (
                    field, datetime)
                print(
                    """<div id="%s"  class="alert alert-info alert-dismissable fade in" ><a href="#" onclick='delete_hist("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a> %s </div><br/>"""
                    % (divid, divid, fdiv))
    except:
        conn.rollback()
        print("Try again !")
    conn.close()
예제 #17
0
def add_question(testid, que, a1, a2, a3, a4, ans):
    conn, cursor = config.connect_to_database()
    testid = int(testid)
    sql = "Insert into Questions(Question,A1,A2,A3,A4,TestID,Ans) values('%s','%s','%s','%s','%s','%s','%s')" % (
        que, a1, a2, a3, a4, testid, ans)
    try:
        cursor.execute(sql)
        conn.commit()
        testid = int(testid)
        sql2 = "Select Total_num from Tests Where ID='%s'" % (testid)
        try:
            cursor.execute(sql2)
            results = cursor.fetchone()
            num = results[0]
            n = int(num)
            n += 1
            sql3 = "Update Tests SET Total_num='%s' where ID='%s'" % (n,
                                                                      testid)
            try:
                cursor.execute(sql3)
                conn.commit()
                print("1")
            except:
                conn.rollback()
                print("-1")
        except:
            conn.rollback()
            print("-1")
    except:
        conn.rollback()
        print("-1")
    conn.close()
def reload_all(inst_id, role_div):
    conn, cursor = config.connect_to_database()
    sql = "Select ID,role,Time,ToUserID,Text,FromUser from chat where %s ORDER BY Time DESC" % (
        role_div)
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        rownum = cursor.rowcount
        if rownum == 0:
            no_found.no_found("Inbox(0)")
        else:
            for row in results:
                role = row[1]
                divid = row[0]
                time = row[2]
                datetime = time.strftime('%H : %M')
                if role == "Offer" or role == "Accepted":
                    fromuser = row[3]
                    jobid = row[4]
                    obj_cand = candidate_details.candidate()
                    obj_cand.candidate_details(conn, cursor, fromuser)
                    obj_job = institute_and_job.institute_and_job()
                    obj_job.job_details(conn, cursor, jobid)
                    if role == "Offer":
                        status_header = "<span style='color:#FFAE00;'><strong><h4>Job Sent</h4></strong></span>"
                        status_div = """<h4>Job <span class='job_id' id='%s'><b>%s</b> offer sent to <span style='cursor:pointer;' class="show_candidate_link"><span id='%s' class='cand_id'><b>%s</b></span></span></span></h4>""" % (
                            obj_job.job_id, obj_job.job_name, obj_cand.cand_id,
                            obj_cand.cand_name)
                    elif role == "Accepted":
                        status_header = "<span style='color:green;'><strong><h4>Job Accepted</h4></strong></span>"
                        status_div = """<h4>Job <span class='job_id' id='%s'><b>%s</b> accepted by <span style='cursor:pointer;' class="show_candidate"><span id='%s' class='cand_id'><b>%s</b></span></span></span></h4>""" % (
                            obj_job.job_id, obj_job.job_name, obj_cand.cand_id,
                            obj_cand.cand_name)
                    print(
                        """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;">
					<div class="row" style=""><div class="col-md-9">%s</div><div class="col-md-3 pull-right">%s</div></div>
						<hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
							<div class="row"><div class="col-md-9"><div class="media"><div class="media-left"><img class="img-circle" style="height:60px;" src="%s" /></div><div class="media-body" style="line-height: 25px;"><div id='status_div'>%s</div></div></div></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div></div><br/>"""
                        % (status_header, time, obj_cand.filename, status_div,
                           divid))
                else:
                    fromuser = row[5]
                    text = row[4]
                    if fromuser == "Admin":
                        if text == "verified":
                            print(
                                """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;"><div class="row"><div class="col-md-9"><h4>Verification <span class="glyphicon glyphicon-ok-sign" style="color:green;"><span></h4></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
					<div class="row" style="margin-bottom:20px;"><div class="col-md-9"><div id="%s"  class="alert-dismissable fade in"><strong>%s </strong> : Hurray!!Your profile is varified successfully.</div></div><div class="col-md-3 pull-right">%s</div></div></div><br/>"""
                                % (divid, divid, fromuser, time))
                        elif text == "rejected":
                            print(
                                """<div style="margin:20px;padding:20px;background-color:white;border-left:3px solid rgba(23,139,158,1.00);border-top:2px solid rgba(23,139,158,1.00);box-shadow: 5px 5px 5px #aaaaaa;"><div class="row"><div class="col-md-9"><h4>Verification <span class="glyphicon glyphicon-remove" style="color:red;"><span></h4></div><div class="col-md-3"><a href="#" onclick='delete_mes("%s")' class="close" data-dismiss="alert" aria-label="close">&times;</a></div></div><hr style="border-width:2px;border-color:rgbs(180,180,180,1.00);"/>
					<div class="row" style="margin-bottom:20px;"><div class="col-md-9"><div id="%s"  class="alert-dismissable fade in"><strong>%s </strong> : We are sorry!!Your profile is rejected.</div></div><div class="col-md-3 pull-right">%s</div></div></div><br/>"""
                                % (divid, divid, fromuser, time))
    except:
        conn.rollback()
        print("Try again !")
    print('<script type="text/javascript" src="js/show_cand.js"></script>')
    conn.close()
예제 #19
0
def check_service(user):
    conn, cursor = config.connect_to_database()
    sql = "select jon from customers where email='%s'" % (user)
    try:
        cursor.execute(sql)
        row = cursor.fetchone()
        return int(row[0])
    except:
        return "-99"
예제 #20
0
def check_request_exist(acc_id):
    conn, cursor = config.connect_to_database()
    sql = "select r_id from requests where acc_id='%s'" % (acc_id)
    try:
        cursor.execute(sql)
        return cursor.rowcount
    except:
        return -99
    finally:
        conn.close()
예제 #21
0
def jon_service(bit, user):
    conn, cursor = config.connect_to_database()
    sql = "update customers SET jon='%s' where email='%s'" % (bit, user)
    try:
        cursor.execute(sql)
        conn.commit()
        return "11"
    except:
        conn.rollback()
        return "0"
예제 #22
0
def provides_requests():
    conn, cursor = config.connect_to_database()
    sql = "select * from requests ORDER BY created_time DESC"
    try:
        cursor.execute(sql)
        results = cursor.fetchall()
        num_row = int(cursor.rowcount)
        if num_row != 0:
            i = 0
            requests = """<div class="row" style="margin:20px;"><caption><h2>Requests <button class="btn btn-primary" id="request_refresh"><span class="glyphicon glyphicon-refresh"></span></button></h2></caption><table class='customerTable table-striped'><tr><td><b>Index no.</b></td><td><b>Account Number</b></td><td><b>Account Name</b></td><td><b>Requesting</b></td><td><b>Time</b></td></tr>"""
            for row in results:
                r_id = row[0]
                acc_id = row[1]
                acc_no = customer_details.get_account_by_acc_id(
                    acc_id, "acc_no")
                acc_name = customer_details.get_account_by_acc_id(
                    acc_id, "acc_name")
                c_id = customer_details.get_account_by_acc_id(acc_id, "c_id")
                req = row[2]
                status = row[3]
                time = row[4]
                i += 1
                profile_link = """<a class='btn btn-link' id='profile_link'>%s</a>""" % acc_name
                requests += """<tr class='clickable-row' id='%s' style="cursor:pointer;"><td>%s</td><td id='%s' class='c_id'>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>""" % (
                    r_id, i, c_id, acc_no, profile_link, req, time)
            requests += "</table></div>"
            requests += """<script>
			var get_table_of_details=function(flag)
			{
				$.ajax({
		     		type: 'POST',
					url: 'admin_interface.py',
		           	data: 'flag='+flag,
		         	success  : function (data)
		         	{
						$("#show_here").empty();
						$("#show_here").html(data);
		         	}
					});
			};
			$("#request_refresh").click(function(){
				get_table_of_details("new_requests");
			});
			$(".clickable-row").click(function() {
			var r_id=$(this).attr("id");
			var c_id=$(this).children("td.c_id").attr("id");
			$(this).append("<form action='customer_profile.php' id='show_customer' method='post'><input type='hidden' name='request_id' value='"+r_id+"' /><input type='hidden' name='customer_id' value='"+c_id+"' /></form>");
			$("#show_customer").submit();
			});
			</script>"""
        else:
            requests = no_found.no_found("We have not got any feedbacks, yet.")
        return requests
    except:
        return "-99"
예제 #23
0
def customer_card_exists(userid, card_no):
    conn, cursor = config.connect_to_database()
    sql = "select card_id from cards where card_no='%s' and c_id='%s'" % (
        card_no, userid)
    try:
        cursor.execute(sql)
        return cursor.rowcount
    except:
        return -99
    finally:
        conn.close()
예제 #24
0
def remove_test(testid):
    conn, cursor = config.connect_to_database()
    sql = "Delete from Tests where ID='%s'" % (testid)
    try:
        cursor.execute(sql)
        conn.commit()
        return "1"
    except:
        conn.rollback()
        return "-1"
    conn.close()
def delete_all_mess(c_id1):
    conn, cursor = config.connect_to_database()
    sql = "DELETE FROM chat where ToUserID='%s' and role='Institute'" % (c_id1)
    try:
        cursor.execute(sql)
        conn.commit()
        print("1")
    except:
        conn.rollback()
        print("-1")
    conn.close()
def delete_all_history(c_id1):
    conn, cursor = config.connect_to_database()
    sql = "DELETE FROM History where UserID='%s'" % (c_id1)
    try:
        cursor.execute(sql)
        conn.commit()
        print("1")
    except:
        conn.rollback()
        print("-1")
    conn.close()
예제 #27
0
def update_password(user, new_password):
    conn, cursor = config.connect_to_database()
    sql = "Update customers SET password='******' where email='%s'" % (
        new_password, user)
    try:
        cursor.execute(sql)
        conn.commit()
        return "11"
    except:
        conn.rollback()
        return "0"
def delete_message(c_id1):
    conn, cursor = config.connect_to_database()
    sql = "DELETE FROM chat where ID='%s'" % (c_id1)
    try:
        cursor.execute(sql)
        conn.commit()
        print("1")
    except:
        conn.rollback()
        print("-1")
    conn.close()
예제 #29
0
def delete_offer_cand(c_id,inst_id,j_id,role):
	conn,cursor=config.connect_to_database()
	sql="delete from chat where FromUser='******' and ToUserID='%s' and Text='%s' and role='%s'"%(inst_id,c_id,j_id,role)
	try:
		cursor.execute(sql)
		conn.commit()
		print("11")
	except:
		conn.rollback()
		print("00")
	conn.close()
예제 #30
0
def remove_questions_of_test(testid):
    conn, cursor = config.connect_to_database()
    sql = "Delete from Questions where TestID='%s'" % (testid)
    try:
        cursor.execute(sql)
        conn.commit()
        print("1")
    except:
        conn.rollback()
        print("-1")
    conn.close()