Package StockTradeBusinessClasses

Examples of StockTradeBusinessClasses.Customer


     * @param pPrice Type: float
     */
    public void decrementHolding(TextData pCustomerName, String pStockName, int pQuantity, float pPrice) {
        // TODO [129,Info]: Copy of parameter pCustomerName has been skipped because this method is on a service class for StockTradeServices.CustomerSO
        try {
            Customer oneCustomer = null;
            Holding custHolding = null;
            float incomeFromStock = pQuantity*pPrice;
   
            oneCustomer = this.getCustomer(pCustomerName);
            //custHolding = self.GetHolding(pCustomer=oneCustomer,
            //        pGetHoldStockName=pStockName);
            custHolding = this.SQLSelectHolding(pCustomerName, pStockName);
   
            if (custHolding.getQuantity() > pQuantity) {
                custHolding.setQuantity(custHolding.getQuantity()-pQuantity);
                oneCustomer.setCashBalance(oneCustomer.getCashBalance()+incomeFromStock);
                this.SQLUpdateHolding(custHolding);
                this.SQLUpdateCashBal(oneCustomer.getCustomerName(), oneCustomer.getCashBalance());
   
            }
            else if (custHolding.getQuantity() == pQuantity) {
                this.SQLDeleteHolding(custHolding);
   
                //oneCustomer.HoldingList.DeleteRow(object=custHolding);
                oneCustomer.setCashBalance(oneCustomer.getCashBalance()+incomeFromStock);
                this.SQLUpdateCashBal(oneCustomer.getCustomerName(), oneCustomer.getCashBalance());
   
            }
            else if (custHolding.getQuantity() < pQuantity) {
                InvalidTradeException badOrder = new InvalidTradeException();
                badOrder.setWithParams(Constants.SP_ER_ERROR, "Customer %1 does not own enough stock to place SELL Order", pCustomerName);
View Full Code Here


     * @param pGetCustCustomerName Type: TextData
     * @return Customer
     */
    public Customer getCustomer(TextData pGetCustCustomerName) {
        // TODO [129,Info]: Copy of parameter pGetCustCustomerName has been skipped because this method is on a service class for StockTradeServices.CustomerSO
        Customer aCustomer = this.SQLSelectCustomer(pGetCustCustomerName);
        aCustomer.setHoldingList(this.SQLSelectHoldingList(pGetCustCustomerName));

        return aCustomer;
    }
View Full Code Here

     * @param pQuantity Type: int
     * @param pPrice Type: float
     */
    public void incrementHolding(TextData pCustomerName, String pStockName, int pQuantity, float pPrice) {
        // TODO [129,Info]: Copy of parameter pCustomerName has been skipped because this method is on a service class for StockTradeServices.CustomerSO
        Customer oneCustomer = null;
        Holding custHolding = null;

        float costOfStock = pQuantity*pPrice;

        oneCustomer = this.getCustomer(pCustomerName);

        if (oneCustomer.getCashBalance() > costOfStock) {
            try {
                oneCustomer.setCashBalance(oneCustomer.getCashBalance()-costOfStock);
                //    custHolding = self.GetHolding(pCustomer=oneCustomer,pGetHoldStockName=pStockName);
                custHolding = this.SQLSelectHolding(pCustomerName, pStockName);
                custHolding.setQuantity(custHolding.getQuantity()+pQuantity);
                this.SQLUpdateHolding(custHolding);
                this.SQLUpdateCashBal(oneCustomer.getCustomerName(), oneCustomer.getCashBalance());

            }
            catch (NoSuchHoldingException noHolding) {
                    Holding newHolding = new Holding();
                    newHolding.setCustomerName(pCustomerName);
                    newHolding.setPrice(pPrice);
                    newHolding.setQuantity(pQuantity);
                    newHolding.setStockName(pStockName);
                    this.SQLInsertHolding(newHolding);
                    this.SQLUpdateCashBal(oneCustomer.getCustomerName(), oneCustomer.getCashBalance());


                    //        oneCustomer.HoldingList.AppendRow(object=newHolding);
            }
        }
View Full Code Here

     * setUp<p>
     * Code to populate CustomerList array<br>
     * <p>
     */
    private void setUp() {
        this.customerList.set(0, new Customer());
        this.customerList.get(0).getCustomerName().setValue( "Chris" );
        this.customerList.get(0).setAddress("123 4th Ave.\n San Francisco\nCA 94403");
        this.customerList.get(0).setPhoneNumber("5104268845");
        this.customerList.get(0).setCashBalance(45000f);

        Holding holding1 = new Holding();
        holding1.setStockName("Happy Duck");
        holding1.setQuantity(100);
        holding1.setPrice(120f);
        this.customerList.get(0).getHoldingList().add(holding1);

        Holding holding2 = new Holding();
        holding2.setStockName("Coarse Light");
        holding2.setQuantity(240);
        holding2.setPrice(50f);
        this.customerList.get(0).getHoldingList().add(holding2);


        Holding holding3 = new Holding();
        holding3.setStockName("Boston Quicken");
        holding3.setQuantity(50);
        holding3.setPrice(50f);
        this.customerList.get(0).getHoldingList().add(holding3);

        this.customerList.set(1, new Customer());
        this.customerList.get(1).getCustomerName().setValue( "Natasha" );
        this.customerList.get(1).setAddress("222 44th Ave.\nSan Diego\nCA 90210");
        this.customerList.get(1).setPhoneNumber("3335551234");
        this.customerList.get(1).setCashBalance(8000f);

        Holding holding4 = new Holding();
        holding4.setStockName("Boston Quicken");
        holding4.setQuantity(10);
        holding4.setPrice(120f);
        this.customerList.get(1).getHoldingList().add(holding4);

        Holding holding5 = new Holding();
        holding5.setStockName("Giorgio Osmondi");
        holding5.setQuantity(200);
        holding5.setPrice(30f);
        this.customerList.get(1).getHoldingList().add(holding5);

        Holding holding6 = new Holding();
        holding6.setStockName("MacDonna");
        holding6.setQuantity(100);
        holding6.setPrice(50f);
        this.customerList.get(1).getHoldingList().add(holding6);

        this.customerList.set(2, new Customer());
        this.customerList.get(2).getCustomerName().setValue( "Bill" );
        this.customerList.get(2).setAddress("2555 Alma St. #3\nPalo Alto\nCA 90011");
        this.customerList.get(2).setPhoneNumber("4155556666");
        this.customerList.get(2).setCashBalance(10000f);

View Full Code Here

     * <p>
     * @param pName Type: TextData
     * @return Customer
     */
    private Customer SQLSelectCustomer(TextData pName) {
        Customer aCustomer = new Customer();
        int recsReturned = 0;
        int qq_RowCount = 0;
        DBConnectionManager dBConnection = DBConnectionManager.getInstance("DBConnection");

        // -- =============== Original SQL ===============
View Full Code Here

     * <p>
     * @param pName Type: TextData
     * @return Customer
     */
    private Customer SQLSelectCustomer(TextData pName) {
        Customer aCustomer = new Customer();
        int recsReturned = 0;
        int qq_RowCount = 0;
        DBConnectionManager dBConnection = DBConnectionManager.getInstance("DBConnection");

        // -- =============== Original SQL ===============
View Full Code Here

    // ------------
    public CustomerWindow() {
        // Explicitly call the superclass constructor to prevent the implicit call
        super();
        this.initialize();
        this.setCustomerGrid(new Customer());
        //self.CustomerName = new;
        //self.HoldingList = new;

        //  Import code for Init Method for CustomerWindow class
        //  Populate HoldingList Array widget
View Full Code Here

        }
        return bindingManager;
    }

    public void setCustomerGrid(Customer customerGrid) {
        Customer oldValue = this.customerGrid;
        this.customerGrid = customerGrid;
        this.firePropertyChange("customerGrid", oldValue, this.customerGrid);
    }
View Full Code Here

TOP

Related Classes of StockTradeBusinessClasses.Customer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.