├── cars.zip ├── Leaflet.zip ├── DeleteDataTest.apxc ├── CreateDataTest.apxc ├── DeleteData.apxc ├── README.md ├── CarExperiences.cmp └── CreateData.apxc /cars.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/choudharymanish8585/RentACar/HEAD/cars.zip -------------------------------------------------------------------------------- /Leaflet.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/choudharymanish8585/RentACar/HEAD/Leaflet.zip -------------------------------------------------------------------------------- /DeleteDataTest.apxc: -------------------------------------------------------------------------------- 1 | @isTest(seeAllData=true) 2 | public class DeleteDataTest { 3 | 4 | @isTest 5 | public static void deleteData(){ 6 | DeleteData.deleteData(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /CreateDataTest.apxc: -------------------------------------------------------------------------------- 1 | @isTest(seeAllData=false) 2 | public class CreateDataTest { 3 | 4 | @isTest 5 | public static void testData(){ 6 | Test.startTest(); 7 | CreateData.createPackageData(); 8 | Test.stopTest(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /DeleteData.apxc: -------------------------------------------------------------------------------- 1 | public class DeleteData { 2 | 3 | public static void deleteData(){ 4 | List cars = [SELECT Id FROM Car__c]; 5 | delete cars; 6 | 7 | List carTypes = [SELECT Id FROM Car_Type__c]; 8 | delete carTypes; 9 | 10 | List emails = new List(); 11 | emails.add('testcontact1@lightning.com'); 12 | emails.add('testcontact2@lightning.com'); 13 | emails.add('testcontact3@lightning.com'); 14 | emails.add('testcontact4@lightning.com'); 15 | emails.add('testcontact5@lightning.com'); 16 | emails.add('testcontact6@lightning.com'); 17 | emails.add('testcontact7@lightning.com'); 18 | emails.add('testcontact8@lightning.com'); 19 | emails.add('testcontact9@lightning.com'); 20 | emails.add('testcontact10@lightning.com'); 21 | emails.add('testcontact11@lightning.com'); 22 | emails.add('testcontact12@lightning.com'); 23 | emails.add('testcontact13@lightning.com'); 24 | emails.add('testcontact14@lightning.com'); 25 | List contacts = [SELECT Id FROM Contact WHERE Email IN:emails]; 26 | delete contacts; 27 | 28 | List acc = [SELECT Id FROM Account WHERE Name='Lightning Training']; 29 | delete acc; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RentACar 2 |

RentACar data scripts

3 | 4 |

Classes you can use to create the data

5 |

CreateData.apxc: This file has the code to create the data to be used in your RentACar Application

6 |

DeleteData.apxc: This file has the code to delete the data created by CreatedData.apxc file

7 |

CreateDataTest.apxc: TestClass for CreateData class

8 |

DeleteDataTest.apxc: TestClass for DeleteData class

9 | 10 |

How to Call CreateData class

11 | Once you have created your "CreateData" class, follow below steps to call the class method to generate data 12 |
    13 |
  • Open your developer console 14 |
  • Click on 'Debug' menu item 15 |
  • Select 'Open Execute Anonymous Window' 16 |
  • Type CreateData.createPackageData(); 17 |
18 | 19 |

How to Call DeleteData class

20 | Once you have created your "DeleteData" class, follow below steps to call the class method to delete data 21 |
  • Open your developer console
  • 22 |
  • Click on 'Debug' menu item
  • 23 |
  • Select 'Open Execute Anonymous Window'
  • 24 |
  • Type DeleteData.deleteData();
  • 25 | 26 | 27 |
    28 |

    Also download this static resource file and upload in your org. This static resource contains images of the cars.

    29 | -------------------------------------------------------------------------------- /CarExperiences.cmp: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 |
    9 |
      10 |
    • 11 |
      12 |
      13 | 21 |
      22 |
      23 |

      24 | 25 | {!carExp.CreatedBy.Name} — {!carExp.CreatedBy.CompanyName}

      27 |
      28 |

      29 |

      30 |
      31 |
      32 |
      33 | 34 |

      #######DISPLAY CAR EXPERIENCE RECORD NAME HERE USING ATTRIBUTES#######

      35 |

      36 | 37 | 38 |

      39 |
      40 |
      41 |
    • 42 |
    43 |
    44 | -------------------------------------------------------------------------------- /CreateData.apxc: -------------------------------------------------------------------------------- 1 | public class CreateData { 2 | 3 | public static void createPackageData(){ 4 | 5 | Account acc = new Account(Name='Lightning Training'); 6 | insert acc; 7 | 8 | List carTypes = new List(); 9 | Car_Type__c carType1 = new Car_Type__c(Name='Van'); 10 | Car_Type__c carType2 = new Car_Type__c(Name='Sports'); 11 | Car_Type__c carType3 = new Car_Type__c(Name='Luxury'); 12 | Car_Type__c carType4 = new Car_Type__c(Name='Compact'); 13 | carTypes.add(carType1); 14 | carTypes.add(carType2); 15 | carTypes.add(carType3); 16 | carTypes.add(carType4); 17 | insert carTypes; 18 | 19 | List contacts = new List(); 20 | Contact con1 = new Contact(Salutation='Mr.', FirstName='Devi Pradeep', 21 | LastName='Naredla', AccountId=acc.id, Email='testcontact1@lightning.com'); 22 | Contact con2 = new Contact(Salutation='Mr.', FirstName='Manish', 23 | LastName='Choudhari', AccountId=acc.id, Email='testcontact2@lightning.com'); 24 | Contact con3 = new Contact(Salutation='Mr.', FirstName='Karthik', 25 | LastName='Murari', AccountId=acc.id, Email='testcontact3@lightning.com'); 26 | Contact con4 = new Contact(Salutation='Mr.', FirstName='Sunil', 27 | LastName='Choudhary', AccountId=acc.id, Email='testcontact4@lightning.com'); 28 | Contact con5 = new Contact(Salutation='Mr.', FirstName='Velavan', 29 | LastName='Sivaswamy', AccountId=acc.id, Email='testcontact5@lightning.com'); 30 | Contact con6 = new Contact(Salutation='Mr.', FirstName='Anand', 31 | LastName='Vardhan', AccountId=acc.id, Email='testcontact6@lightning.com'); 32 | Contact con7 = new Contact(Salutation='Mr.', FirstName='Ankit', 33 | LastName='Badhani', AccountId=acc.id, Email='testcontact7@lightning.com'); 34 | Contact con8 = new Contact(Salutation='Mr.', FirstName='Dhruv', 35 | LastName='Bhatia', AccountId=acc.id, Email='testcontact8@lightning.com'); 36 | Contact con9 = new Contact(Salutation='Mr.', FirstName='Sudhakar', 37 | LastName='Nuvuluri', AccountId=acc.id, Email='testcontact9@lightning.com'); 38 | Contact con10 = new Contact(Salutation='Mr.', FirstName='Ashish', 39 | LastName='Sharma', AccountId=acc.id, Email='testcontact10@lightning.com'); 40 | Contact con11 = new Contact(Salutation='Mr.', FirstName='Sharath', 41 | LastName='Kumar', AccountId=acc.id, Email='testcontact11@lightning.com'); 42 | Contact con12 = new Contact(Salutation='Ms.', FirstName='Shonu', 43 | LastName='Choudhary', AccountId=acc.id, Email='testcontact12@lightning.com'); 44 | Contact con13 = new Contact(Salutation='Ms.', FirstName='Prabhdeep', 45 | LastName='Kaur', AccountId=acc.id, Email='testcontact13@lightning.com'); 46 | Contact con14 = new Contact(Salutation='Ms.', FirstName='Priyanka', 47 | LastName='Monga', AccountId=acc.id, Email='testcontact14@lightning.com'); 48 | 49 | contacts.add(con1); 50 | contacts.add(con2); 51 | contacts.add(con3); 52 | contacts.add(con4); 53 | contacts.add(con5); 54 | contacts.add(con6); 55 | contacts.add(con7); 56 | contacts.add(con8); 57 | contacts.add(con9); 58 | contacts.add(con10); 59 | contacts.add(con11); 60 | contacts.add(con12); 61 | contacts.add(con13); 62 | contacts.add(con14); 63 | insert contacts; 64 | 65 | 66 | List cars = new List(); 67 | Car__c car1 = new Car__c(Name='Maruti Eeco', Contact__c=con1.id, Car_Type__c=carType1.id, 68 | Build_Year__c=2018, Description__c='', Available_For_Rent__c=true, 69 | Geolocation__latitude__s=14.547859, Geolocation__longitude__s=74.318841, 70 | Mileage__c=20, Per_Day_Rent__c=60, 71 | Picture__c='/resource/cars/van/maruti_suzuki_eeco.jpg' ); 72 | Car__c car2 = new Car__c(Name='Ford Mustang', Contact__c=con2.id, Car_Type__c=carType3.id, 73 | Build_Year__c=2017, Description__c='', Available_For_Rent__c=true, 74 | Geolocation__latitude__s=-33.8688200, Geolocation__longitude__s=151.2092960, 75 | Mileage__c=8, Per_Day_Rent__c=260, 76 | Picture__c='/resource/cars/luxury/ford_mustang.jpeg' ); 77 | Car__c car3 = new Car__c(Name='Mercedes Benz', Contact__c=con3.id, Car_Type__c=carType3.id, 78 | Build_Year__c=2006, Description__c='', Available_For_Rent__c=true, 79 | Geolocation__latitude__s=30.7333150, Geolocation__longitude__s=76.7794180, 80 | Mileage__c=8, Per_Day_Rent__c=170, 81 | Picture__c='/resource/cars/luxury/mercedes_benz_gls.jpg' ); 82 | Car__c car4 = new Car__c(Name='Hyundai Xcent', Contact__c=con4.id, Car_Type__c=carType4.id, 83 | Build_Year__c=2016, Description__c='', Available_For_Rent__c=true, 84 | Geolocation__latitude__s=26.9124340, Geolocation__longitude__s=75.7872710, 85 | Mileage__c=18, Per_Day_Rent__c=100, 86 | Picture__c='/resource/cars/compact/hyundai_xcent_car.png' ); 87 | Car__c car5 = new Car__c(Name='BMW i8', Contact__c=con5.id, Car_Type__c=carType2.id, 88 | Build_Year__c=2013, Description__c='', Available_For_Rent__c=true, 89 | Geolocation__latitude__s=15.6846890, Geolocation__longitude__s=73.7032840, 90 | Mileage__c=13, Per_Day_Rent__c=200, 91 | Picture__c='/resource/cars/sports/BMW_i8.jpg' ); 92 | Car__c car6 = new Car__c(Name='Jaguar F', Contact__c=con6.id, Car_Type__c=carType2.id, 93 | Build_Year__c=2008, Description__c='', Available_For_Rent__c=true, 94 | Geolocation__latitude__s=26.4499230, Geolocation__longitude__s=80.3318740, 95 | Mileage__c=8, Per_Day_Rent__c=180, 96 | Picture__c='/resource/cars/sports/Jaguar_F_type_Coupe.jpg' ); 97 | Car__c car7 = new Car__c(Name='Hyundai Verna', Contact__c=con7.id, Car_Type__c=carType4.id, 98 | Build_Year__c=2016, Description__c='', Available_For_Rent__c=true, 99 | Geolocation__latitude__s=32.2396320, Geolocation__longitude__s=77.1887150, 100 | Mileage__c=14, Per_Day_Rent__c=130, 101 | Picture__c='/resource/cars/compact/hyundai_verna.jpg' ); 102 | Car__c car8 = new Car__c(Name='Tata Venture', Contact__c=con8.id, Car_Type__c=carType1.id, 103 | Build_Year__c=2009, Description__c='', Available_For_Rent__c=true, 104 | Geolocation__latitude__s=13.0826800, Geolocation__longitude__s=80.2707180, 105 | Mileage__c=19, Per_Day_Rent__c=50, 106 | Picture__c='/resource/cars/van/tata_venture.jpg' ); 107 | Car__c car9 = new Car__c(Name='Toyota Land Cruiser', Contact__c=con9.id, Car_Type__c=carType3.id, 108 | Build_Year__c=2012, Description__c='', Available_For_Rent__c=true, 109 | Geolocation__latitude__s=12.9715990, Geolocation__longitude__s=77.5945630, 110 | Mileage__c=9, Per_Day_Rent__c=230, 111 | Picture__c='/resource/cars/luxury/toyota_land_cruiser_prado.jpg' ); 112 | Car__c car10 = new Car__c(Name='Range Rover', Contact__c=con10.id, Car_Type__c=carType3.id, 113 | Build_Year__c=2011, Description__c='', Available_For_Rent__c=true, 114 | Geolocation__latitude__s=28.7040590, Geolocation__longitude__s=77.1024900, 115 | Mileage__c=10, Per_Day_Rent__c=250, 116 | Picture__c='/resource/cars/luxury/range_rover_svautography.jpg' ); 117 | Car__c car11 = new Car__c(Name='Suzuki Dzire', Contact__c=con11.id, Car_Type__c=carType4.id, 118 | Build_Year__c=2014, Description__c='', Available_For_Rent__c=true, 119 | Geolocation__latitude__s=17.3850440, Geolocation__longitude__s=78.4866710, 120 | Mileage__c=20, Per_Day_Rent__c=90, 121 | Picture__c='/resource/cars/compact/suzuki_dzire.jpg' ); 122 | Car__c car12 = new Car__c(Name='Audi A8', Contact__c=con12.id, Car_Type__c=carType2.id, 123 | Build_Year__c=2015, Description__c='', Available_For_Rent__c=true, 124 | Geolocation__latitude__s=18.5204300, Geolocation__longitude__s=73.8567440, 125 | Mileage__c=10, Per_Day_Rent__c=210, 126 | Picture__c='/resource/cars/sports/Audi_R8_V10_Plus.jpg' ); 127 | Car__c car13 = new Car__c(Name='Maruti Omni', Contact__c=con13.id, Car_Type__c=carType1.id, 128 | Build_Year__c=2008, Description__c='', Available_For_Rent__c=true, 129 | Geolocation__latitude__s=25.5940950, Geolocation__longitude__s=85.1375650, 130 | Mileage__c=22, Per_Day_Rent__c=50, 131 | Picture__c='/resource/cars/van/maruti_omni_mileage.jpg' ); 132 | Car__c car14 = new Car__c(Name='Toyota Etios', Contact__c=con14.id, Car_Type__c=carType4.id, 133 | Build_Year__c=2013, Description__c='', Available_For_Rent__c=true, 134 | Geolocation__latitude__s=29.3803040, Geolocation__longitude__s=79.4635660, 135 | Mileage__c=19, Per_Day_Rent__c=90, 136 | Picture__c='/resource/cars/compact/toyota_etios.jpg' ); 137 | cars.add(car1); 138 | cars.add(car2); 139 | cars.add(car3); 140 | cars.add(car4); 141 | cars.add(car5); 142 | cars.add(car6); 143 | cars.add(car7); 144 | cars.add(car8); 145 | cars.add(car9); 146 | cars.add(car10); 147 | cars.add(car11); 148 | cars.add(car12); 149 | cars.add(car13); 150 | cars.add(car14); 151 | insert cars; 152 | 153 | } 154 | 155 | } 156 | --------------------------------------------------------------------------------