コード例 #1
0
    public Boolean UpdateDevice(string prevoiusName, string name, double price, double quantity, double total)
    {
        Boolean check = false;

        devicesStore   = new DevicesStore();
        devicesStoreDB = new DevicesStoreDB();

        if (prevoiusName.Equals("NOT CHANAGEE"))
        {
            devicesStore.setName(name);
        }
        else
        {
            devicesStore.setName(name);
            check = devicesStoreDB.checkDevice(devicesStore);
            devicesStore.setName(prevoiusName);
        }
        devicesStore.setPrice(price);
        devicesStore.setQuantity(quantity);
        devicesStore.setTotal(total);

        if (check == true)
        {
            return(false);
        }
        else
        {
            int ID = devicesStoreDB.selectDeviceId(devicesStore);
            devicesStore.setID(ID);
            devicesStore.setName(name);
            devicesStoreDB.update(devicesStore);
            return(true);
        }
    }
コード例 #2
0
 public void deleteDevices(string deviceName)
 {
     devicesStore   = new DevicesStore();
     devicesStoreDB = new DevicesStoreDB();
     devicesStore.setName(deviceName);
     devicesStoreDB.delete(devicesStore);
 }
コード例 #3
0
 public double getQuantity(string itemName)
 {
     devicesStore   = new DevicesStore();
     devicesStoreDB = new DevicesStoreDB();
     devicesStore.setName(itemName);
     devicesStoreDB.selectQuantity(devicesStore);
     return(devicesStore.getQuantity());
 }
コード例 #4
0
 public void updateQuantityPlus(string deviceName, double quantity)
 {
     devicesStore   = new DevicesStore();
     devicesStoreDB = new DevicesStoreDB();
     devicesStore.setName(deviceName);
     devicesStore.setQuantity(quantity);
     devicesStoreDB.updateQuantityPlus(devicesStore);
 }
コード例 #5
0
 public double getDevicePrice(string name)
 {
     devicesStoreDB = new DevicesStoreDB();
     devicesStore   = new DevicesStore();
     devicesStore.setName(name);
     devicesStoreDB.selectPrice(devicesStore);
     return(devicesStore.getPrice());
 }
コード例 #6
0
    public bool checkItemInStore(string itemName)
    {
        devicesStore   = new DevicesStore();
        devicesStoreDB = new DevicesStoreDB();
        devicesStore.setName(itemName);
        bool check = devicesStoreDB.checkDevice(devicesStore);

        return(check);
    }
コード例 #7
0
    public void fillComboboxDevicesName(ComboBox combobox)
    {
        combobox.Items.Clear();
        connection     = new DBConnection();
        devicesStoreDB = new DevicesStoreDB();
        SqlDataReader reader = devicesStoreDB.fillComboboxDeviceName();

        while (reader.Read())
        {
            combobox.Items.Add(reader["name"]);
        }
        connection.close();
    }
コード例 #8
0
 public bool checkItemQuantity(string itemName, double quantity)
 {
     devicesStore   = new DevicesStore();
     devicesStoreDB = new DevicesStoreDB();
     devicesStore.setName(itemName);
     devicesStoreDB.selectQuantity(devicesStore);
     if (quantity > devicesStore.getQuantity())
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
コード例 #9
0
    public void fillListViewDevicesStore(ListView listView)
    {
        listView.Items.Clear();
        connection     = new DBConnection();
        devicesStoreDB = new DevicesStoreDB();
        SqlDataReader reader = devicesStoreDB.fillListViewDevices();

        while (reader.Read())
        {
            ListViewItem lvi = new ListViewItem(reader["name"].ToString());
            lvi.SubItems.Add(reader["price"].ToString());
            lvi.SubItems.Add(reader["quantity"].ToString());
            lvi.SubItems.Add(reader["total"].ToString());
            listView.Items.Add(lvi);
        }
        connection.close();
    }
コード例 #10
0
 public Boolean insertDevices(string name, double price, double quantity, double total)
 {
     devicesStore   = new DevicesStore();
     devicesStoreDB = new DevicesStoreDB();
     devicesStore.setName(name);
     devicesStore.setPrice(price);
     devicesStore.setQuantity(quantity);
     devicesStore.setTotal(total);
     check = devicesStoreDB.checkDevice(devicesStore);
     if (check == true)
     {
         return(false);
     }
     else
     {
         devicesStoreDB.insert(devicesStore);
         return(true);
     }
 }