public void updateTotal(LocationEquips locationEquips)
 {
     connection.open();
     command = new SqlCommand("update LocationEquips set total='" + locationEquips.getTotal() + "' where locationID='" + locationEquips.getLocationID() + "'", connection.getConnection());
     command.ExecuteNonQuery();
     connection.close();
 }
 public void selectID(LocationEquips locationEquips)
 {
     connection.open();
     command = new SqlCommand("select ID from LocationEquips where locationID='" + locationEquips.getLocationID() + "'", connection.getConnection());
     locationEquips.setID((int)command.ExecuteScalar());
     connection.close();
 }
 public void getTotal(LocationEquips locationEquips)
 {
     connection.open();
     command = new SqlCommand("select total from LocationEquips where locationID = '" + locationEquips.getLocationID() + "'", connection.getConnection());
     locationEquips.setTotal((double)command.ExecuteScalar());
     connection.close();
 }
 public void insert(LocationEquips locationEquips)
 {
     connection.open();
     command = new SqlCommand("insert into LocationEquips values('" + locationEquips.getTotal() + "' , '" + locationEquips.getLocationID() + "')", connection.getConnection());
     command.ExecuteNonQuery();
     connection.close();
 }
 public void selectLastID(LocationEquips locationEquips)
 {
     connection.open();
     command = new SqlCommand("select TOP 1 ID from LocationEquips ORDER BY ID DESC", connection.getConnection());
     locationEquips.setID((int)command.ExecuteScalar());
     connection.close();
 }
Exemple #6
0
 public int getLastID()
 {
     locationEquips   = new LocationEquips();
     locationEquipsDB = new LocationEquipsDB();
     locationEquipsDB.selectLastID(locationEquips);
     return(locationEquips.getID());
 }
Exemple #7
0
    public void update(double total, string locationName)
    {
        locationControl  = new LocationControl();
        locationEquips   = new LocationEquips();
        locationEquipsDB = new LocationEquipsDB();
        int ID = locationControl.getID(locationName);

        locationEquips.setLocationID(ID);
        locationEquips.setTotal(total);
        locationEquipsDB.updateTotal(locationEquips);
    }
Exemple #8
0
    public double getTotal(string locationName)
    {
        locationControl  = new LocationControl();
        locationEquips   = new LocationEquips();
        locationEquipsDB = new LocationEquipsDB();
        int ID = locationControl.getID(locationName);

        locationEquips.setLocationID(ID);
        locationEquipsDB.getTotal(locationEquips);
        return(locationEquips.getTotal());
    }
Exemple #9
0
    public int getID(string locationName)
    {
        locationControl  = new LocationControl();
        locationEquips   = new LocationEquips();
        locationEquipsDB = new LocationEquipsDB();
        int ID = locationControl.getID(locationName);

        locationEquips.setLocationID(ID);
        locationEquipsDB.selectID(locationEquips);
        return(locationEquips.getID());
    }
Exemple #10
0
    public bool checkIfLocationHasEquips(string locationName)
    {
        locationControl  = new LocationControl();
        locationEquips   = new LocationEquips();
        locationEquipsDB = new LocationEquipsDB();
        int ID = locationControl.getID(locationName);

        locationEquips.setLocationID(ID);
        bool check = locationEquipsDB.checkIfLocationHasDevices(locationEquips);

        return(check);
    }
    public bool checkIfLocationHasDevices(LocationEquips locationEquips)
    {
        connection.open();
        command = new SqlCommand("select count(*) from LocationEquips where locationID='" + locationEquips.getID() + "'", connection.getConnection());

        int count = (int)command.ExecuteScalar();

        connection.close();

        if (count > 0)
        {
            return(true); // has devices.
        }
        else
        {
            return(false); // don't has.
        }
    }