예제 #1
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("id", None)
        if (DataValidator.isInt(val)):
            q = q.filter(id=val)

        val = params.get("subjectName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(subjectName=val)

        val = params.get("subjectDescription", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(subjectDescription=val)

        val = params.get("dob", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(dob=val)

        val = params.get("course_ID", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(course_ID=val)

        val = params.get("courseName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(courseName=val)

        # val = params.get("college_ID",None)
        # if( DataValidator.isNotNull(val)):
        #     q= q.filter( college_ID = val)

        # val = params.get("collegeName",None)
        # if( DataValidator.isNotNull(val)):
        #     q= q.filter( collegeName = val)
        return q
예제 #2
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("id", None)
        if (DataValidator.isInt(val)):
            q = q.filter(id=val)

        val = params.get("collegeName", None)
        if DataValidator.isNotNull(val):
            q = q.filter(collegeName=val)

        val = params.get("collegeAddress", None)
        if DataValidator.isNotNull(val):
            q = q.filter(collegeAddress=val)

        val = params.get("collegeState", None)
        if DataValidator.isNotNull(val):
            q = q.filter(collegeState=val)

        val = params.get("collegeCity", None)
        if DataValidator.isNotNull(val):
            q = q.filter(collegeCity=val)

        val = params.get("collegePhoneNumber", None)
        if DataValidator.isNotNull(val):
            q = q.filter(collegePhoneNumber=val)

        return q
예제 #3
0
    def search(self, params):

        q = self.get_model().objects.filter()

        val = params.get("id", None)
        if (DataValidator.isInt(val)):
            q = q.filter(id=val)

        val = params.get("firstName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(firstName=val)

        val = params.get("lastName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(lastName=val)

        val = params.get("login_id", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(login_id=val)

        val = params.get("password", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(password=val)

        return q
예제 #4
0
    def search(self, params):
        params["pageNo"] = (params["pageNo"] - 1) * self.pageSize
        sql = "select * from sos_student where 1=1 "
        rowSql = "select count(ID) from sos_student where 1=1"

        val = params.get("firstName", None)
        if (DataValidator.isNotNull(val)):
            sql += " and firstName = '" + val + "' "
            rowSql += " and firstName = '" + val + "' "

        val = params.get("email", None)
        if (DataValidator.isNotNull(val)):
            sql += " and email = '" + val + "' "
            rowSql += " and email = '" + val + "' "

        sql += " LIMIT %s,%s"
        rowSql += " LIMIT %s,%s"
        cursor = connection.cursor()

        cursor.execute(sql, [params["pageNo"], self.pageSize])
        result = cursor.fetchall()
        test_tup1 = ("id", "firstName", "lastName", "dob", "mobileNumber",
                     "email", "college_ID", "collegeName")
        res = {"data": [], "count": []}
        count = 0
        for x in result:
            res["data"].append({test_tup1[i]: x[i] for i, _ in enumerate(x)})
        return res
예제 #5
0
    def search(self, params):
        params["pageNo"] = (params["pageNo"] - 1) * self.pageSize
        sql = "select * from sos_marksheet where 1=1 "
        rowSql = "select count(ID) from sos_marksheet where 1=1"

        val = params.get("rollNumber", None)
        if (DataValidator.isNotNull(val)):
            sql += " and rollNumber = '" + val + "' "
            rowSql += " and rollNumber = '" + val + "' "

        val = params.get("name", None)
        if (DataValidator.isNotNull(val)):
            sql += " and name = '" + val + "' "
            rowSql += " and name = '" + val + "' "

        sql += " LIMIT %s,%s"
        rowSql += " LIMIT %s,%s"
        cursor = connection.cursor()

        cursor.execute(sql, [params["pageNo"], self.pageSize])
        result = cursor.fetchall()
        test_tup1 = ("id", "rollNumber", "name", "physics", "chemistry",
                     "maths")
        res = {"data": [], "count": []}
        count = 0
        for x in result:
            res["data"].append({test_tup1[i]: x[i] for i, _ in enumerate(x)})
        return res
예제 #6
0
    def search(self,params):
        params["pageNo"]=(params["pageNo"]-1)*self.pageSize
        sql="select * from sos_subject where 1=1 "        
        rowSql="select count(ID) from sos_subject where 1=1"
        

        val = params.get("subjectName",None)
        if( DataValidator.isNotNull(val)):
            sql+=" and subjectName = '"+val+"' "
            rowSql+=" and subjectName = '"+val+"' "
        
        val = params.get("courseName",None)
        if( DataValidator.isNotNull(val)):
            sql+=" and courseName = '"+val+"' "
            rowSql+=" and courseName = '"+val+"' "
        
        sql+=" LIMIT %s,%s"
        rowSql+=" LIMIT %s,%s"
        cursor = connection.cursor()
       
        cursor.execute(sql,[params["pageNo"],self.pageSize])
        result=cursor.fetchall()
        test_tup1=("id","subjectName","subjectDescription","course_ID")
        res={
            "data":[],
            "count":[]
        }
        count=0
        for x in result:
            res["data"].append({test_tup1[i] :  x[i] for i, _ in enumerate(x)})            
        return res 
예제 #7
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("name", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(name=val)

        val = params.get("description", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(description=val)

        return q
예제 #8
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("login_id", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(login=val)
        return q
예제 #9
0
    def input_validation(self):
        super().input_validation()
        inputError = self.form["inputError"]
        if (DataValidator.isNull(self.form["firstName"])):
            inputError["firstName"] = "Name can not be null"
            self.form["error"] = True
        if (DataValidator.isNull(self.form["lastName"])):
            inputError["lastName"] = "Last Name can not be null"
            self.form["error"] = True
        if (DataValidator.isNull(self.form["login_id"])):
            inputError["login_id"] = "Login can not be null"
            self.form["error"] = True
        if (DataValidator.isNull(self.form["password"])):
            inputError["password"] = "******"
            self.form["error"] = True
        if (DataValidator.isNull(self.form["confirmpassword"])):
            inputError["confirmpassword"] = "******"
            self.form["error"] = True
        if (DataValidator.isNotNull(self.form["confirmpassword"])):
            if (self.form["password"] != self.form["confirmpassword"]):
                inputError[
                    "conpassword"] = "******"
                self.form["error"] = True

        if (DataValidator.isNull(self.form["dob"])):
            inputError["dob"] = "dob can not be null"
            self.form["error"] = True
        if (DataValidator.isNull(self.form["address"])):
            inputError["address"] = "address can not be null"
            self.form["error"] = True
        if (DataValidator.isNull(self.form["mobilenumber"])):
            inputError["mobilenumber"] = "mobileNumber can not be null"
            self.form["error"] = True
        return self.form["error"]
예제 #10
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("id", None)
        if (DataValidator.isInt(val)):
            q = q.filter(id=val)

        val = params.get("firstName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(firstName=val)

        val = params.get("lastName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(lastName=val)

        val = params.get("dob", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(dob=val)

        val = params.get("mobileNumber", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(mobileNumber=val)

        val = params.get("email", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(email=val)

        val = params.get("college_ID", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(college_ID=val)

        val = params.get("collegeName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(collegeName=val)
        return q
예제 #11
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("id", None)
        if (DataValidator.isInt(val)):
            q = q.filter(id=val)

        val = params.get("examTime", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(examTime=val)

        val = params.get("examDate", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(examDate=val)

        val = params.get("subject_ID", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(subject_ID=val)

        val = params.get("subjectName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(subjectName=val)

        val = params.get("course_ID", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(course_ID=val)

        val = params.get("courseName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(courseName=val)

        val = params.get("semester", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(semester=val)
        return q
예제 #12
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("id", None)
        if (DataValidator.isInt(val)):
            q = q.filter(id=val)

        val = params.get("courseName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(courseName=val)

        val = params.get("coursDescription", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(coursDescription=val)

        val = params.get("coursDuration", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(coursDuration=val)
        return q
예제 #13
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("rollNumber", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(rollNumber=val)

        val = params.get("name", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(name=val)

        val = params.get("physics", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(physics=val)

        val = params.get("chemistry", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(chemistry=val)

        val = params.get("maths", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(maths=val)

        val = params.get("student_ID", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(student_ID=val)

        return q
예제 #14
0
 def get_login_id(self, login):
     q = self.get_model().objects.filter()
     if (DataValidator.isNotNull(login)):
         q = q.filter(login_id=login)
     return q
예제 #15
0
    def search(self, params):
        q = self.get_model().objects.filter()

        val = params.get("firstName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(firstName=val)

        val = params.get("lastName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(lastName=val)

        val = params.get("email", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(email=val)

        val = params.get("password", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(password=val)

        val = params.get("mobileNumber", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(mobileNumber=val)

        val = params.get("address", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(address=val)

        val = params.get("gender", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(gender=val)

        val = params.get("dob", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(dob=val)

        val = params.get("college_ID", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(college_ID=val)

        val = params.get("collegeName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(collegeName=val)

        val = params.get("subject_ID", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(subject_ID=val)

        val = params.get("subjectName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(subjectName=val)

        val = params.get("course_ID", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(course_ID=val)

        val = params.get("courseName", None)
        if (DataValidator.isNotNull(val)):
            q = q.filter(courseName=val)
        return q