1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Date Range question

Discussion in 'C#' started by sice, Jun 1, 2008.

  1. #1
    Hi!

    I am a novice programmer, trying to start a reservation system in ASP.NET.. Can someone guide me how can i store the booking information for a date range?

    This is basically for me to help check availability..

    is there any opensource guide or help?

    Thanks in advance

    regards
     
    sice, Jun 1, 2008 IP
  2. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #2
    itcn, Jun 4, 2008 IP
  3. Forrest

    Forrest Peon

    Messages:
    500
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Store the from and to date along with the reservation, then check for resources ( hotel rooms, flights, ... ) that are available between those two dates.
     
    Forrest, Jun 4, 2008 IP
  4. sice

    sice Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks, can someone also tell me who would the sql query look like?
    Regards
     
    sice, Jun 8, 2008 IP
  5. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #5
    Sure, please post the data structure of your table(s) ...
     
    itcn, Jun 8, 2008 IP
  6. sice

    sice Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    table structure

    booking_table:
    _________
    booking id
    arrivedate
    enddate
    guestid
    totalpaid

    link_BookingRoom:
    roomid
    bookingid
    guestid

    room_table:
    roomid
    roomtype
    description
    rate
    maxpeople

    This is how the table structure looks like..

    by the way, i am also trying something like selecting all dates between the range and putting them in a dataset, below is the code which i am trying.. please can someone help me get it working? Thanks

                
    DateTime d1 = DatePicker1.SelectedDate.Value;
                DateTime d2 = DatePicker2.SelectedDate.Value;
                
    
                DataSet dsinternal = new DataSet();
                dsinternal.Tables.Add("mydates");
                dsinternal.Tables["mydates"].Columns.Add("dselect");
                DataRow rownew = dsinternal.Tables["mydates"].NewRow();
    
                
                while (d1.Date.ToShortDateString() != d2.Date.ToShortDateString())
                {   
                    rownew["dselect"] = d1.Date.ToShortDateString();
                    dsinternal.Tables["mydates"].Rows.Add(rownew);
                    d1.AddDays(1);
                }
    
                ListBox1.DataSource = dsinternal.Tables["mydates"];
                ListBox1.DataTextField = "dselect";
                this.DataBind();
    Code (markup):
    Please guide.. Thanks in advance

    regards
     
    sice, Jun 8, 2008 IP