I have used the below stored procedure in drop down selected index changed event.
create function get_timesheetentrydetails(tasktypeid int, projectbatchlotid int)
returns table (workpackageid integer, workpackagename varchar(500), taskid int, taskname varchar(500), taskdesc varchar(500), previoustaskid int,
previoustaskname varchar(500), previoustaskdesc varchar(500), esthrs numeric, empid varchar(200)) as $$
begin
return query select wp.id,wp.code,wp.taskid,t.name,t.description,wp.previoustaskid,t1.name as previoustaskname,t1.description as previoustaskdesc,
wp.estimatehours ,u.name
from workpackage wp
inner join task t on wp.taskid=t.id
inner join task t1 on wp.previoustaskid = t1.id
inner join userprofile u on wp.lastupdatedby = u.id
and wp.projectbatchlotid=$2 and t.tasktypeid=$1 and wp.status in ('TBA','inprocess')
and not exists (select id from timesheet where timesheet.workpackageid=wp.id and endtime is null);
end;
$$ language plpgsql;
In the database server this procedure executes in 450ms but when I am calling from user interface if numberof users and data incresses for execution it is taking 60 sec. Colud you please help me how to slove this issue as early as possible.
The below code is in dropdown selected index changed event.
ddlTask.Enabled = true;
DataTable dtbTasks = getTSTasks(rbnCurrentTask.SelectedItem.Value, ddlLotNo.SelectedItem.Value);
Master.bindDropDownList(ddlTask, dtbTasks, "taskdesc", "taskid");
// cascadeSelection(this, "ddlTask");
if (rbnCurrentTask.SelectedItem.Text == "Project Management")
{
DataTable dtb = getPMTasks();
Master.bindDropDownList(ddlTask, dtb, "taskcode", "taskid");
}
if (rbnCurrentTask.SelectedItem.Text == "Training")
{
DataTable dtbTraining = getTrainingTasks();
Master.bindDropDownList(ddlTask, dtbTraining, "taskcode", "taskid");
}