Exemplo n.º 1
0
        public Boolean updateParkingSpace(ParkingSlot passedData)
        {
            bool reqStatus = false;

            passedData.slotIsAvailable = passedData.slotIsAvailable;
            passedData.slotID          = passedData.slotID;

            try
            {
                openConnection();
                sql = @"UPDATE tblparkingslot SET slotIsAvailable='" + passedData.slotIsAvailable +
                      "' WHERE slotID='" + passedData.slotID + "'";

                cmd = new MySqlCommand(sql, con);
                cmd.ExecuteNonQuery();

                reqStatus = true;
            }
            catch
            {
                reqStatus = false;
            }
            finally
            {
                con.Close();
            }

            return(reqStatus);
        }//END OF UPDATE PARKING SLOT
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtAmountPaid.Text.All(char.IsDigit) && txtChange.Text != "" && Double.Parse(txtChange.Text) >= 0)
            {
                //Save
                ReceiptReference receipt = new ReceiptReference();
                receipt.refID           = selectedID;
                receipt.refStatus       = "PAID";
                receipt.refPersonnelOut = currentUserID;
                receipt.refTimeCount    = lblTimeCount.Text;
                receipt.refPrice        = lblAmount.Text;
                receipt.refAmountPaid   = txtAmountPaid.Text;
                receipt.refAmountChange = txtChange.Text;
                receipt.refTimeOut      = txtTimeOut.Text;

                if (connect.updateReceiptReference(receipt))
                {
                    ParkingSlot dataToPass = new ParkingSlot();
                    dataToPass.slotIsAvailable = "1";
                    dataToPass.slotID          = (Convert.ToInt32(txtParkingNo.Text) - 100).ToString();
                    connect.updateParkingSpace(dataToPass);

                    MessageBox.Show("Saved Successfully!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Ooops Something went wrong!");
                }
            }
            else
            {
                MessageBox.Show("Invalid Amount! Please check your inputs.");
            }
        }
Exemplo n.º 3
0
        public void receiptRefCreate()
        {
            VehicleInfo info = new VehicleInfo();

            info.vehicleOwner   = txtCustomer.Text;
            info.vehiclePlateNo = txtVehiclePlateNo.Text;

            foreach (var brandRef in currentDataBrand)
            {
                if (brandRef.brandName == cboVehicleBrand.Text)
                {
                    info.vehicleBrand = brandRef.brandID;
                    break;
                }
            }

            info.vehicleColor = txtVehicleColor.Text;

            if (connect.createVehicleInfo(info))
            {
                string lastInsertedID = connect.lastInsertedVehicleInfo();

                GenerateCode();

                ReceiptReference receiptRef = new ReceiptReference();
                receiptRef.refBarcode     = generatedCode;
                receiptRef.refPersonnelIn = this.currentUserID;
                receiptRef.refVehicleID   = lastInsertedID;
                receiptRef.refParkingID   = (Convert.ToInt32(selectedParkingID) - 100).ToString();

                ParkingSlot dataToPass = new ParkingSlot();
                dataToPass.slotIsAvailable = "0";
                dataToPass.slotID          = (Convert.ToInt32(selectedParkingID) - 100).ToString();
                connect.updateParkingSpace(dataToPass);

                if (connect.createReceiptReference(receiptRef))
                {
                    clearTransactionData();
                    //MessageBox.Show("Successfully Generated!");
                }
            }
        }
Exemplo n.º 4
0
        private void btnViewParkingSpace_Click(object sender, EventArgs e)
        {
            frmParkingSpace parking    = new frmParkingSpace();
            ParkingSlot     dataToPass = new ParkingSlot();

            parking.ShowDialog();
            var id = parking.parkingID;

            if (id != "")
            {
                selectedParkingID    = id;
                txtParkingNo.Text    = id;
                txtParkingBlock.Text = (Convert.ToInt32(id) <= 120 ? "SECTION A" : "SECTION B");
            }
            else
            {
                txtParkingNo.Clear();
                txtParkingBlock.Clear();
            }
        }
Exemplo n.º 5
0
        }//END OF UPDATE PARKING SLOT

        public List <ParkingSlot> readParkingSlot_all()
        {
            try
            {
                openConnection();
                sql = "SELECT * FROM tblparkingslot";
                cmd = new MySqlCommand(sql, con);
                rd  = cmd.ExecuteReader();

                if (rd.HasRows)
                {
                    var listOfParkingSlots = new List <ParkingSlot>();

                    while (rd.Read())
                    {
                        var slot = new ParkingSlot();
                        slot.slotID          = rd["slotID"].ToString();
                        slot.slotNumber      = rd["slotNumber"].ToString();
                        slot.slotIsAvailable = rd["slotIsAvailable"].ToString();
                        listOfParkingSlots.Add(slot);
                    }

                    return(listOfParkingSlots);
                }
                else
                {
                    Console.WriteLine("No data");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                con.Close();
            }

            return(null);
        }//END OF READ ALL PARKING SLOT