Package ModelLayer

Examples of ModelLayer.Supplier


       return(rc);
    }

  public int updateSupplier(Supplier sup)
  {
    Supplier supObj  = sup;
    int rc=-1;

    String query="UPDATE supliers SET "+
         "Name='"+ supObj.getName()+"', "+
         "Address ='"+ supObj.getAddress() + "', " +
                          "Country ='"+ supObj.getCountry() + "', " +
                          "PhoneNumber ='"+ supObj.getPhoneNumber()+ "', " +
                          "Email ='"+ supObj.getEmail()+ "' " +
              " WHERE Name= '"+ supObj.getName()+"'";
                System.out.println("Update query:" + query);
      try{ // update employee
       Statement stmt = con.createStatement();
       stmt.setQueryTimeout(5);
        rc = stmt.executeUpdate(query);
View Full Code Here


  
  //Singelwhere is used when we only select one employee  
  private Supplier singleWhere(String wClause, boolean retrieveAssociation)
  {
    ResultSet results = null;
    Supplier supObj = new Supplier();
               
          String query =  buildQuery(wClause);
                System.out.println(query);
    try{ // read the employee from the database
       Statement stmt = con.createStatement();
View Full Code Here

     
    return query;
  }

  private Supplier buildSupplier(ResultSet results)
      {   Supplier supObj = new Supplier();
          try{ // the columns from the table emplayee  are used
              supObj.setSupplierID(results.getInt("SuplierID"));
                supObj.setName(results.getString("Name"));
                supObj.setAddress(results.getString("Address"));
                supObj.setCountry(results.getString("Country"));
                supObj.setPhoneNumber(results.getString("phoneNumber"));
      supObj.setEmail(results.getString("Email"));
     
          }
         catch(Exception e)
         {
             System.out.println("error in building the supplier object");
View Full Code Here

    
   
      public int updateSupplier(String Name, String Address, String Country, String PhoneNumber , String Email)
      {
          IFDBSupplier dbSupplier = new DBSupplier();
          Supplier sup = new Supplier();
          String name1 = dbSupplier.searchSupplierName(Name, false).getName();
        
          sup.setName(name1);
          sup.setAddress(Address);
          sup.setCountry(Country);
          sup.setPhoneNumber(PhoneNumber);
          sup.setEmail(Email);
       
          return  dbSupplier.updateSupplier(sup);
         
         
      }
View Full Code Here

  
      public void insertNew(String Name, String Address, String Country , String PhoneNumber, String Email)
      {   
        {   
          
              Supplier supObj = new Supplier();
              supObj.setName(Name);
                  
              supObj.setAddress(Address);
              supObj.setCountry(Country);
              supObj.setPhoneNumber(PhoneNumber);
              supObj.setEmail(Email);
      
              DBConnection.startTransaction();
              try{
               DBSupplier dbSupplier = new DBSupplier();
                 dbSupplier.insertSupplier(supObj);
View Full Code Here

       
     
      public static void main(String[] args)
      {
        ControlSupplier ctr= new ControlSupplier();
        Supplier sup = new Supplier();
        DBSupplier dbSupplier = new DBSupplier();
       
        ctr.deleteSupplier("Toshko");
       
        }
View Full Code Here

TOP

Related Classes of ModelLayer.Supplier

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.