Exemplo n.º 1
0
def delete_order_by_id(od_id):
    c = bo.Order(OrderID=od_id)
    result = do.Order(ConnectionData).delete(c)
    return jsonify({'message': result[0]}), result[1]
Exemplo n.º 2
0
def get_all_product():
    result = do.Product(ConnectionData).get_all()
    return jsonify(result), 200
Exemplo n.º 3
0
def test_insert():
    c2 = do.Customer(ConnectionData)
    c1 = bo.Customer('Tien', 'Do', '1999', 'QuangBinh', 'DongHoi', 'VietNam')
    s1 = c2.insert(c1)
    return s1
Exemplo n.º 4
0
def get_order_by_id(od_id):
    order = bo.Order(OrderID=od_id)
    result = do.Order(ConnectionData).get_by_id(order)
    if result[1] != 200:
        return jsonify({'message': result[0]}), result[1]
    return jsonify(result[0].to_json()), 200
Exemplo n.º 5
0
def delete_shipper_by_id(shipper_id):
    c = bo.Shipper(ShipperID=shipper_id)
    result = do.Shipper(ConnectionData).delete(c)
    return jsonify({'message': result[0]}), result[1]
Exemplo n.º 6
0
def insert_category():
    data = request.json
    category = bo.Category(1, data['CategoryName'], data['Description'])
    result = do.Category(ConnectionData).insert(category)
    return jsonify({'message': result}), 200
Exemplo n.º 7
0
def get_category_by_id(category_id):
    category = bo.Category(CategoryID=category_id)
    result = do.Category(ConnectionData).get_by_id(category)
    if result[1] != 200:
        return jsonify({'message': result[0]}), result[1]
    return jsonify(result[0].to_json()), 200
Exemplo n.º 8
0
def get_all_shipper():
    result = do.Shipper(ConnectionData).get_all()
    return jsonify(result), 200
Exemplo n.º 9
0
def delete_user_by_id(customer_id):
    c = bo.Customer(CustomerID=customer_id)
    result = do.Customer(ConnectionData).delete(c)
    return jsonify({'message': result[0]}), result[1]
Exemplo n.º 10
0
def initLogger(args, debug, version):
    """
	Function initializing pipeline logger for optimal monitoring.

	@param1 args: Object containing pipeline parameters
	@param2 debug: if the option debug is set
	@param3 version: Pipeline version
	@return1 mainData: Filled basicData object
	@return2 logger: Logging object
	"""

    ## Log
    ### Set up the log directory
    timeStamp = strftime("%Y%m%d%H%M", localtime())
    if args["infile"] != "":
        if args["logfile"] == "":
            args["logfile"] = args["infile"].split(
                ".")[0] + "_DGINN_" + timeStamp + ".log"
        else:
            args["logfile"] = args["infile"].split(".")[0] + args["logfile"]
    else:
        if args["logfile"] == "":
            args["logfile"] = args["alnfile"].split(
                ".")[0] + "_DGINN_" + timeStamp + ".log"
        else:
            args["logfile"] = args["logfile"]

    # create logger
    #logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger("main")
    logger.setLevel(logging.INFO)
    # create file handler which logs even debug messages
    fh = logging.FileHandler(args["logfile"])
    # create console handler with a higher log level
    ch = logging.StreamHandler()
    if debug:
        logger.setLevel(logging.DEBUG)
        ch.setLevel(logging.DEBUG)
        fh.setLevel(logging.DEBUG)
    else:
        ch.setLevel(logging.INFO)
        fh.setLevel(logging.INFO)
    #create formatter and add it to the handlers
    formatter = logging.Formatter(
        '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    fh.setFormatter(formatter)
    ch.setFormatter(formatter)
    # add the handlers to the logger
    logger.addHandler(fh)
    logger.addHandler(ch)
    # Welcome message
    logger.info("Starting {:s} (v{:s})".format(__file__, version))

    mainData = DataObject.basicData(args["infile"], args["outdir"],
                                    args["blastdb"], timeStamp, args["sptree"],
                                    args["alnfile"], args["treefile"],
                                    args["queryName"])

    if args["step"] == "duplication" and args["duplication"] == False:
        args["duplication"] == True
    elif args["step"] == "recombination" and args["recombination"] == False:
        args["recombination"] == True

    logger.info("Reading input file {:s}".format(mainData.queryFile))
    logger.info("Output directory: {:s}".format(mainData.o))
    logger.info("Analysis will begin at the {:s} step".format(args["step"]))

    return mainData, logger
Exemplo n.º 11
0
def get_user_by_id(customer_id):
    c = bo.Customer(CustomerID=customer_id)
    result = do.Customer(ConnectionData).get_by_id(c)
    if result[1] != 200:
        return jsonify({'message': result[0]}), result[1]
    return jsonify(result[0].to_json()), 200
Exemplo n.º 12
0
def get_all_user():
    result = do.Customer(ConnectionData).get_all()
    return jsonify(result), 200
Exemplo n.º 13
0
def test_insert():
    c2 = do.Employee(ConnectionData)
    c1 = bo.Employee(1, 'Phong', 'Ngô', '1999', 'Da Nang', 'VietNam')
    s1 = c2.insert(c1)
    return s1
Exemplo n.º 14
0
def get_product_by_id(product_id):
    c = bo.Product(ProductID=product_id)
    result = do.Product(ConnectionData).get_by_id(c)
    if result[1] != 200:
        return jsonify({'message': result[0]}), result[1]
    return jsonify(result[0].to_json()), 200
Exemplo n.º 15
0
def delete_category_by_id(category_id):
    c = bo.Category(CategoryID=category_id)
    result = do.Category(ConnectionData).delete(c)
    return jsonify({'message': result[0]}), result[1]
Exemplo n.º 16
0
def delete_product_by_id(product_id):
    c = bo.Product(ProductID=product_id)
    result = do.Product(ConnectionData).delete(c)
    return jsonify({'message': result[0]}), result[1]
Exemplo n.º 17
0
def get_all_employee():
    result = do.Employee(ConnectionData).get_all()
    return jsonify(result), 200
Exemplo n.º 18
0
def get_shipper_by_id(shipper_id):
    c = bo.Shipper(ShipperID=shipper_id)
    result = do.Shipper(ConnectionData).get_by_id(c)
    if result[1] != 200:
        return jsonify({'message': result[0]}), result[1]
    return jsonify(result[0].to_json()), 200
Exemplo n.º 19
0
def get_all_order():
    c = do.Order(ConnectionData).get_all()
    return jsonify(c), 200
Exemplo n.º 20
0
def get_all_supplier():
    result = do.Supplier(ConnectionData).get_all()
    return jsonify(result), 200
Exemplo n.º 21
0
def get_all_category():
    c = do.Category(ConnectionData).get_all()
    return jsonify(c), 200