Saturday, May 7, 2011

Make an Ajax Get call to a page ...

For making an ajax Get call we have to create a page which render's the data expected and here are some code snippets which can be helpful while making a call :

Create a parameters used to refine search or make an criteria . totally optional
var params = {};
params = { 'ProductID': productID};

Now make a call to the page with the params :

$.get('ProductInfoAjaxPage.aspx', params, function (data) {

// add data to the div
$("#getData").html(data);

}, 'html');

Here getData is the div inside the page where we are making ajax call and used to display ajax call response html.

so here you are calling ProductInfoAjaxPage.aspx page and passing a parameter ProductID which
can be used at ProductInfoAjaxPage.aspx page like :

In class file of ProductInfoAjaxPage.aspx page we can write

string productID= HttpContext.Current.Request.Params["ProductID"]; and use it for getting some information
related to that product ID

That's all ,

Cheers :)

Navitaire : How to change the Trip Availability Request

TripAvailabilityRequest availRequest = (TripAvailabilityRequest)this.SessionStore[SessionKey.TripAvailabilityRequest];
foreach (AvailabilityRequest request in availRequest.AvailabilityRequests)
{
request.BeginDate = DateTime.Now; //Changed Date

request.EndDate = DateTime.Now; //End date will be the same can change it
}

//Save it to the Existing session
this.SessionStore.Remove(SessionKey.TripAvailabilityRequest);
this.SessionStore.Add(SessionKey.TripAvailabilityRequest, availRequest);

Cheers ,

Wednesday, January 26, 2011

SQL: Where clause with group By..

We can use where clause with group by.

In that case first the where clause will apply to the statement and after filtering it Group by will grouped it. And further if we want to use Having to further filter it we can use.

here is small snippet for the same :

Select employee_ID , Max(sale)from Employee_Sale where Sale > 10000 group by employee_ID

Now the above statement with Having clause :

Select employee_ID , Max(sale)from Employee_Sale where sale > 10000 group by employee_ID having sum(sale) > 50000

Cheers