private void dataUpdate()
        {
            SqlCommand cmd = new SqlCommand("UPDATE PARCELS SET Status_ID = " + cbDeliveryStatus.SelectedValue.ToString() + ", " +
                                            "Parcel_Weight = " + (nudWeight.Value).ToString() + ", " +
                                            "Parcel_Length = " + (nudLenght.Value).ToString() + ", " +
                                            "Parcel_Width = " + (nudWidth.Value).ToString() + ", " +
                                            "Parcel_Height = " + (nudHeight.Value).ToString() + ", " +
                                            "Delivery_Street_Number = '" + tbxStreetNumber.Text + "', " +
                                            "Delivery_Street_Name = '" + tbxStreetName.Text + "', " +
                                            "Delivery_Complex_Building = '" + tbxBuildingName.Text + "', " +
                                            "Postal_Code_ID = " + cbPostalCode.SelectedValue.ToString() + ", " +
                                            "Contact_No = '" + tbxRecipientContactNr.Text + "', " +
                                            "Alt_Contact_No = '" + tbxRecipientAltContactNr.Text + "', " +
                                            "Delivery_Due_Date = '" + dateDueDelivery.Value.ToShortDateString().ToString() + "', " +
                                            "Delivered = '" + delivered.ToString() + "', " +
                                            "Recipient_Name = '" + tbxRecepientName.Text + "', " +
                                            "Client_ID = " + cbCompanyName.SelectedValue.ToString() +
                                            "WHERE Parcel_ID = " + parcelID, con);

            con.Open();

            try { cmd.ExecuteNonQuery(); } catch (SqlException m) {
                Console.WriteLine(m.Message);
            }

            con.Close();

            maintain.dateCheck();

            btnApply.Enabled = true;
            this.Close();

            //ClearForm();
        }
Example #2
0
        private void btnAddRecord_Click(object sender, EventArgs e)
        {
            //to do: load all values to database
            // TO DO: CHECK SQL INJECTION RISK

            MessageBox.Show("INSERT INTO PARCELS(Parcel_Weight, Parcel_Length, Parcel_Width, Parcel_Height, Delivery_Street_Number, Delivery_Street_Name, Delivery_Complex_Building, Contact_No, Alt_Contact_No, Delivery_Due_Date, Recipient_Name) VALUES(" + nudWeight.Value + "," + nudLenght.Value + "," + nudWidth.Value + "," + nudHeight.Value + ",'" + tbxStreetNumber.Text + "','" + tbxStreetName.Text + "','" + tbxBuildingName.Text + "','" + tbxRecipientContactNr.Text + "','" + tbxRecipientAltContactNr.Text + "'," + dateDueDelivery.Value.ToShortDateString() + ",'" + tbxRecepientName.Text + "')");

            SqlCommand cmd = new SqlCommand("INSERT INTO PARCELS(Status_ID, Postal_Code_ID, Client_ID, Parcel_Weight, Parcel_Length, Parcel_Width, Parcel_Height, Delivery_Street_Number, Delivery_Street_Name, Delivery_Complex_Building, Contact_No, Alt_Contact_No, Delivery_Due_Date, Recipient_Name) VALUES(" + cbDeliveryStatus.SelectedValue + "," + cbPostalCode.SelectedValue + "," + cbCompanyName.SelectedValue + "," + nudWeight.Value + "," + nudLenght.Value + "," + nudWidth.Value + "," + nudHeight.Value + ",'" + tbxStreetNumber.Text + "','" + tbxStreetName.Text + "','" + tbxBuildingName.Text + "','" + tbxRecipientContactNr.Text + "','" + tbxRecipientAltContactNr.Text + "','" + dateDueDelivery.Value.ToShortDateString() + "','" + tbxRecepientName.Text + "')", con);

            con.Open();
            cmd.ExecuteNonQuery();

            maintain.dateCheck();

            con.Close();
        }
Example #3
0
        private void btnMoreDetailsParcel_Click(object sender, EventArgs e)
        {
            //to do: show more complete view of data in parcel db
            frmMaintainParcels maintain = new frmMaintainParcels();

            maintain.dateCheck();
        }