internal void ShowDialog(clsVehicle pVehicle)
 {
     _Vehicle = pVehicle;
     showComboBoxForActvityType();
     viewActivityList(comboBoxResortLog.Text);
     loadDefaultActivitySettings();
     base.ShowDialog();
 }
        private void btnEditVehicle_Click(object sender, EventArgs e)
        {
            string     VehicleRegistrationNumber = listBoxRegistrationList.SelectedItem.ToString();
            clsVehicle pVehicle = clsVehicleRentalBusiness.Fleet[VehicleRegistrationNumber];

            pVehicle.ViewEditedVehicle();
            UpdateVehicleList();
        }
        private void btnAddVehicle_Click_1(object sender, EventArgs e)
        {
            clsVehicle pVehicle = new clsVehicle();

            if (pVehicle != null && pVehicle.ViewEditedVehicle())
            {
                clsVehicleRentalBusiness.Fleet.Add(pVehicle.VehicleRegistrationNumber, pVehicle);
                UpdateVehicleList();
            }
        }
        private void listBoxRegistrationList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string VehicleRegistrationNumber;


            VehicleRegistrationNumber = listBoxRegistrationList.SelectedItem.ToString();

            clsVehicle pVehicle = clsVehicleRentalBusiness.Fleet[VehicleRegistrationNumber];

            richTextBoxQuickView.Text = pVehicle.ViewVehicleDetails();
        }
 internal bool ShowDialog(clsVehicle pVehicle)
 {
     _Vehicle = pVehicle;
     updateDisplay();
     return(ShowDialog() == DialogResult.OK);
 }
示例#6
0
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            clsVehicle DB = new clsVehicle();

            try
            {
                if (txtmake.Text == null)
                {
                    lblResults.Text = "Please enter the make of the vehicle (eg. Toyota,Nissan)";
                    return;
                }
                if (txttype.Text == null)
                {
                    lblResults.Text = "Please select the type of vehicle";
                    return;
                }
                if (txtchassesno.Text == null)
                {
                    lblResults.Text = "Please enter the chassis number of the vehicle";
                    return;
                }
                if (txtregno.Text == null)
                {
                    lblResults.Text = "Please enter the registration number of the vehicle";
                    return;
                }
                if (txtWheelSize.Text == null)
                {
                    lblResults.Text = "Please enter the wheel size of the vehicle";
                    return;
                }
                if (txtRimSize.Text == null)
                {
                    lblResults.Text = "Please enter the rim size of the vehicle";
                    return;
                }
                if (txtweightofvehicle.Text == null)
                {
                    lblResults.Text = "Please enter the weight of the vehicle";
                    return;
                }
                if (dtRWdateofIssue.GetType() != typeof(DateTime))
                {
                    lblResults.Text = "Please enter a valid issue date of the road worthy cetificate";
                    return;
                }
                if (txtRWplaceofissue.Text == null)
                {
                    lblResults.Text = "Please enter a valid issue place of the road worthy cetificate";
                    return;
                }
                if (cboRWvalidity.Text == null)
                {
                    lblResults.Text = "Please enter a valid validity of the road worthy cetificate(eg.YES,NO)";
                    return;
                }
                if (dtINdateofissue.GetType() != typeof(DateTime))
                {
                    lblResults.Text = "Please enter a valid issue date of the insurance cetificate";
                    return;
                }
                if (txtINplaceofissue.Text == null)
                {
                    lblResults.Text = "Please enter a valid issue place of the insurance cetificate";
                    return;
                }
                if (cboINvalidity.Text == null)
                {
                    lblResults.Text = "Please enter a valid validity of the insurance cetificate(eg.YES,NO)";
                    return;
                }
                if (DTRegDate.GetType() != typeof(DateTime))
                {
                    lblResults.Text = "Please enter a valid registration date of the vehicle";
                    return;
                }
                if (DTpurchDate.GetType() != typeof(DateTime))
                {
                    lblResults.Text = "Please enter a valid purchase date of the vehicle";
                    return;
                }
                if (txtDepartment.Text == null)
                {
                    lblResults.Text = "Please select a valid department";
                    return;
                }
                if (txtEngineCapacity.Text == null)
                {
                    lblResults.Text = "Please select a valid  Engine Capacity";
                    return;
                }
                if (dtfirstservicedate.GetType() != typeof(DateTime))
                {
                    lblResults.Text = "Please enter the first service date of the vehicle";
                    return;
                }
                dtnextservicedate.Text = DateTime.Now.AddYears(1).ToString();
                if (cbolocation.Text == null)
                {
                    lblResults.Text = "Please select a valid  Engine Capacity";
                    return;
                }



                int reccount = 0;
                reccount = DB.FindRecKount(txtchassesno.Text);

                if (reccount > 0)
                {
                    lblResults.Text = "Record already exists!!!";
                    return;
                }

                DB.Delete_rec(txtregno.Text);

                //string selectSQL = "SELECT * FROM tb_Customer ORDER BY convert(int,customerno)";
                //SqlConnection con = new SqlConnection(connectionString);
                //SqlCommand cmd = new SqlCommand(selectSQL, con);
                //SqlDataAdapter adapter = new SqlDataAdapter(cmd);

                // Fill the DataSet.
                DataSet ds = new DataSet();
                ds = DB.FindTable();
                //adapter.Fill(ds, "tb_Customer");
                // Perform the binding.
                GridView1.DataSource = ds;
                GridView1.DataBind();

                lblResults.Text = "Operation successful";

                txtmake.Text           = ""; txttype.Text = ""; txtchassesno.Text = ""; txtregno.Text = ""; txtWheelSize.Text = ""; txtRimSize.Text = ""; txtweightofvehicle.Text = "";
                txtRWplaceofissue.Text = ""; cboRWvalidity.Text = ""; txtINplaceofissue.Text = ""; cboINvalidity.Text = "";
                txtDepartment.Text     = ""; txtEngineCapacity.Text = "";
                cbolocation.Text       = ""; txtPicturePath = null;

                return;
            }
            catch (Exception err)
            {
                EventLog log = new EventLog();
                log.Source = "Milorry Frontend";
                log.WriteEntry(err.Message, EventLogEntryType.Error);
                return;
            }
            finally
            {
                //con.Close();
            }
        }