@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SWEN
{
public partial class CreateShift : Form
{
public static string connectionString = "Server=SIRIUS;Database=DelonixRegia;User ID=bspiSCM;password=Nikoookami02";
public static SqlConnection cnn = new SqlConnection(connectionString);

public CreateShift()
{
InitializeComponent();
}

private void buttonCreateShift_Click(object sender, EventArgs e)
{
try
{
cnn.Open();

string dutyType = comboBoxDutyType.SelectedItem.ToString();
string date = dateTimePickerDate.Value.ToString("dd-MM-yyyy");
string startTime = dateTimePickerStartTime.Value.ToString("hh:mm tt");
if (comboBoxStaffID.SelectedItem != null)
{
string staffID = comboBoxStaffID.SelectedValue.ToString();
if (comboBoxRoomID.SelectedItem != null)//Got both staffID and roomID
{
string roomID = comboBoxRoomID.SelectedValue.ToString();

string cmdString = "INSERT INTO Housekeeping (housekeepingtype,housekeepingdate,housekeepingtime," +
"staffid,roomid)" +
" VALUES (@housekeepingtype, @housekeepingdate,@housekeepingtime," +
"@staffid,@roomid)";
using (SqlCommand comm = new SqlCommand())
{
comm.Connection = cnn;
comm.CommandText = cmdString;
comm.Parameters.AddWithValue("@housekeepingtype", dutyType);
comm.Parameters.AddWithValue("@housekeepingdate", date);
comm.Parameters.AddWithValue("@housekeepingtime", startTime);
comm.Parameters.AddWithValue("@staffid", staffID);
comm.Parameters.AddWithValue("@roomid", roomID);
comm.ExecuteNonQuery();
}
}
else//Got staffID, no roomID
{
string cmdString = "INSERT INTO Housekeeping (housekeepingtype,housekeepingdate,housekeepingtime," +
"staffid)" +
" VALUES (@housekeepingtype, @housekeepingdate,@housekeepingtime," +
"@staffid)";
using (SqlCommand comm = new SqlCommand())
{
comm.Connection = cnn;
comm.CommandText = cmdString;
comm.Parameters.AddWithValue("@housekeepingtype", dutyType);
comm.Parameters.AddWithValue("@housekeepingdate", date);
comm.Parameters.AddWithValue("@housekeepingtime", startTime);
comm.Parameters.AddWithValue("@staffid", staffID);
comm.ExecuteNonQuery();
}
}
}
else
{
if (comboBoxRoomID.SelectedItem != null)//No staffID, got room ID
{
string roomID = comboBoxRoomID.SelectedItem.ToString();

string cmdString = "INSERT INTO Housekeeping (housekeepingtype,housekeepingdate,housekeepingtime," +
"roomid)" +
" VALUES (@housekeepingtype, @housekeepingdate,@housekeepingtime," +
"@roomid)";
using (SqlCommand comm = new SqlCommand())
{
comm.Connection = cnn;
comm.CommandText = cmdString;
comm.Parameters.AddWithValue("@housekeepingtype", dutyType);
comm.Parameters.AddWithValue("@housekeepingdate", date);
comm.Parameters.AddWithValue("@housekeepingtime", startTime);
comm.Parameters.AddWithValue("@roomid", roomID);
comm.ExecuteNonQuery();
}
}
else//No both
{
string cmdString = "INSERT INTO Housekeeping (housekeepingtype,housekeepingdate,housekeepingtime" +
")" +
" VALUES (@housekeepingtype, @housekeepingdate,@housekeepingtime" +
")";
using (SqlCommand comm = new SqlCommand())
{
comm.Connection = cnn;
comm.CommandText = cmdString;
comm.Parameters.AddWithValue("@housekeepingtype", dutyType);
comm.Parameters.AddWithValue("@housekeepingdate", date);
comm.Parameters.AddWithValue("@housekeepingtime", startTime);
comm.ExecuteNonQuery();
}
}
}
cnn.Close();
MessageBox.Show("Done!");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

private void CreateShift_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'delonixRegiaDataSet.Room' table. You can move, or remove it, as needed.
this.roomTableAdapter.Fill(this.delonixRegiaDataSet.Room);
// TODO: This line of code loads data into the 'delonixRegiaDataSet.Staff' table. You can move, or remove it, as needed.
this.staffTableAdapter.Fill(this.delonixRegiaDataSet.Staff);

comboBoxRoomID.SelectedItem = null;
comboBoxStaffID.SelectedItem = null;
}
}
}
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="staffBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>181, 17</value>
</metadata>
<metadata name="staffBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>181, 17</value>
</metadata>
<metadata name="delonixRegiaDataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="delonixRegiaDataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="roomBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>483, 17</value>
</metadata>
<metadata name="roomBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>483, 17</value>
</metadata>
<metadata name="staffTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>335, 17</value>
</metadata>
<metadata name="roomTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>643, 17</value>
</metadata>
</root>
@@ -76,7 +76,10 @@ private void buttonCancelShift_Click(object sender, EventArgs e)

private void buttonUpdateShift_Click(object sender, EventArgs e)
{

//this.Hide();
var form = new UpdateShift();
//form.Closed += (s, args) => this.Close();
form.Show();
}

private void buttonDeleteStaff_Click(object sender, EventArgs e)
@@ -86,5 +89,13 @@ private void buttonDeleteStaff_Click(object sender, EventArgs e)
//form.Closed += (s, args) => this.Close();
form.Show();
}

private void buttonCreateShift_Click(object sender, EventArgs e)
{
//this.Hide();
var form = new CreateShift();
//form.Closed += (s, args) => this.Close();
form.Show();
}
}
}
@@ -65,6 +65,12 @@
<Compile Include="Checkout.Designer.cs">
<DependentUpon>Checkout.cs</DependentUpon>
</Compile>
<Compile Include="CreateShift.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CreateShift.Designer.cs">
<DependentUpon>CreateShift.cs</DependentUpon>
</Compile>
<Compile Include="DeleteStaff.cs">
<SubType>Form</SubType>
</Compile>
@@ -120,6 +126,12 @@
<Compile Include="UpdateBooking.Designer.cs">
<DependentUpon>UpdateBooking.cs</DependentUpon>
</Compile>
<Compile Include="UpdateShift.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UpdateShift.Designer.cs">
<DependentUpon>UpdateShift.cs</DependentUpon>
</Compile>
<Compile Include="UpdateStaff.cs">
<SubType>Form</SubType>
</Compile>
@@ -135,6 +147,9 @@
<EmbeddedResource Include="Checkout.resx">
<DependentUpon>Checkout.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CreateShift.resx">
<DependentUpon>CreateShift.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DeleteStaff.resx">
<DependentUpon>DeleteStaff.cs</DependentUpon>
</EmbeddedResource>
@@ -169,6 +184,9 @@
<EmbeddedResource Include="UpdateBooking.resx">
<DependentUpon>UpdateBooking.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UpdateShift.resx">
<DependentUpon>UpdateShift.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UpdateStaff.resx">
<DependentUpon>UpdateStaff.cs</DependentUpon>
</EmbeddedResource>
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SWEN
{
public partial class UpdateShift : Form
{
public UpdateShift()
{
InitializeComponent();
}

private void UpdateShift_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'delonixRegiaDataSet.Housekeeping' table. You can move, or remove it, as needed.
this.housekeepingTableAdapter.Fill(this.delonixRegiaDataSet.Housekeeping);

}

private void comboBoxSelectDutyID_SelectionChangeCommitted(object sender, EventArgs e)
{

SqlConnection cnn = new SqlConnection("Server=SIRIUS;Database=DelonixRegia;User ID=bspiSCM;password=Nikoookami02");
SqlCommand selectCommand = new SqlCommand("SELECT * FROM Housekeeping WHERE housekeepingid='" + comboBoxSelectDutyID.SelectedValue + "'", cnn);
SqlDataAdapter ada = new SqlDataAdapter(selectCommand);
DataTable dt = new DataTable();
ada.Fill(dt);

DataRow dr = dt.Rows[0];
comboBoxDutyType.SelectedValue = dr["housekeepingtype"].ToString();
dateTimePickerDate.Value = DateTime.Parse(dr["housekeepingdate"].ToString());
dateTimePickerStartTime.Value = DateTime.Parse(dr["housekeepingtime"].ToString());
comboBoxStaffID.SelectedValue = dr["staffid"].ToString();
comboBoxRoomID.SelectedValue = dr["roomid"].ToString();

}
}
}
@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="staffBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>797, 17</value>
</metadata>
<metadata name="staffBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>797, 17</value>
</metadata>
<metadata name="delonixRegiaDataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="delonixRegiaDataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="roomBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>181, 56</value>
</metadata>
<metadata name="roomBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>181, 56</value>
</metadata>
<metadata name="staffTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>341, 56</value>
</metadata>
<metadata name="roomTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>489, 56</value>
</metadata>
<metadata name="housekeepingBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>643, 56</value>
</metadata>
<metadata name="housekeepingTableAdapter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>850, 56</value>
</metadata>
<metadata name="housekeepingBindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
</metadata>
</root>