• Mohit S
  • NEWBIE
  • 0 Points
  • Member since 2016
  • PCS TECHNOLOGY LTD;Medprecinct Solutions

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
My visualforce page code is as follows

<apex:page sidebar="false" controller="hotelbooking">
    <apex:includeScript value="{URLFOR($$Resources.stylesheet,'stylesheet.css')}"/>
        <apex:form >
          <apex:pageBlock title="Hotel Bookings">
              <apex:tabPanel id="Panel1" width="1000">
                  <apex:tab id="Tab1" label="NEW BOOKING" LabelWidth="300">
                      <table>
                                 <tr>
                                     <td>
                                         BookingDate:
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!bookingdate}"/>
                                     </td>
                                     </tr>
                                     <tr>
                                     <td>
                                         Checkin Time
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!checkin}" />
                                     </td>
                                     </tr>
                                    
                                     <tr>
                                     <td>
                                         CHECKout Time
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!CHECKOUT}"/>
                                     </td>
                                 </tr>
                                   <tr>
                                     <td>
                                         CUSTOMER Name
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!CUSTNAME}"/>
                                     </td>
                                 </tr>
                                   <tr>
                                     <td>
                                         Room TYPE
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!ROOMTYPE}"/>
                                     </td>
                                 </tr>
                                 <tr >
                                     <td colspan="2" align="center">
                                         <apex:commandButton value="INSERT" style="color:red;" 
                                         action="{!doInsert}" />
                                     </td>
                                 </tr>
                             </table>
                   
                  </apex:tab>
                  <apex:tab id="Tab2" label="EDIT BOOKING" LabelWidth="350">
                                <!--apex:column  value="{!b.Booking_ID__c}"/>
                                <apex:column value="{!b.CHECK_IN__c}"/>
                                <apex:column value="{!b.CHECK_OUT__c}"/>
                                <apex:column value="{!b.CUSTOMER_Name__c}"/>
                                <apex:column value="{!b.ROOM__c}"/>-->

                      <apex:pageBlockTable value="{!bookings}" var="b">
                      </apex:pageBlockTable>
                  </apex:tab>
                  <apex:tab id="Tab3" label="VIEW BOOKING" LabelWidth="350">
                      <apex:pageBlockTable value="{!bookings}" var="b">
                                <apex:column value="{!b.Booking_ID__c}"/>
                                <apex:column value="{!b.CHECK_IN__c}"/>
                                <apex:column value="{!b.CHECK_OUT__c}"/>
                                <apex:column value="{!b.CUSTOMER_Name__c}"/>
                                <apex:column value="{!b.ROOM__c}"/>
                      </apex:pageBlockTable>
                  </apex:tab>
              </apex:tabPanel>
          
          </apex:pageBlock>
      </apex:form>
</apex:page>

Controller logic 
public class hotelbooking {

     List<HOTEL_BOOKING__c> Bookings=[select Booking_Date__c,Booking_ID__c,CHECK_IN__c,CHECK_OUT__c,CUSTOMER_Name__c,   ROOM__c
                                      from HOTEL_BOOKING__c ];
 public list<HOTEL_BOOKING__c> getbookings(){
   return bookings;
 }  
 
 public pagereference doinsert(){
   HOTEL_BOOKING__c insrt=new HOTEL_BOOKING__c();
   //insrt.Booking_Date__c=bookingdate;
   insrt.CHECK_IN__c=checkin;
   insrt.CHECK_OUT__c=checkout;
   insrt.CUSTOMER_Name__c  =custname;
   insrt.ROOM__c=roomtype;
   
   insert insrt;
   
   return null;
 }   
 
 public datetime bookingdate  {get;set;} 
 public datetime checkin  {get;set;} 
 public datetime checkout  {get;set;} 
 public string custname  {get;set;} 
 public string roomtype {get;set;}                               
}


Pls help i am unable to insert the records in my custom object Hotel_booking__c.
Waiting for ur good sugetions
THANKS
-MOHIT S
Hii..Can anybody help me to understand what standard  study materail should i refer for ADM-201 and DEV 401/501 certifications..
Where i can find dumps or certification oriented questions and answers (if possible free not paid...) 
kindly suggest ...

Thanks 
Mohit S.
  • September 18, 2016
  • Like
  • 0
i have created look up relationship between two objects but i am unable to select desired column i.e. i can see customer id, cust name,city i want to select Cust name it's allowing to select cuse id only..kindly help me to solve this query...
My visualforce page code is as follows

<apex:page sidebar="false" controller="hotelbooking">
    <apex:includeScript value="{URLFOR($$Resources.stylesheet,'stylesheet.css')}"/>
        <apex:form >
          <apex:pageBlock title="Hotel Bookings">
              <apex:tabPanel id="Panel1" width="1000">
                  <apex:tab id="Tab1" label="NEW BOOKING" LabelWidth="300">
                      <table>
                                 <tr>
                                     <td>
                                         BookingDate:
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!bookingdate}"/>
                                     </td>
                                     </tr>
                                     <tr>
                                     <td>
                                         Checkin Time
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!checkin}" />
                                     </td>
                                     </tr>
                                    
                                     <tr>
                                     <td>
                                         CHECKout Time
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!CHECKOUT}"/>
                                     </td>
                                 </tr>
                                   <tr>
                                     <td>
                                         CUSTOMER Name
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!CUSTNAME}"/>
                                     </td>
                                 </tr>
                                   <tr>
                                     <td>
                                         Room TYPE
                                     </td>
                                     <td>
                                         <apex:inputtext value="{!ROOMTYPE}"/>
                                     </td>
                                 </tr>
                                 <tr >
                                     <td colspan="2" align="center">
                                         <apex:commandButton value="INSERT" style="color:red;" 
                                         action="{!doInsert}" />
                                     </td>
                                 </tr>
                             </table>
                   
                  </apex:tab>
                  <apex:tab id="Tab2" label="EDIT BOOKING" LabelWidth="350">
                                <!--apex:column  value="{!b.Booking_ID__c}"/>
                                <apex:column value="{!b.CHECK_IN__c}"/>
                                <apex:column value="{!b.CHECK_OUT__c}"/>
                                <apex:column value="{!b.CUSTOMER_Name__c}"/>
                                <apex:column value="{!b.ROOM__c}"/>-->

                      <apex:pageBlockTable value="{!bookings}" var="b">
                      </apex:pageBlockTable>
                  </apex:tab>
                  <apex:tab id="Tab3" label="VIEW BOOKING" LabelWidth="350">
                      <apex:pageBlockTable value="{!bookings}" var="b">
                                <apex:column value="{!b.Booking_ID__c}"/>
                                <apex:column value="{!b.CHECK_IN__c}"/>
                                <apex:column value="{!b.CHECK_OUT__c}"/>
                                <apex:column value="{!b.CUSTOMER_Name__c}"/>
                                <apex:column value="{!b.ROOM__c}"/>
                      </apex:pageBlockTable>
                  </apex:tab>
              </apex:tabPanel>
          
          </apex:pageBlock>
      </apex:form>
</apex:page>

Controller logic 
public class hotelbooking {

     List<HOTEL_BOOKING__c> Bookings=[select Booking_Date__c,Booking_ID__c,CHECK_IN__c,CHECK_OUT__c,CUSTOMER_Name__c,   ROOM__c
                                      from HOTEL_BOOKING__c ];
 public list<HOTEL_BOOKING__c> getbookings(){
   return bookings;
 }  
 
 public pagereference doinsert(){
   HOTEL_BOOKING__c insrt=new HOTEL_BOOKING__c();
   //insrt.Booking_Date__c=bookingdate;
   insrt.CHECK_IN__c=checkin;
   insrt.CHECK_OUT__c=checkout;
   insrt.CUSTOMER_Name__c  =custname;
   insrt.ROOM__c=roomtype;
   
   insert insrt;
   
   return null;
 }   
 
 public datetime bookingdate  {get;set;} 
 public datetime checkin  {get;set;} 
 public datetime checkout  {get;set;} 
 public string custname  {get;set;} 
 public string roomtype {get;set;}                               
}


Pls help i am unable to insert the records in my custom object Hotel_booking__c.
Waiting for ur good sugetions
THANKS
-MOHIT S
i have created look up relationship between two objects but i am unable to select desired column i.e. i can see customer id, cust name,city i want to select Cust name it's allowing to select cuse id only..kindly help me to solve this query...