2017-07-26 18:18:37 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace db_AI_4
|
|
|
|
|
{
|
|
|
|
|
public partial class Dashboard : Form
|
|
|
|
|
{
|
|
|
|
|
//Search Locations start
|
|
|
|
|
List<GetLocations> locations = new List<GetLocations>();
|
2017-08-02 22:36:24 +02:00
|
|
|
|
List<GetLocations> rentlocation = new List<GetLocations>();
|
|
|
|
|
List<GetRents> rentedlocations = new List<GetRents>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BindingSource locationBinding = new BindingSource();
|
|
|
|
|
BindingSource addlocationBinding = new BindingSource();
|
|
|
|
|
BindingSource showrentBinding = new BindingSource();
|
|
|
|
|
|
2017-07-26 18:18:37 +02:00
|
|
|
|
public Dashboard()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
UpdateBinding();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdateBinding()
|
|
|
|
|
{
|
2017-08-02 22:36:24 +02:00
|
|
|
|
// Loading of the Searched Locations
|
2017-07-26 18:18:37 +02:00
|
|
|
|
LocationListBox.DataSource = locations;
|
|
|
|
|
LocationListBox.DisplayMember = "LocationInfo";
|
2017-08-02 22:36:24 +02:00
|
|
|
|
|
|
|
|
|
locationBinding.DataSource = locations;
|
|
|
|
|
LocationListBox.DataSource = locationBinding;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Loading of the Selected Locations
|
|
|
|
|
ADDLocationListBox.DataSource = rentlocation;
|
|
|
|
|
ADDLocationListBox.DisplayMember = "LocationInfo";
|
|
|
|
|
|
|
|
|
|
addlocationBinding.DataSource = rentlocation;
|
|
|
|
|
ADDLocationListBox.DataSource = addlocationBinding;
|
|
|
|
|
|
|
|
|
|
// Rented Locations
|
|
|
|
|
ShowRentListBox.DataSource = rentedlocations;
|
|
|
|
|
ShowRentListBox.DisplayMember = "RentInfo";
|
|
|
|
|
|
|
|
|
|
showrentBinding.DataSource = rentedlocations;
|
|
|
|
|
ShowRentListBox.DataSource = showrentBinding;
|
|
|
|
|
|
|
|
|
|
|
2017-07-26 18:18:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-08-02 22:36:24 +02:00
|
|
|
|
|
2017-07-26 18:18:37 +02:00
|
|
|
|
private void LocationSearchButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DataAccess db = new DataAccess();
|
|
|
|
|
|
|
|
|
|
locations = db.GetLocations(LocationTextBox.Text);
|
|
|
|
|
|
|
|
|
|
UpdateBinding();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// Search Locations end
|
|
|
|
|
|
2017-08-02 22:36:24 +02:00
|
|
|
|
/*
|
2017-07-26 18:18:37 +02:00
|
|
|
|
//Insert Locations start
|
|
|
|
|
private void LocationInsertButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DataAccess db = new DataAccess();
|
|
|
|
|
|
|
|
|
|
int CapacityValue;
|
|
|
|
|
CapacityValue = Convert.ToInt32(LocationCapacityInputBox.Text);
|
|
|
|
|
CapacityValue = int.Parse(LocationCapacityInputBox.Text);
|
|
|
|
|
|
|
|
|
|
db.InsertLocations(StreetnameInsertBox.Text, Convert.ToInt32(LocationCapacityInputBox.Text), LocationNameInputBox.Text);
|
|
|
|
|
|
|
|
|
|
StreetnameInsertBox.Text = "";
|
|
|
|
|
LocationCapacityInputBox.Text = "";
|
|
|
|
|
LocationNameInputBox.Text = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// Insert Locations end
|
2017-08-02 22:36:24 +02:00
|
|
|
|
*/
|
2017-07-26 20:20:14 +02:00
|
|
|
|
|
|
|
|
|
// Insert Rent start
|
|
|
|
|
private void RentInsertButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DataAccess db = new DataAccess();
|
|
|
|
|
|
2017-08-02 22:36:24 +02:00
|
|
|
|
|
|
|
|
|
|
2017-07-26 20:20:14 +02:00
|
|
|
|
int RentPriceID;
|
|
|
|
|
RentPriceID = 1;
|
|
|
|
|
|
2017-08-30 15:23:13 +02:00
|
|
|
|
//int MemberID;
|
|
|
|
|
//MemberID = 1;
|
2017-07-26 20:20:14 +02:00
|
|
|
|
|
2017-08-30 15:23:13 +02:00
|
|
|
|
db.InsertRent(RentDateTimePicker.Value.Date.ToString("yyyyMMdd"), GetMembers.member_id, RentPriceID);
|
2017-07-26 20:20:14 +02:00
|
|
|
|
|
|
|
|
|
RentDateTimePicker.Text = "";
|
2017-08-02 22:36:24 +02:00
|
|
|
|
|
2017-07-26 20:20:14 +02:00
|
|
|
|
}
|
|
|
|
|
// Insert Rent end
|
|
|
|
|
|
2017-08-02 22:36:24 +02:00
|
|
|
|
|
|
|
|
|
//Add Location to ADDBox start
|
|
|
|
|
private void ADDLocationButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
GetLocations selectedItem = (GetLocations)LocationListBox.SelectedItem;
|
|
|
|
|
|
|
|
|
|
rentlocation.Add(selectedItem);
|
|
|
|
|
|
|
|
|
|
UpdateBinding();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Dashboard_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ShowRentButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DataAccess db = new DataAccess();
|
|
|
|
|
|
|
|
|
|
rentedlocations = db.GetRentedLocations(RentedTextBox.Text);
|
|
|
|
|
|
|
|
|
|
UpdateBinding();
|
|
|
|
|
}
|
2017-08-27 09:43:05 +02:00
|
|
|
|
|
|
|
|
|
private void ShowRentListBox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2017-08-02 22:36:24 +02:00
|
|
|
|
//Add Location to ADDBox end
|
|
|
|
|
|
2017-07-26 18:18:37 +02:00
|
|
|
|
}
|
|
|
|
|
}
|