Пример #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         Vehicles vehicle = new Vehicles {
             Vehicle_ID = Id
         };
         var confirm = RadMessageBox.Show("Are You Sure You want to Delete?", "Confirmation", MessageBoxButtons.YesNo);
         if (confirm == DialogResult.Yes)
         {
             if (vehicleBusiness.deleteVehicle(vehicle))
             {
                 RadMessageBox.Show("Deleted");
                 btnUpdate.Enabled        = false;
                 btnDelete.Enabled        = false;
                 dgvmanagepage.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("allVehicles");
             }
             else
             {
                 RadMessageBox.Show("Failed");
                 //}
             }
         }
         else
         {
         }
     }
     catch (Exception exception)
     {
     }
 }
Пример #2
0
        public void comboboxdataInitialize()
        {
            //combobox vehicle category data initialization start

            //comboboxvehiclecategory.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleCategory");
            //comboboxvehiclecategory.DisplayMember = "Name";
            //comboboxvehiclecategory.ValueMember = "VehicleCategoryId";

            //// combobox vehicle category data initialization end

            //comboboxvehicleModel.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleModel");
            //comboboxvehicleModel.DisplayMember = "Name";
            //comboboxvehicleModel.ValueMember = "VehicleModelID";


            //comboboxvehiclecMaker.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleMaker");
            //comboboxvehiclecMaker.DisplayMember = "Name";
            //comboboxvehiclecMaker.ValueMember = "VehicleMakerID";


            dgvvhclereports.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("allVehicles");



            ////manage page initializzation
            //cmboboxupdateCategory.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleCategory");
            //cmboboxupdateCategory.DisplayMember = "Name";
            //cmboboxupdateCategory.ValueMember = "VehicleCategoryId";


            //comboboxupdatemodel.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleModel");
            //comboboxupdatemodel.DisplayMember = "Name";
            //comboboxupdatemodel.ValueMember = "VehicleModelID";


            //cmboboxupdatemaker.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleMaker");
            //cmboboxupdatemaker.DisplayMember = "Name";
            //cmboboxupdatemaker.ValueMember = "VehicleMakerID";

            //// updatedltgridviewvehicles.DataSource = vehicle.getVehicleCatmakmodel("allVehicles");
            //dgvmanagepage.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("allVehicles");


            ////add details page initialization
            //dgvvehiclecategory.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleCategory");
            //dgvvehiclemaker.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleMaker");
            //dgvvehiclemodel.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleModel");
        }
Пример #3
0
        public void ComboboxInitialize()
        {
            comboBoxCategory.DataSource    = VehicelCategoryBusiness.getVehicleCatmakmodel("VehicleCategory");
            comboBoxCategory.DisplayMember = "Name";
            comboBoxCategory.ValueMember   = "VehicleCategoryId";



            try
            {
                VehicleMaker maker = new VehicleMaker()
                {
                    VehicleCategoryId = Convert.ToInt32(comboBoxCategory.SelectedValue.ToString())
                };
                comboBoxMaker.DataSource    = new RateCardBusiness().getMakerFromCategory(maker);
                comboBoxMaker.DisplayMember = "Maker";
                comboBoxMaker.ValueMember   = "VehicleMakerID";
            }
            catch (Exception ex)
            {
            }

            try
            {
                VehicleModel model = new VehicleModel()
                {
                    vehicle_maker_id = Convert.ToInt32(comboBoxMaker.SelectedValue.ToString())
                };
                comboBoxModel.DataSource    = new RateCardBusiness().getModelFromMaker(model);
                comboBoxModel.DisplayMember = "Model";
                comboBoxModel.ValueMember   = "VehicleModelID";
            }
            catch (Exception ex)
            {
            }
        }
Пример #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtboxupdateenginenumber.Text.ToString() == "" ||
                    txtboxmileageupdate.Text.ToString() == "" ||
                    txtboxupdatecc.Text.ToString() == "" ||
                    txtboxupdatechessisnumber.Text.ToString() == "" ||
                    txtboxupdatecolor.Text.ToString() == "" ||
                    txtboxupdatemodelyear.Text.ToString() == "" ||
                    txtboxupdateregistrationyear.Text.ToString() == "" ||
                    txtboxupdatenumberplate.Text.ToString() == "" ||
                    Id == null)
                {
                    RadMessageBox.Show("Please Select a row And Enter ALL Fields");
                    return;
                }
                Vehicles vehicle = new Vehicles
                {
                    Vehicle_ID       = Id,
                    VehiclCategoryId = Convert.ToInt32(cmboboxupdateCategory.SelectedValue.ToString()),
                    MakeID           = Convert.ToInt32(cmboboxupdatemaker.SelectedValue.ToString()),
                    ModelId          = Convert.ToInt32(comboboxupdatemodel.SelectedValue.ToString()),
                    Mileage          = Convert.ToDecimal(txtboxmileageupdate.Text.ToString()),
                    enginenumber     = (txtboxupdateenginenumber.Text.ToString()),
                    chessisnumber    = (txtboxupdatechessisnumber.Text.ToString()),
                    cc               = txtboxupdatecc.Text.ToString(),
                    colour           = txtboxupdatecolor.Text.ToString(),
                    modelyear        = txtboxupdatemodelyear.Text.ToString(),
                    registrationyear = Convert.ToInt32(txtboxupdateregistrationyear.Text.ToString()),
                    numberplate      = txtboxupdatenumberplate.Text.ToString()
                };
                if (vehicleBusiness.updateVehicle(vehicle))
                {
                    RadMessageBox.Show("Updated");
                    btnUpdate.Enabled = false;
                    btnDelete.Enabled = false;


                    txtboxupdateenginenumber.Clear();
                    txtboxmileageupdate.Clear();
                    txtboxupdatecc.Clear();
                    txtboxupdatechessisnumber.Clear();
                    txtboxupdatecolor.Clear();
                    txtboxupdatemodelyear.Clear();
                    txtboxupdateregistrationyear.Clear();
                    txtboxupdatenumberplate.Clear();

                    dgvmanagepage.DataSource = VehicelCategoryBusiness.getVehicleCatmakmodel("allVehicles");
                }
                else
                {
                    RadMessageBox.Show("Failed");
                    //}
                }
            }
            catch (Exception exception) {
                RadMessageBox.Show("Failed Some Error Occured");
                using (EventLog eventLog = new EventLog("VMSUI"))
                {
                    eventLog.Source = "VMSUI";
                    eventLog.WriteEntry(" Message : " + exception.Message, EventLogEntryType.Information);
                }
            }
        }