private void OnSave()
        {
            int SubCompanyId = ddlSubCompany.SelectedValue.ToInt();

            try
            {
                if (objMaster.PrimaryKeyValue == null)
                {
                    objMaster.New();
                }
                else
                {
                    objMaster.Edit();
                }


                //if (objTyreTransaction.PrimaryKeyValue == null)
                //{
                //    objTyreTransaction.New();
                //}
                //else
                //{
                //    objTyreTransaction.Edit();
                //}

                objMaster.Current.VehicleNo     = txtVehNo.Text.Trim();
                objMaster.Current.VehicleTypeId = ddlVehicleType.SelectedValue.ToIntorNull();
                objMaster.Current.VehicleColor  = ddlVehicleColor.Text.ToStr().Trim();
                objMaster.Current.FuelTypeId    = ddlFuelType.SelectedValue.ToIntorNull();
                objMaster.Current.VehicleMake   = txtVehMake.Text.Trim();
                objMaster.Current.VehicleModel  = txtVehModel.Text.Trim();
                objMaster.Current.VehicleOwner  = txtVehOwner.Text.Trim();

                objMaster.Current.ManufactureDate = dtpManfDate.Value.ToDateTime();
                objMaster.Current.ServicesDate    = dtpServicesDate.Value.ToDateTime();

                objMaster.Current.RoadTaxExpDate   = dtpRoadTaxExp.Value.ToDateTimeorNull();
                objMaster.Current.MOTExpiryDate    = dtpMOTExp.Value.ToDateTimeorNull();
                objMaster.Current.PLateExpiryDate  = dtpPlateExp.Value.ToDateTimeorNull();
                objMaster.Current.PLateExpiryDate2 = dtpPlateEx2.Value.ToDateTimeorNull();
                objMaster.Current.PLateExpiryDate3 = dtpPlateEx3.Value.ToDateTimeorNull();
                objMaster.Current.InsuranceExpiry  = dtpInsuranceExpiry.Value.ToDateTimeorNull();
                objMaster.Current.Plateno          = txtPlateNo.Text.Trim();
                objMaster.Current.plateno2         = txtPlateNo2.Text.Trim();
                objMaster.Current.plateno3         = txtPlateNo3.Text.Trim();
                //
                objMaster.Current.PartDetails         = txtPartDetails.Text.Trim();
                objMaster.Current.Parts               = numParts.Value.ToDecimal();
                objMaster.Current.Labour              = numLabour.Value.ToDecimal();
                objMaster.Current.TyreChangeMileage   = numTyreChangeMileage.Value.ToDecimal();
                objMaster.Current.TyresChanged        = txtTyresChanged.Text.Trim();
                objMaster.Current.CostofTyres         = numCostofTyres.Value.ToDecimal();
                objMaster.Current.SubCompanyId        = ddlSubCompany.SelectedValue.ToInt();
                objMaster.Current.PLateExpiryPath     = txtPlatePath.Text;
                objMaster.Current.PLateExpiryPath2    = txtPlatePath2.Text;
                objMaster.Current.PLateExpiryPath3    = txtPlatePath3.Text;
                objMaster.Current.InsuranceExpiryPath = txtInsurancePath.Text;
                objMaster.Current.MOTExpiryPath       = txtMOTPath.Text;
                objMaster.Current.RoadTaxExpPath      = txtRoadPath.Text;
                objMaster.Current.VehicleID           = txtVehicleId.Text;
                objMaster.Current.LogBookNo           = txtVehicleLogBookNo.Text;
                objMaster.Current.LogBookPath         = txtLogBookDocPath.Text;
                objMaster.Current.Notes               = txtNotes.Text;
                objMaster.Current.Notes2              = txtNotes2.Text;
                objMaster.Current.Notes3              = txtNotes3.Text;

                if (objMaster.Current.Fleet_Master_TyreTransactions.Count() == 0)
                {
                    objMaster.Current.Fleet_Master_TyreTransactions.Add(new Fleet_Master_TyreTransaction
                    {
                        FleetMasterId = objMaster.Current.Id,

                        FrontRightDate    = dtpFrontRight.Value.ToDateTimeorNull(),
                        FrontLeftDate     = dtpFrontLeft.Value.ToDateTimeorNull(),
                        RearRightDate     = dtpRearRight.Value.ToDateTimeorNull(),
                        RearLeftDate      = dtpRearLeft.Value.ToDateTimeorNull(),
                        FrontRightMileage = txtFrontRightMileage.Value,
                        FrontLeftMileage  = txtFrontLeftMileage.Value,
                        RearRightMileage  = txtRearRightMileage.Value,
                        RearLeftMileage   = txtRearLeftMileage.Value,

                        //ClientId = objClient.PrimaryKeyValue.ToInt(),
                        //EmailId = txtEmailId.Text.Trim(),
                        //Password = txtLogMeInPassword.Text.Trim()
                    });
                }
                else
                {
                    objMaster.Current.Fleet_Master_TyreTransactions[0].FrontRightDate = dtpFrontRight.Value.ToDateTimeorNull();
                    objMaster.Current.Fleet_Master_TyreTransactions[0].FrontLeftDate  = dtpFrontLeft.Value.ToDateTimeorNull();
                    objMaster.Current.Fleet_Master_TyreTransactions[0].RearRightDate  = dtpRearRight.Value.ToDateTimeorNull();
                    objMaster.Current.Fleet_Master_TyreTransactions[0].RearLeftDate   = dtpRearLeft.Value.ToDateTimeorNull();

                    objMaster.Current.Fleet_Master_TyreTransactions[0].FrontRightMileage = txtFrontRightMileage.Value;
                    objMaster.Current.Fleet_Master_TyreTransactions[0].FrontLeftMileage  = txtFrontLeftMileage.Value;
                    objMaster.Current.Fleet_Master_TyreTransactions[0].RearRightMileage  = txtRearRightMileage.Value;

                    objMaster.Current.Fleet_Master_TyreTransactions[0].RearLeftMileage = txtRearLeftMileage.Value;
                }


                objMaster.Save();

                objMaster.GetByPrimaryKey(objMaster.PrimaryKeyValue);

                DisplayRecord();
                General.RefreshListWithoutSelected <frmCompanyVehcileList>("frmCompanyVehcileList1");
            }
            catch (Exception ex)
            {
                if (objMaster.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(objMaster.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }