Exemple #1
0
    def save_opsgroup_details(self, login, opsgroupname, opsgroupdesc,
                              operation):
        dupOpsgrp = None
        db = DBHelper()
        session = DBHelper().get_session()
        dupOpsgrp = session.query(OperationGroup).filter(
            OperationGroup.name == opsgroupname).first()
        opsgroup = OperationGroup()
        if dupOpsgrp is None:
            result = []
            opsgroup.name = (opsgroupname)
            opsgroup.description = (opsgroupdesc)
            opsgroup.created_by = (login)
            opsgroup.modified_by = (login)
            opsgroup.created_date = datetime.now()
            L = ((operation)).split(',')
            for i in L:
                oper = session.query(Operation).filter(
                    Operation.id == int(i)).first()
                opsgroup.operations.append(oper)

            db.add(opsgroup)
            return result
        else:
            result = "False"
            return result
Exemple #2
0
    def updatesave_opsgroup_details(self, login,opsgroupid ,opsgroupname, opsgroupdesc,operation):

        result = []
        opsgroup=OperationGroup();
        db=DBHelper()
        session=DBHelper().get_session()
        opsgroup=session.query(OperationGroup).filter(OperationGroup.id==opsgroupid).first()
        opsgroup.name=opsgroupname
        opsgroup.description=opsgroupdesc
        opsgroup.modified_date=datetime.now()
        opsgroup.modified_by=(login)     

        operation = operation[0:-1]
        L=(operation).split(',')
        for i in L:
                operation=session.query(Operation).filter(Operation.id==int(i)).first()
                opsgroup.operations.append(operation);
        db.update(opsgroup);
        return result
Exemple #3
0
    def updatesave_opsgroup_details(self, login, opsgroupid, opsgroupname,
                                    opsgroupdesc, operation):

        result = []
        opsgroup = OperationGroup()
        db = DBHelper()
        session = DBHelper().get_session()
        opsgroup = session.query(OperationGroup).filter(
            OperationGroup.id == opsgroupid).first()
        opsgroup.name = opsgroupname
        opsgroup.description = opsgroupdesc
        opsgroup.modified_date = datetime.now()
        opsgroup.modified_by = (login)

        operation = operation[0:-1]
        L = (operation).split(',')
        for i in L:
            operation = session.query(Operation).filter(
                Operation.id == int(i)).first()
            opsgroup.operations.append(operation)
        db.update(opsgroup)
        return result
Exemple #4
0
    def save_opsgroup_details(self,login, opsgroupname, opsgroupdesc, operation):
        dupOpsgrp=None
        db=DBHelper()
        session=DBHelper().get_session()
        dupOpsgrp=session.query(OperationGroup).filter(OperationGroup.name==opsgroupname).first()
        opsgroup=OperationGroup();
        if dupOpsgrp is None:
           result=[]
           opsgroup.name=(opsgroupname)
           opsgroup.description=(opsgroupdesc)
           opsgroup.created_by=(login)
           opsgroup.modified_by=(login)
           opsgroup.created_date=datetime.now()
           L=((operation)).split(',')
           for i in L:
               oper=session.query(Operation).filter(Operation.id==int(i)).first()
               opsgroup.operations.append(oper);

           db.add(opsgroup);
           return result
        else:
            result="False"
            return result