Package ControlLayer

Source Code of ControlLayer.ControlSupplier


package ControlLayer;
import java.util.ArrayList;

import DBLayer.DBConnection;
import DBLayer.DBSupplier;
import DBLayer.DBConnection;
import DBLayer.IFDBSupplier;
import ModelLayer.Supplier;



public class ControlSupplier {
  
   
    /** Creates a new instance of CtrEmp */
    public ControlSupplier() {
       
    }
   
    public Supplier searchByName(String Name)
    {
        IFDBSupplier DBSupplier = new DBSupplier();
        return DBSupplier.searchSupplierName(Name, true);
    }
    
   
      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);
         
         
      }
      //find the projects the employee is working on
  
      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);
              }
              catch(Exception ex){
               DBConnection.rollbackTransaction();
                    }
              DBConnection.commitTransaction();
            
    }
      }
       
        public void deleteSupplier(String name)
       
        {
          IFDBSupplier dbSupplierObj = new DBSupplier();
          dbSupplierObj.deleteSupplier(name);
        }
       
       
     
      public static void main(String[] args)
      {
        ControlSupplier ctr= new ControlSupplier();
        Supplier sup = new Supplier();
        DBSupplier dbSupplier = new DBSupplier();
       
        ctr.deleteSupplier("Toshko");
       
        }
     
     
      
       
      }
    
       
       
     
     
     

TOP

Related Classes of ControlLayer.ControlSupplier

TOP
Copyright © 2018 www.massapi.com. 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.